@itwin/ecschema-rpcinterface-common 5.0.0-dev.9 → 5.0.0-dev.90

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,56 @@
1
1
  # Change Log - @itwin/ecschema-rpcinterface-common
2
2
 
3
- This log was last generated on Thu, 14 Nov 2024 18:13:56 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 19 Mar 2025 15:33:24 GMT and should not be manually modified.
4
+
5
+ ## 4.10.11
6
+ Wed, 19 Mar 2025 15:30:39 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 4.10.10
11
+ Tue, 11 Mar 2025 15:25:11 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 4.10.9
16
+ Tue, 11 Mar 2025 05:17:33 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 4.10.8
21
+ Thu, 06 Mar 2025 14:13:37 GMT
22
+
23
+ _Version update only_
24
+
25
+ ## 4.10.7
26
+ Tue, 18 Feb 2025 17:27:03 GMT
27
+
28
+ _Version update only_
29
+
30
+ ## 4.10.6
31
+ Fri, 24 Jan 2025 08:02:40 GMT
32
+
33
+ _Version update only_
34
+
35
+ ## 4.10.5
36
+ Tue, 21 Jan 2025 21:56:45 GMT
37
+
38
+ _Version update only_
39
+
40
+ ## 4.10.4
41
+ Mon, 13 Jan 2025 14:06:43 GMT
42
+
43
+ _Version update only_
44
+
45
+ ## 4.10.3
46
+ Mon, 06 Jan 2025 14:00:13 GMT
47
+
48
+ _Version update only_
49
+
50
+ ## 4.10.2
51
+ Thu, 21 Nov 2024 15:22:20 GMT
52
+
53
+ _Version update only_
4
54
 
5
55
  ## 4.10.1
6
56
  Thu, 14 Nov 2024 18:11:00 GMT
@@ -19,6 +19,10 @@ const core_common_1 = require("@itwin/core-common");
19
19
  * @internal
20
20
  */
