@itwin/ecschema-rpcinterface-common 5.2.0-dev.8 → 5.3.0-dev.2
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 +36 -1
- package/lib/cjs/ECSchemaRpcInterface.d.ts +1 -1
- package/lib/cjs/ECSchemaRpcInterface.d.ts.map +1 -1
- package/lib/cjs/ECSchemaRpcInterface.js.map +1 -1
- package/lib/cjs/ECSchemaRpcLocater.d.ts.map +1 -1
- package/lib/cjs/ECSchemaRpcLocater.js +3 -9
- package/lib/cjs/ECSchemaRpcLocater.js.map +1 -1
- package/lib/esm/ECSchemaRpcInterface.d.ts +1 -1
- package/lib/esm/ECSchemaRpcInterface.d.ts.map +1 -1
- package/lib/esm/ECSchemaRpcInterface.js.map +1 -1
- package/lib/esm/ECSchemaRpcLocater.d.ts.map +1 -1
- package/lib/esm/ECSchemaRpcLocater.js +3 -9
- package/lib/esm/ECSchemaRpcLocater.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
# Change Log - @itwin/ecschema-rpcinterface-common
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 24 Sep 2025 17:43:58 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.1.9
|
|
6
|
+
Wed, 24 Sep 2025 17:38:08 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 5.1.8
|
|
11
|
+
Wed, 17 Sep 2025 17:17:16 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 5.1.7
|
|
16
|
+
Tue, 09 Sep 2025 19:28:04 GMT
|
|
17
|
+
|
|
18
|
+
_Version update only_
|
|
19
|
+
|
|
20
|
+
## 5.1.6
|
|
21
|
+
Mon, 08 Sep 2025 13:53:47 GMT
|
|
22
|
+
|
|
23
|
+
_Version update only_
|
|
24
|
+
|
|
25
|
+
## 5.1.5
|
|
26
|
+
Thu, 04 Sep 2025 13:51:09 GMT
|
|
27
|
+
|
|
28
|
+
_Version update only_
|
|
29
|
+
|
|
30
|
+
## 5.1.4
|
|
31
|
+
Fri, 22 Aug 2025 14:22:33 GMT
|
|
32
|
+
|
|
33
|
+
_Version update only_
|
|
34
|
+
|
|
35
|
+
## 5.1.3
|
|
36
|
+
Wed, 20 Aug 2025 13:57:10 GMT
|
|
37
|
+
|
|
38
|
+
_Version update only_
|
|
4
39
|
|
|
5
40
|
## 5.1.2
|
|
6
41
|
Thu, 14 Aug 2025 19:38:08 GMT
|
|
@@ -30,6 +30,6 @@ export declare abstract class ECSchemaRpcInterface extends RpcInterface {
|
|
|
30
30
|
* @param schemaName The name of the schema that shall be returned.
|
|
31
31
|
* @returns The SchemaProps.
|
|
32
32
|
*/
|
|
33
|
-
getSchemaJSON(_tokenProps: IModelRpcProps, _schemaName: string): Promise<SchemaProps>;
|
|
33
|
+
getSchemaJSON(_tokenProps: IModelRpcProps, _schemaName: string): Promise<SchemaProps | undefined>;
|
|
34
34
|
}
|
|
35
35
|
//# sourceMappingURL=ECSchemaRpcInterface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECSchemaRpcInterface.d.ts","sourceRoot":"","sources":["../../src/ECSchemaRpcInterface.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAqD,MAAM,oBAAoB,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvE;;;;;GAKG;AACH,8BAAsB,oBAAqB,SAAQ,YAAY;IAC7D,wCAAwC;IACxC,OAAc,OAAO,SAAW;IAEhC,gBAAuB,aAAa,0BAA0B;IAC9D,OAAc,gBAAgB,SAAgC;IAE9D;;;OAGG;WACW,SAAS,IAAI,oBAAoB;IAI/C;;;;;OAKG;IAEU,aAAa,CAAC,WAAW,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIlF;;;;;;OAMG;IAEU,aAAa,CAAC,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ECSchemaRpcInterface.d.ts","sourceRoot":"","sources":["../../src/ECSchemaRpcInterface.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAqD,MAAM,oBAAoB,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvE;;;;;GAKG;AACH,8BAAsB,oBAAqB,SAAQ,YAAY;IAC7D,wCAAwC;IACxC,OAAc,OAAO,SAAW;IAEhC,gBAAuB,aAAa,0BAA0B;IAC9D,OAAc,gBAAgB,SAAgC;IAE9D;;;OAGG;WACW,SAAS,IAAI,oBAAoB;IAI/C;;;;;OAKG;IAEU,aAAa,CAAC,WAAW,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIlF;;;;;;OAMG;IAEU,aAAa,CAAC,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;CAI/G"}
|
|
@@ -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;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,
|
|
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,CAAqC,CAAC;IACnF,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 | undefined> {\n return this.forward.apply(this, [arguments]) as Promise<SchemaProps | undefined>;\n }\n\n}\n"]}
|
|
@@ -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,
|
|
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;AACzH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,cAAc;IACvD,gBAAgB;IAChB,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;IAYrI;;;;;;;;MAQE;IACK,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS;CAGtH"}
|
|
@@ -33,15 +33,9 @@ class ECSchemaRpcLocater {
|
|
|
33
33
|
* @param matchType The match type to use when locating the schema
|
|
34
34
|
*/
|
|
35
35
|
async getSchemaInfo(schemaKey, matchType, context) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
if (e.message && e.message === "schema not found")
|
|
42
|
-
return undefined;
|
|
43
|
-
throw (e);
|
|
44
|
-
}
|
|
36
|
+
const schemaJson = await ECSchemaRpcInterface_1.ECSchemaRpcInterface.getClient().getSchemaJSON(this.token, schemaKey.name);
|
|
37
|
+
if (!schemaJson)
|
|
38
|
+
return undefined;
|
|
45
39
|
const schemaInfo = await ecschema_metadata_1.Schema.startLoadingFromJson(schemaJson, context || new ecschema_metadata_1.SchemaContext());
|
|
46
40
|
if (schemaInfo !== undefined && schemaInfo.schemaKey.matches(schemaKey, matchType)) {
|
|
47
41
|
return schemaInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECSchemaRpcLocater.js","sourceRoot":"","sources":["../../src/ECSchemaRpcLocater.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,
|
|
1
|
+
{"version":3,"file":"ECSchemaRpcLocater.js","sourceRoot":"","sources":["../../src/ECSchemaRpcLocater.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAyH;AAEzH,iEAA8D;AAE9D;;;GAGG;AACH,MAAa,kBAAkB;IAC7B,gBAAgB;IACA,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,IAAI,CAAC,UAAU;YACb,OAAO,SAAS,CAAC;QAEnB,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;;;;;;;;MAQE;IACK,aAAa,CAAC,UAAqB,EAAE,UAA2B,EAAE,QAAuB;QAC9F,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;IACpG,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 } 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 * @public @preview\n */\nexport class ECSchemaRpcLocater implements ISchemaLocater {\n /** @internal */\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 if (!schemaJson)\n return undefined;\n\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 * This method is not supported for locating schemas over RPC/HTTP.\n * Use the asynchronous `getSchema` method instead.\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 * @throws Error Always throws an error indicating this method is not supported.\n * @deprecated in 5.0 - will not be removed until after 2026-08-08. Use the asynchronous `getSchema` method for schema retrieval.\n */\n public getSchemaSync(_schemaKey: SchemaKey, _matchType: SchemaMatchType, _context: SchemaContext): Schema | undefined {\n throw new Error(\"getSchemaSync is not supported. Use the asynchronous getSchema method instead.\");\n }\n}\n"]}
|
|
@@ -30,6 +30,6 @@ export declare abstract class ECSchemaRpcInterface extends RpcInterface {
|
|
|
30
30
|
* @param schemaName The name of the schema that shall be returned.
|
|
31
31
|
* @returns The SchemaProps.
|
|
32
32
|
*/
|
|
33
|
-
getSchemaJSON(_tokenProps: IModelRpcProps, _schemaName: string): Promise<SchemaProps>;
|
|
33
|
+
getSchemaJSON(_tokenProps: IModelRpcProps, _schemaName: string): Promise<SchemaProps | undefined>;
|
|
34
34
|
}
|
|
35
35
|
//# sourceMappingURL=ECSchemaRpcInterface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECSchemaRpcInterface.d.ts","sourceRoot":"","sources":["../../src/ECSchemaRpcInterface.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAqD,MAAM,oBAAoB,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvE;;;;;GAKG;AACH,8BAAsB,oBAAqB,SAAQ,YAAY;IAC7D,wCAAwC;IACxC,OAAc,OAAO,SAAW;IAEhC,gBAAuB,aAAa,0BAA0B;IAC9D,OAAc,gBAAgB,SAAgC;IAE9D;;;OAGG;WACW,SAAS,IAAI,oBAAoB;IAI/C;;;;;OAKG;IAEU,aAAa,CAAC,WAAW,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIlF;;;;;;OAMG;IAEU,aAAa,CAAC,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ECSchemaRpcInterface.d.ts","sourceRoot":"","sources":["../../src/ECSchemaRpcInterface.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAqD,MAAM,oBAAoB,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvE;;;;;GAKG;AACH,8BAAsB,oBAAqB,SAAQ,YAAY;IAC7D,wCAAwC;IACxC,OAAc,OAAO,SAAW;IAEhC,gBAAuB,aAAa,0BAA0B;IAC9D,OAAc,gBAAgB,SAAgC;IAE9D;;;OAGG;WACW,SAAS,IAAI,oBAAoB;IAI/C;;;;;OAKG;IAEU,aAAa,CAAC,WAAW,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIlF;;;;;;OAMG;IAEU,aAAa,CAAC,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;CAI/G"}
|
|
@@ -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;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,
|
|
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,CAAqC,CAAC;IACnF,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 | undefined> {\n return this.forward.apply(this, [arguments]) as Promise<SchemaProps | undefined>;\n }\n\n}\n"]}
|
|
@@ -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,
|
|
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;AACzH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,cAAc;IACvD,gBAAgB;IAChB,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;IAYrI;;;;;;;;MAQE;IACK,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS;CAGtH"}
|
|
@@ -30,15 +30,9 @@ export class ECSchemaRpcLocater {
|
|
|
30
30
|
* @param matchType The match type to use when locating the schema
|
|
31
31
|
*/
|
|
32
32
|
async getSchemaInfo(schemaKey, matchType, context) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
if (e.message && e.message === "schema not found")
|
|
39
|
-
return undefined;
|
|
40
|
-
throw (e);
|
|
41
|
-
}
|
|
33
|
+
const schemaJson = await ECSchemaRpcInterface.getClient().getSchemaJSON(this.token, schemaKey.name);
|
|
34
|
+
if (!schemaJson)
|
|
35
|
+
return undefined;
|
|
42
36
|
const schemaInfo = await Schema.startLoadingFromJson(schemaJson, context || new SchemaContext());
|
|
43
37
|
if (schemaInfo !== undefined && schemaInfo.schemaKey.matches(schemaKey, matchType)) {
|
|
44
38
|
return schemaInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECSchemaRpcLocater.js","sourceRoot":"","sources":["../../src/ECSchemaRpcLocater.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAkB,MAAM,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"ECSchemaRpcLocater.js","sourceRoot":"","sources":["../../src/ECSchemaRpcLocater.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAkB,MAAM,EAAE,aAAa,EAA0C,MAAM,0BAA0B,CAAC;AAEzH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAC7B,gBAAgB;IACA,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,oBAAoB,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QACpG,IAAI,CAAC,UAAU;YACb,OAAO,SAAS,CAAC;QAEnB,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,UAAU,EAAE,OAAO,IAAI,IAAI,aAAa,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;;;;;;;;MAQE;IACK,aAAa,CAAC,UAAqB,EAAE,UAA2B,EAAE,QAAuB;QAC9F,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;IACpG,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 } 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 * @public @preview\n */\nexport class ECSchemaRpcLocater implements ISchemaLocater {\n /** @internal */\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 if (!schemaJson)\n return undefined;\n\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 * This method is not supported for locating schemas over RPC/HTTP.\n * Use the asynchronous `getSchema` method instead.\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 * @throws Error Always throws an error indicating this method is not supported.\n * @deprecated in 5.0 - will not be removed until after 2026-08-08. Use the asynchronous `getSchema` method for schema retrieval.\n */\n public getSchemaSync(_schemaKey: SchemaKey, _matchType: SchemaMatchType, _context: SchemaContext): Schema | undefined {\n throw new Error(\"getSchemaSync is not supported. Use the asynchronous getSchema method instead.\");\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/ecschema-rpcinterface-common",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0-dev.2",
|
|
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,10 +22,10 @@
|
|
|
22
22
|
"url": "http://www.bentley.com"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@itwin/core-bentley": "5.
|
|
26
|
-
"@itwin/core-common": "5.
|
|
27
|
-
"@itwin/
|
|
28
|
-
"@itwin/
|
|
25
|
+
"@itwin/core-bentley": "5.3.0-dev.2",
|
|
26
|
+
"@itwin/core-common": "5.3.0-dev.2",
|
|
27
|
+
"@itwin/ecschema-metadata": "5.3.0-dev.2",
|
|
28
|
+
"@itwin/core-geometry": "5.3.0-dev.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@itwin/eslint-plugin": "5.2.2-dev.2",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"sinon": "^17.0.2",
|
|
39
39
|
"rimraf": "^6.0.1",
|
|
40
40
|
"typescript": "~5.6.2",
|
|
41
|
-
"@itwin/build-tools": "5.
|
|
42
|
-
"@itwin/core-
|
|
43
|
-
"@itwin/core-common": "5.
|
|
44
|
-
"@itwin/core-
|
|
45
|
-
"@itwin/ecschema-metadata": "5.
|
|
41
|
+
"@itwin/build-tools": "5.3.0-dev.2",
|
|
42
|
+
"@itwin/core-bentley": "5.3.0-dev.2",
|
|
43
|
+
"@itwin/core-common": "5.3.0-dev.2",
|
|
44
|
+
"@itwin/core-geometry": "5.3.0-dev.2",
|
|
45
|
+
"@itwin/ecschema-metadata": "5.3.0-dev.2"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "npm run -s build:cjs && npm run -s build:esm",
|