@itwin/ecschema-rpcinterface-impl 5.2.0-dev.7 → 5.3.0-dev.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,41 @@
1
1
  # Change Log - @itwin/ecschema-rpcinterface-impl
2
2
 
3
- This log was last generated on Fri, 08 Aug 2025 18:10:14 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 17 Sep 2025 17:22:51 GMT and should not be manually modified.
4
+
5
+ ## 5.1.8
6
+ Wed, 17 Sep 2025 17:17:16 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 5.1.7
11
+ Tue, 09 Sep 2025 19:28:04 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 5.1.6
16
+ Mon, 08 Sep 2025 13:53:47 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 5.1.5
21
+ Thu, 04 Sep 2025 13:51:09 GMT
22
+
23
+ _Version update only_
24
+
25
+ ## 5.1.4
26
+ Fri, 22 Aug 2025 14:22:33 GMT
27
+
28
+ _Version update only_
29
+
30
+ ## 5.1.3
31
+ Wed, 20 Aug 2025 13:57:10 GMT
32
+
33
+ _Version update only_
34
+
35
+ ## 5.1.2
36
+ Thu, 14 Aug 2025 19:38:08 GMT
37
+
38
+ _Version update only_
4
39
 
5
40
  ## 5.1.1
6
41
  Fri, 08 Aug 2025 18:06:10 GMT
@@ -31,6 +31,6 @@ export declare class ECSchemaRpcImpl extends RpcInterface implements ECSchemaRpc
31
31
  * @param schemaName The name of the schema that shall be returned.
32
32
  * @returns The SchemaProps.
33
33
  */
34
- getSchemaJSON(tokenProps: IModelRpcProps, schemaName: string): Promise<SchemaProps>;
34
+ getSchemaJSON(tokenProps: IModelRpcProps, schemaName: string): Promise<SchemaProps | undefined>;
35
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;AAa3E;;;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;IAiBjF;;;;;;OAMG;IACU,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAQjG"}
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;AAa3E;;;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;IAiBjF;;;;;;OAMG;IACU,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;CAgB7G"}
@@ -62,7 +62,14 @@ class ECSchemaRpcImpl extends core_common_1.RpcInterface {
62
62
  throw new Error(`Schema name must not be undefined or empty.`);
63
63
  }
64
64
  const iModelDb = await this.getIModelDatabase(tokenProps);
65
- return iModelDb[backend._nativeDb].getSchemaProps(schemaName);
65
+ try {
66
+ return iModelDb[backend._nativeDb].getSchemaProps(schemaName);
67
+ }
68
+ catch (e) {
69
+ if (e.message && e.message === "schema not found")
70
+ return undefined;
71
+ throw (e);
72
+ }
66
73
  }
67
74
  }
68
75
  exports.ECSchemaRpcImpl = ECSchemaRpcImpl;
@@ -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;QACnJ,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,QAAQ,CAAC,iBAAiB,CAAC,eAAe,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,4BAAc,CAAC,kBAAkB,EAAE,CAAC,EAAE,CAAC;YACjI,MAAM,mBAAmB,GAAG,GAAG,CAAC,KAAK,EAAmB,CAAC;YACzD,MAAM,cAAc,GAAG,mBAAmB,CAAC,UAAU,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;YAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YAChD,MAAM,KAAK,GAAG,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YAChD,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,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,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;QACnJ,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,QAAQ,CAAC,iBAAiB,CAAC,eAAe,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,4BAAc,CAAC,kBAAkB,EAAE,CAAC,EAAE,CAAC;YACjI,MAAM,mBAAmB,GAAG,GAAG,CAAC,KAAK,EAAmB,CAAC;YACzD,MAAM,cAAc,GAAG,mBAAmB,CAAC,UAAU,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;YAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YAChD,MAAM,KAAK,GAAG,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YAChD,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,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;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;AAlED,0CAkEC","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"]}
@@ -31,6 +31,6 @@ export declare class ECSchemaRpcImpl extends RpcInterface implements ECSchemaRpc
31
31
  * @param schemaName The name of the schema that shall be returned.
32
32
  * @returns The SchemaProps.
33
33
  */
34
- getSchemaJSON(tokenProps: IModelRpcProps, schemaName: string): Promise<SchemaProps>;
34
+ getSchemaJSON(tokenProps: IModelRpcProps, schemaName: string): Promise<SchemaProps | undefined>;
35
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;AAa3E;;;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;IAiBjF;;;;;;OAMG;IACU,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAQjG"}
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;AAa3E;;;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;IAiBjF;;;;;;OAMG;IACU,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;CAgB7G"}
@@ -59,7 +59,14 @@ export class ECSchemaRpcImpl extends RpcInterface {
59
59
  throw new Error(`Schema name must not be undefined or empty.`);
60
60
  }
61
61
  const iModelDb = await this.getIModelDatabase(tokenProps);
62
- return iModelDb[backend._nativeDb].getSchemaProps(schemaName);
62
+ try {
63
+ return iModelDb[backend._nativeDb].getSchemaProps(schemaName);
64
+ }
65
+ catch (e) {
66
+ if (e.message && e.message === "schema not found")
67
+ return undefined;
68
+ throw (e);
69
+ }
63
70
  }
64
71
  }
65
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,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;A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AAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,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","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,KA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CAAC,CAAC;YAChD,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,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;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":["/*---------------------------------------------------------------------------------------------\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/ecschema-rpcinterface-impl",
3
- "version": "5.2.0-dev.7",
3
+ "version": "5.3.0-dev.1",
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.2.0-dev.7",
26
- "@itwin/core-bentley": "5.2.0-dev.7",
27
- "@itwin/ecschema-metadata": "5.2.0-dev.7",
28
- "@itwin/ecschema-rpcinterface-common": "5.2.0-dev.7",
29
- "@itwin/core-common": "5.2.0-dev.7",
30
- "@itwin/core-geometry": "5.2.0-dev.7"
25
+ "@itwin/core-backend": "5.3.0-dev.1",
26
+ "@itwin/core-bentley": "5.3.0-dev.1",
27
+ "@itwin/core-geometry": "5.3.0-dev.1",
28
+ "@itwin/core-common": "5.3.0-dev.1",
29
+ "@itwin/ecschema-metadata": "5.3.0-dev.1",
30
+ "@itwin/ecschema-rpcinterface-common": "5.3.0-dev.1"
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.2.0-dev.7",
38
- "@itwin/core-backend": "5.2.0-dev.7",
39
- "@itwin/core-geometry": "5.2.0-dev.7",
40
- "@itwin/core-bentley": "5.2.0-dev.7",
41
- "@itwin/ecschema-metadata": "5.2.0-dev.7",
42
- "@itwin/core-common": "5.2.0-dev.7",
43
- "@itwin/ecschema-rpcinterface-common": "5.2.0-dev.7"
37
+ "@itwin/core-backend": "5.3.0-dev.1",
38
+ "@itwin/build-tools": "5.3.0-dev.1",
39
+ "@itwin/core-common": "5.3.0-dev.1",
40
+ "@itwin/core-geometry": "5.3.0-dev.1",
41
+ "@itwin/core-bentley": "5.3.0-dev.1",
42
+ "@itwin/ecschema-metadata": "5.3.0-dev.1",
43
+ "@itwin/ecschema-rpcinterface-common": "5.3.0-dev.1"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "npm run -s build:cjs && npm run -s build:esm",