21
21
  class ECSchemaRpcInterface extends core_common_1.RpcInterface {
22
+ /** The version of the RPC Interface. */
23
+ static version = "2.0.0";
24
+ static interfaceName = "ECSchemaRpcInterface";
25
+ static interfaceVersion = ECSchemaRpcInterface.version;
22
26
  /**
23
27
  * Returns the RPC client instance for the frontend.
24
28
  * @returns A client to communicate with the RPC Interface.
@@ -47,10 +51,6 @@ class ECSchemaRpcInterface extends core_common_1.RpcInterface {
47
51
  }
48
52
  }
49
53
  exports.ECSchemaRpcInterface = ECSchemaRpcInterface;
50
- /** The version of the RPC Interface. */
51
- ECSchemaRpcInterface.version = "2.0.0";
52
- ECSchemaRpcInterface.interfaceName = "ECSchemaRpcInterface";
53
- ECSchemaRpcInterface.interfaceVersion = ECSchemaRpcInterface.version;
54
54
  __decorate([
55
55
  core_common_1.RpcOperation.allowResponseCaching(core_common_1.RpcResponseCacheControl.Immutable)
56
56
  ], ECSchemaRpcInterface.prototype, "getSchemaKeys", null);
@@ -1 +1 @@
1
- {"version":3,"file":"ECSchemaRpcInterface.js","sourceRoot":"","sources":["../../src/ECSchemaRpcInterface.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;+FAG+F;AAC/F,oDAAqH;AAGrH;;;;;GAKG;AACH,MAAsB,oBAAqB,SAAQ,0BAAY;IAO7D;;;OAGG;IACI,MAAM,CAAC,SAAS;QACrB,OAAO,wBAAU,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IAEU,AAAN,KAAK,CAAC,aAAa,CAAC,WAA2B;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAA8B,CAAC;IAC5E,CAAC;IAED;;;;;;OAMG;IAEU,AAAN,KAAK,CAAC,aAAa,CAAC,WAA2B,EAAE,WAAmB;QACzE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAyB,CAAC;IACvE,CAAC;;AApCH,oDAsCC;AArCC,wCAAwC;AAC1B,4BAAO,GAAG,OAAO,CAAC;AAET,kCAAa,GAAG,sBAAsB,CAAC;AAChD,qCAAgB,GAAG,oBAAoB,CAAC,OAAO,CAAC;AAiBjD;IADZ,0BAAY,CAAC,oBAAoB,CAAC,qCAAuB,CAAC,SAAS,CAAC;yDAGpE;AAUY;IADZ,0BAAY,CAAC,oBAAoB,CAAC,qCAAuB,CAAC,SAAS,CAAC;yDAGpE","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\nimport { IModelRpcProps, RpcInterface, RpcManager, RpcOperation, RpcResponseCacheControl } from \"@itwin/core-common\";\r\nimport { SchemaKeyProps, SchemaProps } from \"@itwin/ecschema-metadata\";\r\n\r\n/***\r\n * Defines an RPC interface to get schema information from a given iModel context.\r\n * Method @see getSchemaNames will return the names of schemas that live in this iModel.\r\n * The actual schemas can be downloaded using @see getSchemaJSON to get the schema as JSON props.\r\n * @internal\r\n */\r\nexport abstract class ECSchemaRpcInterface extends RpcInterface {\r\n /** The version of the RPC Interface. */\r\n public static version = \"2.0.0\";\r\n\r\n public static readonly interfaceName = \"ECSchemaRpcInterface\";\r\n public static interfaceVersion = ECSchemaRpcInterface.version;\r\n\r\n /**\r\n * Returns the RPC client instance for the frontend.\r\n * @returns A client to communicate with the RPC Interface.\r\n */\r\n public static getClient(): ECSchemaRpcInterface {\r\n return RpcManager.getClientForInterface(ECSchemaRpcInterface);\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 @RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable)\r\n public async getSchemaKeys(_tokenProps: IModelRpcProps): Promise<SchemaKeyProps[]> {\r\n return this.forward.apply(this, [arguments]) as Promise<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 @RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable)\r\n public async getSchemaJSON(_tokenProps: IModelRpcProps, _schemaName: string): Promise<SchemaProps> {\r\n return this.forward.apply(this, [arguments]) as Promise<SchemaProps>;\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"ECSchemaRpcInterface.js","sourceRoot":"","sources":["../../src/ECSchemaRpcInterface.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;+FAG+F;AAC/F,oDAAqH;AAGrH;;;;;GAKG;AACH,MAAsB,oBAAqB,SAAQ,0BAAY;IAC7D,wCAAwC;IACjC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IAEzB,MAAM,CAAU,aAAa,GAAG,sBAAsB,CAAC;IACvD,MAAM,CAAC,gBAAgB,GAAG,oBAAoB,CAAC,OAAO,CAAC;IAE9D;;;OAGG;IACI,MAAM,CAAC,SAAS;QACrB,OAAO,wBAAU,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IAEU,AAAN,KAAK,CAAC,aAAa,CAAC,WAA2B;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAA8B,CAAC;IAC5E,CAAC;IAED;;;;;;OAMG;IAEU,AAAN,KAAK,CAAC,aAAa,CAAC,WAA2B,EAAE,WAAmB;QACzE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAyB,CAAC;IACvE,CAAC;;AApCH,oDAsCC;AAhBc;IADZ,0BAAY,CAAC,oBAAoB,CAAC,qCAAuB,CAAC,SAAS,CAAC;yDAGpE;AAUY;IADZ,0BAAY,CAAC,oBAAoB,CAAC,qCAAuB,CAAC,SAAS,CAAC;yDAGpE","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*--------------------------------------------------------------------------------------------*/\nimport { IModelRpcProps, RpcInterface, RpcManager, RpcOperation, RpcResponseCacheControl } from \"@itwin/core-common\";\nimport { SchemaKeyProps, SchemaProps } from \"@itwin/ecschema-metadata\";\n\n/***\n * Defines an RPC interface to get schema information from a given iModel context.\n * Method @see getSchemaNames will return the names of schemas that live in this iModel.\n * The actual schemas can be downloaded using @see getSchemaJSON to get the schema as JSON props.\n * @internal\n */\nexport abstract class ECSchemaRpcInterface extends RpcInterface {\n /** The version of the RPC Interface. */\n public static version = \"2.0.0\";\n\n public static readonly interfaceName = \"ECSchemaRpcInterface\";\n public static interfaceVersion = ECSchemaRpcInterface.version;\n\n /**\n * Returns the RPC client instance for the frontend.\n * @returns A client to communicate with the RPC Interface.\n */\n public static getClient(): ECSchemaRpcInterface {\n return RpcManager.getClientForInterface(ECSchemaRpcInterface);\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 @RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable)\n public async getSchemaKeys(_tokenProps: IModelRpcProps): Promise<SchemaKeyProps[]> {\n return this.forward.apply(this, [arguments]) as Promise<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 @RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable)\n public async getSchemaJSON(_tokenProps: IModelRpcProps, _schemaName: string): Promise<SchemaProps> {\n return this.forward.apply(this, [arguments]) as Promise<SchemaProps>;\n }\n\n}\n"]}
@@ -13,20 +13,20 @@ export declare class ECSchemaRpcLocater implements ISchemaLocater {
13
13
  * @param matchType How to match key against candidate schemas
14
14
  * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.
15
15
  */
16
- getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<T | undefined>;
16
+ getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined>;
17
17
  /**
18
18
  * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
19
19
  * The fully loaded schema can be accessed via the schema context using the getCachedSchema method.
20
20
  * @param schemaKey The SchemaKey describing the schema to get from the cache.
21
21
  * @param matchType The match type to use when locating the schema
22
22
  */
23
- getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;
23
+ getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;
24
24
  /**
25
25
  * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.
26
26
  * @param schemaKey Key to look up
27
27
  * @param matchType How to match key against candidate schemas
28
28
  * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.
29
29
  */
30
- getSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): T | undefined;
30
+ getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined;
31
31
  }
