@itwin/ecschema-rpcinterface-impl 5.5.0-dev.2 → 5.5.0-dev.4

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,11 @@
1
1
  # Change Log - @itwin/ecschema-rpcinterface-impl
2
2
 
3
- This log was last generated on Thu, 20 Nov 2025 22:31:49 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 02 Dec 2025 23:11:57 GMT and should not be manually modified.
4
+
5
+ ## 5.4.0
6
+ Tue, 02 Dec 2025 21:22:25 GMT
7
+
8
+ _Version update only_
4
9
 
5
10
  ## 5.3.3
6
11
  Thu, 20 Nov 2025 22:30:37 GMT
@@ -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;AAa3E;;;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,MAAM,eAAe,GAAG,0HAA0H,CAAC;Q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Content":["/*---------------------------------------------------------------------------------------------\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 | undefined> {\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\n try {\n return iModelDb[backend._nativeDb].getSchemaProps(schemaName);\n } catch(e: any) {\n if (e.message && e.message === \"schema not found\")\n return undefined;\n\n throw(e);\n }\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,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,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AAE,CAAC;YACf,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,KAAK,kBAAkB;gBAC/C,OAAO,SAAS,CAAC;YAEnB,MAAK,CAAC,CAAC,CAAC,CAAC;QACX,CAAC;IACH,CAAC;CACF;AAlED,0CAkEC","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 | undefined> {\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\r\n try {\r\n return iModelDb[backend._nativeDb].getSchemaProps(schemaName);\r\n } catch(e: any) {\r\n if (e.message && e.message === \"schema not found\")\r\n return undefined;\r\n\r\n throw(e);\r\n }\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,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,aAAa,CAAC,UAA0B;QAEnD,MAAM,cAAc,GAAqB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OAAO,KAAK,kBAAkB;gBAC/C,OAAO,SAAS,CAAC;YAEnB,MAAK,CAAC,CAAC,CAAC,CAAC;QACX,CAAC;IACH,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 | undefined> {\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\n try {\n return iModelDb[backend._nativeDb].getSchemaProps(schemaName);\n } catch(e: any) {\n if (e.message && e.message === \"schema not found\")\n return undefined;\n\n throw(e);\n }\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;;;;;O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AC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAE1D,IAAI,CAAC;YACH,OAAO,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QAChE,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,KAAK,kBAAkB;gBAC/C,OAAO,SAAS,CAAC;YAEnB,MAAK,CAAC,CAAC,CAAC,CAAC;QACX,CAAC;IACH,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 | undefined> {\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\r\n try {\r\n return iModelDb[backend._nativeDb].getSchemaProps(schemaName);\r\n } catch(e: any) {\r\n if (e.message && e.message === \"schema not found\")\r\n return undefined;\r\n\r\n throw(e);\r\n }\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.5.0-dev.2",
3
+ "version": "5.5.0-dev.4",
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.5.0-dev.2",
26
- "@itwin/core-bentley": "5.5.0-dev.2",
27
- "@itwin/core-geometry": "5.5.0-dev.2",
28
- "@itwin/core-common": "5.5.0-dev.2",
29
- "@itwin/ecschema-metadata": "5.5.0-dev.2",
30
- "@itwin/ecschema-rpcinterface-common": "5.5.0-dev.2"
25
+ "@itwin/core-backend": "5.5.0-dev.4",
26
+ "@itwin/core-bentley": "5.5.0-dev.4",
27
+ "@itwin/ecschema-metadata": "5.5.0-dev.4",
28
+ "@itwin/core-common": "5.5.0-dev.4",
29
+ "@itwin/core-geometry": "5.5.0-dev.4",
30
+ "@itwin/ecschema-rpcinterface-common": "5.5.0-dev.4"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@itwin/eslint-plugin": "5.2.2-dev.2",
34
34
  "eslint": "^9.31.0",
35
35
  "rimraf": "^6.0.1",
36
36
  "typescript": "~5.6.2",
37
- "@itwin/build-tools": "5.5.0-dev.2",
38
- "@itwin/core-bentley": "5.5.0-dev.2",
39
- "@itwin/core-backend": "5.5.0-dev.2",
40
- "@itwin/ecschema-rpcinterface-common": "5.5.0-dev.2",
41
- "@itwin/core-common": "5.5.0-dev.2",
42
- "@itwin/core-geometry": "5.5.0-dev.2",
43
- "@itwin/ecschema-metadata": "5.5.0-dev.2"
37
+ "@itwin/build-tools": "5.5.0-dev.4",
38
+ "@itwin/core-bentley": "5.5.0-dev.4",
39
+ "@itwin/core-backend": "5.5.0-dev.4",
40
+ "@itwin/core-common": "5.5.0-dev.4",
41
+ "@itwin/ecschema-metadata": "5.5.0-dev.4",
42
+ "@itwin/core-geometry": "5.5.0-dev.4",
43
+ "@itwin/ecschema-rpcinterface-common": "5.5.0-dev.4"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "npm run -s build:cjs && npm run -s build:esm",