32
32
  //# sourceMappingURL=ECSchemaRpcLocater.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ECSchemaRpcLocater.d.ts","sourceRoot":"","sources":["../../src/ECSchemaRpcLocater.ts"],"names":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AE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAO7H;;;;;QAKI;IACS,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IASrI;;;;;MAKE;IACK,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS;CAUnH"}
@@ -12,6 +12,7 @@ const ECSchemaRpcInterface_1 = require("./ECSchemaRpcInterface");
12
12
  * @beta
13
13
  */
14
14
  class ECSchemaRpcLocater {
15
+ token;
15
16
  constructor(token) { this.token = token; }
16
17
  /**
17
18
  * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.
@@ -1 +1 @@
1
- {"version":3,"file":"ECSchemaRpcLocater.js","sourceRoot":"","sources":["../../src/ECSchemaRpcLocater.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAsI;AAEtI,iEAA8D;AAE9D;;;GAGG;AACH,MAAa,kBAAkB;IAG7B,YAAY,KAAqB,IAAI,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;IAE1D;;;;;MAKE;IACK,KAAK,CAAC,SAAS,CAAmB,SAA8B,EAAE,SAA0B,EAAE,OAAsB;QACzH,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAExD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACnE,OAAO,MAAW,CAAC;IACrB,CAAC;IAED;;;;;QAKI;IACG,KAAK,CAAC,aAAa,CAAC,SAA8B,EAAE,SAA0B,EAAE,OAAsB;QAC3G,MAAM,UAAU,GAAG,MAAM,2CAAoB,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QACpG,MAAM,UAAU,GAAG,MAAM,0BAAM,CAAC,oBAAoB,CAAC,UAAU,EAAE,OAAO,IAAI,IAAI,iCAAa,EAAE,CAAC,CAAC;QACjG,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;YACnF,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;MAKE;IACK,aAAa,CAAmB,SAA8B,EAAE,SAA0B,EAAE,OAAsB;QACvH,MAAM,UAAU,GAAG,2CAAoB,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAkB,EAAE,EAAE;YACxH,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,0BAAM,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,IAAI,IAAI,iCAAa,EAAE,CAAC,CAAC;QAC/E,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;YAC3E,OAAO,MAAW,CAAC;QACrB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAjDD,gDAiDC","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\nimport { ISchemaLocater, Schema, SchemaContext, SchemaInfo, SchemaKey, SchemaMatchType, SchemaProps } from \"@itwin/ecschema-metadata\";\r\nimport { IModelRpcProps } from \"@itwin/core-common\";\r\nimport { ECSchemaRpcInterface } from \"./ECSchemaRpcInterface\";\r\n\r\n/**\r\n * Defines a schema locater that retrieves schemas using an RPC interface.\r\n * @beta\r\n */\r\nexport class ECSchemaRpcLocater implements ISchemaLocater {\r\n public readonly token: IModelRpcProps;\r\n\r\n constructor(token: IModelRpcProps) { this.token = token; }\r\n\r\n /**\r\n * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.\r\n * @param schemaKey Key to look up\r\n * @param matchType How to match key against candidate schemas\r\n * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.\r\n */\r\n public async getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<T | undefined> {\r\n await this.getSchemaInfo(schemaKey, matchType, context);\r\n\r\n const schema = await context.getCachedSchema(schemaKey, matchType);\r\n return schema as T;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * The fully loaded schema can be accessed via the schema context using the getCachedSchema method.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined> {\r\n const schemaJson = await ECSchemaRpcInterface.getClient().getSchemaJSON(this.token, schemaKey.name);\r\n const schemaInfo = await Schema.startLoadingFromJson(schemaJson, context || new SchemaContext());\r\n if (schemaInfo !== undefined && schemaInfo.schemaKey.matches(schemaKey, matchType)) {\r\n return schemaInfo;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.\r\n * @param schemaKey Key to look up\r\n * @param matchType How to match key against candidate schemas\r\n * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.\r\n */\r\n public getSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): T | undefined {\r\n const schemaJson = ECSchemaRpcInterface.getClient().getSchemaJSON(this.token, schemaKey.name).then((props: SchemaProps) => {\r\n return props;\r\n });\r\n const schema = Schema.fromJsonSync(schemaJson, context || new SchemaContext());\r\n if (schema !== undefined && schema.schemaKey.matches(schemaKey, matchType)) {\r\n return schema as T;\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ECSchemaRpcLocater.js","sourceRoot":"","sources":["../../src/ECSchemaRpcLocater.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAsI;AAEtI,iEAA8D;AAE9D;;;GAGG;AACH,MAAa,kBAAkB;IACb,KAAK,CAAiB;IAEtC,YAAY,KAAqB,IAAI,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;IAE1D;;;;;MAKE;IACK,KAAK,CAAC,SAAS,CAAC,SAAoB,EAAE,SAA0B,EAAE,OAAsB;QAC7F,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAExD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACnE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;QAKI;IACG,KAAK,CAAC,aAAa,CAAC,SAAoB,EAAE,SAA0B,EAAE,OAAsB;QACjG,MAAM,UAAU,GAAG,MAAM,2CAAoB,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QACpG,MAAM,UAAU,GAAG,MAAM,0BAAM,CAAC,oBAAoB,CAAC,UAAU,EAAE,OAAO,IAAI,IAAI,iCAAa,EAAE,CAAC,CAAC;QACjG,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;YACnF,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;MAKE;IACK,aAAa,CAAC,SAAoB,EAAE,SAA0B,EAAE,OAAsB;QAC3F,MAAM,UAAU,GAAG,2CAAoB,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAkB,EAAE,EAAE;YACxH,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,0BAAM,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,IAAI,IAAI,iCAAa,EAAE,CAAC,CAAC;QAC/E,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;YAC3E,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAjDD,gDAiDC","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*--------------------------------------------------------------------------------------------*/\nimport { ISchemaLocater, Schema, SchemaContext, SchemaInfo, SchemaKey, SchemaMatchType, SchemaProps } from \"@itwin/ecschema-metadata\";\nimport { IModelRpcProps } from \"@itwin/core-common\";\nimport { ECSchemaRpcInterface } from \"./ECSchemaRpcInterface\";\n\n/**\n * Defines a schema locater that retrieves schemas using an RPC interface.\n * @beta\n */\nexport class ECSchemaRpcLocater implements ISchemaLocater {\n public readonly token: IModelRpcProps;\n\n constructor(token: IModelRpcProps) { this.token = token; }\n\n /**\n * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.\n * @param schemaKey Key to look up\n * @param matchType How to match key against candidate schemas\n * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.\n */\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined> {\n await this.getSchemaInfo(schemaKey, matchType, context);\n\n const schema = await context.getCachedSchema(schemaKey, matchType);\n return schema;\n }\n\n /**\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\n * The fully loaded schema can be accessed via the schema context using the getCachedSchema method.\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\n * @param matchType The match type to use when locating the schema\n */\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined> {\n const schemaJson = await ECSchemaRpcInterface.getClient().getSchemaJSON(this.token, schemaKey.name);\n const schemaInfo = await Schema.startLoadingFromJson(schemaJson, context || new SchemaContext());\n if (schemaInfo !== undefined && schemaInfo.schemaKey.matches(schemaKey, matchType)) {\n return schemaInfo;\n }\n return undefined;\n }\n\n /**\n * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.\n * @param schemaKey Key to look up\n * @param matchType How to match key against candidate schemas\n * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.\n */\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined {\n const schemaJson = ECSchemaRpcInterface.getClient().getSchemaJSON(this.token, schemaKey.name).then((props: SchemaProps) => {\n return props;\n });\n const schema = Schema.fromJsonSync(schemaJson, context || new SchemaContext());\n if (schema !== undefined && schema.schemaKey.matches(schemaKey, matchType)) {\n return schema;\n }\n return undefined;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ecschema-rpc-interface.js","sourceRoot":"","sources":["../../src/ecschema-rpc-interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,yDAAuC;AACvC,uDAAqC","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 \"./ECSchemaRpcInterface\";\r\nexport * from \"./ECSchemaRpcLocater\";\r\n"]}
1
+ {"version":3,"file":"ecschema-rpc-interface.js","sourceRoot":"","sources":["../../src/ecschema-rpc-interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,yDAAuC;AACvC,uDAAqC","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 \"./ECSchemaRpcInterface\";\nexport * from \"./ECSchemaRpcLocater\";\n"]}
@@ -16,6 +16,10 @@ import { RpcInterface, RpcManager, RpcOperation, RpcResponseCacheControl } from
16
16
  * @internal
17
17
  */
18
18
  export class ECSchemaRpcInterface extends RpcInterface {
19
+ /** The version of the RPC Interface. */
20
+ static version = "2.0.0";
21
+ static interfaceName = "ECSchemaRpcInterface";
22
+ static interfaceVersion = ECSchemaRpcInterface.version;
19
23
  /**
20
24
  * Returns the RPC client instance for the frontend.
21
25
  * @returns A client to communicate with the RPC Interface.
@@ -43,10 +47,6 @@ export class ECSchemaRpcInterface extends RpcInterface {
43
47
  return this.forward.apply(this, [arguments]);
44
48
  }
45
49
  }
46
- /** The version of the RPC Interface. */
47
- ECSchemaRpcInterface.version = "2.0.0";
48
- ECSchemaRpcInterface.interfaceName = "ECSchemaRpcInterface";
49
- ECSchemaRpcInterface.interfaceVersion = ECSchemaRpcInterface.version;
50
50
  __decorate([
51
51
  RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable)
52
52
  ], ECSchemaRpcInterface.prototype, "getSchemaKeys", null);
@@ -1 +1 @@
1
- {"version":3,"file":"ECSchemaRpcInterface.js","sourceRoot":"","sources":["../../src/ECSchemaRpcInterface.ts"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,OAAO,EAAkB,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGrH;;;;;GAKG;AACH,MAAM,OAAgB,oBAAqB,SAAQ,YAAY;IAO7D;;;OAGG;IACI,MAAM,CAAC,SAAS;QACrB,OAAO,UAAU,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IAEU,AAAN,KAAK,CAAC,aAAa,CAAC,WAA2B;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAA8B,CAAC;IAC5E,CAAC;IAED;;;;;;OAMG;IAEU,AAAN,KAAK,CAAC,aAAa,CAAC,WAA2B,EAAE,WAAmB;QACzE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAyB,CAAC;IACvE,CAAC;;AAnCD,wCAAwC;AAC1B,4BAAO,GAAG,OAAO,CAAC;AAET,kCAAa,GAAG,sBAAsB,CAAC;AAChD,qCAAgB,GAAG,oBAAoB,CAAC,OAAO,CAAC;AAiBjD;IADZ,YAAY,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,SAAS,CAAC;yDAGpE;AAUY;IADZ,YAAY,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,SAAS,CAAC;yDAGpE","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\nimport { IModelRpcProps, RpcInterface, RpcManager, RpcOperation, RpcResponseCacheControl } from \"@itwin/core-common\";\r\nimport { SchemaKeyProps, SchemaProps } from \"@itwin/ecschema-metadata\";\r\n\r\n/***\r\n * Defines an RPC interface to get schema information from a given iModel context.\r\n * Method @see getSchemaNames will return the names of schemas that live in this iModel.\r\n * The actual schemas can be downloaded using @see getSchemaJSON to get the schema as JSON props.\r\n * @internal\r\n */\r\nexport abstract class ECSchemaRpcInterface extends RpcInterface {\r\n /** The version of the RPC Interface. */\r\n public static version = \"2.0.0\";\r\n\r\n public static readonly interfaceName = \"ECSchemaRpcInterface\";\r\n public static interfaceVersion = ECSchemaRpcInterface.version;\r\n\r\n /**\r\n * Returns the RPC client instance for the frontend.\r\n * @returns A client to communicate with the RPC Interface.\r\n */\r\n public static getClient(): ECSchemaRpcInterface {\r\n return RpcManager.getClientForInterface(ECSchemaRpcInterface);\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 @RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable)\r\n public async getSchemaKeys(_tokenProps: IModelRpcProps): Promise<SchemaKeyProps[]> {\r\n return this.forward.apply(this, [arguments]) as Promise<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 @RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable)\r\n public async getSchemaJSON(_tokenProps: IModelRpcProps, _schemaName: string): Promise<SchemaProps> {\r\n return this.forward.apply(this, [arguments]) as Promise<SchemaProps>;\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"ECSchemaRpcInterface.js","sourceRoot":"","sources":["../../src/ECSchemaRpcInterface.ts"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,OAAO,EAAkB,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGrH;;;;;GAKG;AACH,MAAM,OAAgB,oBAAqB,SAAQ,YAAY;IAC7D,wCAAwC;IACjC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IAEzB,MAAM,CAAU,aAAa,GAAG,sBAAsB,CAAC;IACvD,MAAM,CAAC,gBAAgB,GAAG,oBAAoB,CAAC,OAAO,CAAC;IAE9D;;;OAGG;IACI,MAAM,CAAC,SAAS;QACrB,OAAO,UAAU,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IAEU,AAAN,KAAK,CAAC,aAAa,CAAC,WAA2B;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAA8B,CAAC;IAC5E,CAAC;IAED;;;;;;OAMG;IAEU,AAAN,KAAK,CAAC,aAAa,CAAC,WAA2B,EAAE,WAAmB;QACzE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAyB,CAAC;IACvE,CAAC;;AAdY;IADZ,YAAY,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,SAAS,CAAC;yDAGpE;AAUY;IADZ,YAAY,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,SAAS,CAAC;yDAGpE","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*--------------------------------------------------------------------------------------------*/\nimport { IModelRpcProps, RpcInterface, RpcManager, RpcOperation, RpcResponseCacheControl } from \"@itwin/core-common\";\nimport { SchemaKeyProps, SchemaProps } from \"@itwin/ecschema-metadata\";\n\n/***\n * Defines an RPC interface to get schema information from a given iModel context.\n * Method @see getSchemaNames will return the names of schemas that live in this iModel.\n * The actual schemas can be downloaded using @see getSchemaJSON to get the schema as JSON props.\n * @internal\n */\nexport abstract class ECSchemaRpcInterface extends RpcInterface {\n /** The version of the RPC Interface. */\n public static version = \"2.0.0\";\n\n public static readonly interfaceName = \"ECSchemaRpcInterface\";\n public static interfaceVersion = ECSchemaRpcInterface.version;\n\n /**\n * Returns the RPC client instance for the frontend.\n * @returns A client to communicate with the RPC Interface.\n */\n public static getClient(): ECSchemaRpcInterface {\n return RpcManager.getClientForInterface(ECSchemaRpcInterface);\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 @RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable)\n public async getSchemaKeys(_tokenProps: IModelRpcProps): Promise<SchemaKeyProps[]> {\n return this.forward.apply(this, [arguments]) as Promise<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 @RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable)\n public async getSchemaJSON(_tokenProps: IModelRpcProps, _schemaName: string): Promise<SchemaProps> {\n return this.forward.apply(this, [arguments]) as Promise<SchemaProps>;\n }\n\n}\n"]}
@@ -13,20 +13,20 @@ export declare class ECSchemaRpcLocater implements ISchemaLocater {
13
13
  * @param matchType How to match key against candidate schemas
14
14
  * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.
15
15
  */
16
- getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<T | undefined>;
16
+ getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined>;
17
17
  /**
18
18
  * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
19
19
  * The fully loaded schema can be accessed via the schema context using the getCachedSchema method.
20
20
  * @param schemaKey The SchemaKey describing the schema to get from the cache.
21
21
  * @param matchType The match type to use when locating the schema
22
22
  */
23
- getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;
23
+ getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;
24
24
  /**
25
25
  * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.
26
26
  * @param schemaKey Key to look up
27
27
  * @param matchType How to match key against candidate schemas
28
28
  * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.
29
29
  */
30
- getSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): T | undefined;
30
+ getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined;
31
31
  }
32
32
  //# sourceMappingURL=ECSchemaRpcLocater.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ECSchemaRpcLocater.d.ts","sourceRoot":"","sources":["../../src/ECSchemaRpcLocater.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAe,MAAM,0BAA0B,CAAC;AACtI,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,cAAc;IACvD,SAAgB,KAAK,EAAE,cAAc,CAAC;gBAE1B,KAAK,EAAE,cAAc;IAEjC;;;;;MAKE;IACW,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAOpJ;;;;;QAKI;IACS,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAS/I;;;;;MAKE;IACK,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,CAAC,GAAG,SAAS;CAU1I"}
1
+ {"version":3,"file":"ECSchemaRpcLocater.d.ts","sourceRoot":"","sources":["../../src/ECSchemaRpcLocater.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAe,MAAM,0BAA0B,CAAC;AACtI,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,cAAc;IACvD,SAAgB,KAAK,EAAE,cAAc,CAAC;gBAE1B,KAAK,EAAE,cAAc;IAEjC;;;;;MAKE;IACW,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAO7H;;;;;QAKI;IACS,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IASrI;;;;;MAKE;IACK,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS;CAUnH"}
@@ -9,6 +9,7 @@ import { ECSchemaRpcInterface } from "./ECSchemaRpcInterface";
9
9
  * @beta
10
10
  */
11
11
  export class ECSchemaRpcLocater {
12
+ token;
12
13
  constructor(token) { this.token = token; }
13
14
  /**
14
15
  * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.
@@ -1 +1 @@
1
- {"version":3,"file":"ECS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AC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAkB,EAAE,EAAE;YACxH,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,IAAI,IAAI,aAAa,EAAE,CAAC,CAAC;QAC/E,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;YAC3E,OAAO,MAAW,CAAC;QACrB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,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\nimport { ISchemaLocater, Schema, SchemaContext, SchemaInfo, SchemaKey, SchemaMatchType, SchemaProps } from \"@itwin/ecschema-metadata\";\r\nimport { IModelRpcProps } from \"@itwin/core-common\";\r\nimport { ECSchemaRpcInterface } from \"./ECSchemaRpcInterface\";\r\n\r\n/**\r\n * Defines a schema locater that retrieves schemas using an RPC interface.\r\n * @beta\r\n */\r\nexport class ECSchemaRpcLocater implements ISchemaLocater {\r\n public readonly token: IModelRpcProps;\r\n\r\n constructor(token: IModelRpcProps) { this.token = token; }\r\n\r\n /**\r\n * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.\r\n * @param schemaKey Key to look up\r\n * @param matchType How to match key against candidate schemas\r\n * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.\r\n */\r\n public async getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<T | undefined> {\r\n await this.getSchemaInfo(schemaKey, matchType, context);\r\n\r\n const schema = await context.getCachedSchema(schemaKey, matchType);\r\n return schema as T;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * The fully loaded schema can be accessed via the schema context using the getCachedSchema method.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined> {\r\n const schemaJson = await ECSchemaRpcInterface.getClient().getSchemaJSON(this.token, schemaKey.name);\r\n const schemaInfo = await Schema.startLoadingFromJson(schemaJson, context || new SchemaContext());\r\n if (schemaInfo !== undefined && schemaInfo.schemaKey.matches(schemaKey, matchType)) {\r\n return schemaInfo;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.\r\n * @param schemaKey Key to look up\r\n * @param matchType How to match key against candidate schemas\r\n * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.\r\n */\r\n public getSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): T | undefined {\r\n const schemaJson = ECSchemaRpcInterface.getClient().getSchemaJSON(this.token, schemaKey.name).then((props: SchemaProps) => {\r\n return props;\r\n });\r\n const schema = Schema.fromJsonSync(schemaJson, context || new SchemaContext());\r\n if (schema !== undefined && schema.schemaKey.matches(schemaKey, matchType)) {\r\n return schema as T;\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ECSchemaRpcLocater.js","sourceRoot":"","sources":["../../src/ECSchemaRpcLocater.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAkB,MAAM,EAAE,aAAa,EAAuD,MAAM,0BAA0B,CAAC;AAEtI,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACb,KAAK,CAAiB;IAEtC,YAA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AM,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;YAC3E,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,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*--------------------------------------------------------------------------------------------*/\nimport { ISchemaLocater, Schema, SchemaContext, SchemaInfo, SchemaKey, SchemaMatchType, SchemaProps } from \"@itwin/ecschema-metadata\";\nimport { IModelRpcProps } from \"@itwin/core-common\";\nimport { ECSchemaRpcInterface } from \"./ECSchemaRpcInterface\";\n\n/**\n * Defines a schema locater that retrieves schemas using an RPC interface.\n * @beta\n */\nexport class ECSchemaRpcLocater implements ISchemaLocater {\n public readonly token: IModelRpcProps;\n\n constructor(token: IModelRpcProps) { this.token = token; }\n\n /**\n * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.\n * @param schemaKey Key to look up\n * @param matchType How to match key against candidate schemas\n * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.\n */\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined> {\n await this.getSchemaInfo(schemaKey, matchType, context);\n\n const schema = await context.getCachedSchema(schemaKey, matchType);\n return schema;\n }\n\n /**\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\n * The fully loaded schema can be accessed via the schema context using the getCachedSchema method.\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\n * @param matchType The match type to use when locating the schema\n */\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined> {\n const schemaJson = await ECSchemaRpcInterface.getClient().getSchemaJSON(this.token, schemaKey.name);\n const schemaInfo = await Schema.startLoadingFromJson(schemaJson, context || new SchemaContext());\n if (schemaInfo !== undefined && schemaInfo.schemaKey.matches(schemaKey, matchType)) {\n return schemaInfo;\n }\n return undefined;\n }\n\n /**\n * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.\n * @param schemaKey Key to look up\n * @param matchType How to match key against candidate schemas\n * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.\n */\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined {\n const schemaJson = ECSchemaRpcInterface.getClient().getSchemaJSON(this.token, schemaKey.name).then((props: SchemaProps) => {\n return props;\n });\n const schema = Schema.fromJsonSync(schemaJson, context || new SchemaContext());\n if (schema !== undefined && schema.schemaKey.matches(schemaKey, matchType)) {\n return schema;\n }\n return undefined;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ecschema-rpc-interface.js","sourceRoot":"","sources":["../../src/ecschema-rpc-interface.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,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 \"./ECSchemaRpcInterface\";\r\nexport * from \"./ECSchemaRpcLocater\";\r\n"]}
1
+ {"version":3,"file":"ecschema-rpc-interface.js","sourceRoot":"","sources":["../../src/ecschema-rpc-interface.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,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 \"./ECSchemaRpcInterface\";\nexport * from \"./ECSchemaRpcLocater\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/ecschema-rpcinterface-common",
3
- "version": "5.0.0-dev.9",
3
+ "version": "5.0.0-dev.90",
4
4
  "description": "Schema RPC Interface common interface",
5
5
  "main": "lib/cjs/ecschema-rpc-interface.js",
6
6
  "module": "lib/esm/ecschema-rpc-interface.js",
@@ -22,27 +22,27 @@
22
22
  "url": "http://www.bentley.com"
23
23
  },
24
24
  "peerDependencies": {
25
- "@itwin/core-bentley": "5.0.0-dev.9",
26
- "@itwin/ecschema-metadata": "5.0.0-dev.9",
27
- "@itwin/core-common": "5.0.0-dev.9",
28
- "@itwin/core-geometry": "5.0.0-dev.9"
25
+ "@itwin/core-bentley": "5.0.0-dev.90",
26
+ "@itwin/core-geometry": "5.0.0-dev.90",
27
+ "@itwin/core-common": "5.0.0-dev.90",
28
+ "@itwin/ecschema-metadata": "5.0.0-dev.90"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@itwin/eslint-plugin": "5.0.0-dev.1",
32
32
  "eslint": "^9.13.0",
33
- "rimraf": "^3.0.2",
33
+ "rimraf": "^6.0.1",
34
34
  "typescript": "~5.6.2",
35
- "@itwin/build-tools": "5.0.0-dev.9",
36
- "@itwin/core-bentley": "5.0.0-dev.9",
37
- "@itwin/core-common": "5.0.0-dev.9",
38
- "@itwin/core-geometry": "5.0.0-dev.9",
39
- "@itwin/ecschema-metadata": "5.0.0-dev.9"
35
+ "@itwin/build-tools": "5.0.0-dev.90",
36
+ "@itwin/ecschema-metadata": "5.0.0-dev.90",
37
+ "@itwin/core-bentley": "5.0.0-dev.90",
38
+ "@itwin/core-common": "5.0.0-dev.90",
39
+ "@itwin/core-geometry": "5.0.0-dev.90"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "npm run -s build:cjs && npm run -s build:esm",
43
43
  "build:cjs": "tsc 1>&2 --outDir lib/cjs",
44
- "build:esm": "tsc 1>&2 --module ES2020 --outDir lib/esm",
45
- "clean": "rimraf lib .rush/temp/package-deps*.json",
44
+ "build:esm": "tsc 1>&2 --module ES2022 --outDir lib/esm",
45
+ "clean": "rimraf -g lib .rush/temp/package-deps*.json",
46
46
  "cover": "",
47
47
  "docs": "",
48
48
  "extract-api": "betools extract-api --entry=ecschema-rpc-interface",