@itwin/rpcinterface-full-stack-tests 5.3.0-dev.8 → 5.4.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelSession.d.ts","sourceRoot":"","sources":["../../../src/frontend/setup/IModelSession.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"IModelSession.d.ts","sourceRoot":"","sources":["../../../src/frontend/setup/IModelSession.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAc,MAAM,qBAAqB,CAAC;AAG9D,qBAAa,aAAa;IAEjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,cAAc,CAAgB;IAEtC,OAAO,CAAC,OAAO,CAAC,CAAuB;IAEvC,OAAO;WAQa,MAAM,CAAC,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;IA4D1F,aAAa,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAI9C,IAAI,IAAI,OAAO,CAAC,oBAAoB,CAAC;CAYnD"}
|
|
@@ -9,8 +9,8 @@ const chai_1 = require("chai");
|
|
|
9
9
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
10
10
|
const itwins_client_1 = require("@itwin/itwins-client");
|
|
11
11
|
const core_common_1 = require("@itwin/core-common");
|
|
12
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
13
|
const imodels_client_management_1 = require("@itwin/imodels-client-management");
|
|
13
|
-
const imodels_access_frontend_1 = require("@itwin/imodels-access-frontend");
|
|
14
14
|
class IModelSession {
|
|
15
15
|
iTwinId;
|
|
16
16
|
iModelId;
|
|
@@ -49,7 +49,18 @@ class IModelSession {
|
|
|
49
49
|
if (iModelData.useName) {
|
|
50
50
|
const imodelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${process.env.IMJS_URL_PREFIX ?? ""}api.bentley.com/imodels` } });
|
|
51
51
|
const imodels = imodelClient.iModels.getRepresentationList({
|
|
52
|
-
authorization:
|
|
52
|
+
authorization: async () => {
|
|
53
|
+
const [scheme, token] = requestContext.split(" ");
|
|
54
|
+
if (!scheme || !token)
|
|
55
|
+
core_bentley_1.ITwinError.throwError({
|
|
56
|
+
iTwinErrorId: {
|
|
57
|
+
key: imodels_client_management_1.IModelsErrorCode.InvalidIModelsRequest,
|
|
58
|
+
scope: imodels_client_management_1.IModelsErrorScope,
|
|
59
|
+
},
|
|
60
|
+
message: "Unsupported access token format",
|
|
61
|
+
});
|
|
62
|
+
return Promise.resolve({ scheme, token });
|
|
63
|
+
},
|
|
53
64
|
urlParams: {
|
|
54
65
|
iTwinId,
|
|
55
66
|
name: iModelData.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelSession.js","sourceRoot":"","sources":["../../../src/frontend/setup/IModelSession.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,+BAA8B;AAC9B,
|
|
1
|
+
{"version":3,"file":"IModelSession.js","sourceRoot":"","sources":["../../../src/frontend/setup/IModelSession.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,+BAA8B;AAC9B,wDAA4D;AAC5D,wDAAmG;AAEnG,oDAAmD;AACnD,sDAA8D;AAC9D,gFAAsG;AAEtG,MAAa,aAAa;IAEjB,OAAO,CAAS;IAChB,QAAQ,CAAS;IACjB,WAAW,CAAU;IACpB,cAAc,CAAgB;IAE9B,OAAO,CAAwB;IAEvC,YAAoB,OAAe,EAAE,QAAgB,EAAE,WAAoB;QACzE,IAAI,CAAC,OAAO,GAAG,OAA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BAAiB,UAAU,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC,iCAAiC;QAErL,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACtE,CAAC;IAEM,KAAK,CAAC,aAAa;QACxB,OAAO,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;IACjE,CAAC;IAEM,KAAK,CAAC,IAAI;QACf,IAAI,CAAC;YACH,sCAAsC;YACtC,OAAO,CAAC,GAAG,CAAC,gBAAgB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC;YAC3D,IAAI,CAAC,OAAO,GAAG,MAAM,oCAAoB,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;YACvG,IAAA,aAAM,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QAChC,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AA7FD,sCA6FC","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 { expect } from \"chai\";\nimport { CheckpointConnection } from \"@itwin/core-frontend\";\nimport { ITwin, ITwinsAccessClient, ITwinsAPIResponse, ITwinSubClass } from \"@itwin/itwins-client\";\nimport { IModelData } from \"../../common/Settings\";\nimport { IModelVersion } from \"@itwin/core-common\";\nimport { AccessToken, ITwinError } from \"@itwin/core-bentley\";\nimport { IModelsClient, IModelsErrorCode, IModelsErrorScope } from \"@itwin/imodels-client-management\";\n\nexport class IModelSession {\n\n public iTwinId: string;\n public iModelId: string;\n public changesetId?: string;\n private _imodelVersion: IModelVersion;\n\n private _iModel?: CheckpointConnection;\n\n private constructor(iTwinId: string, imodelId: string, changesetId?: string) {\n this.iTwinId = iTwinId;\n this.iModelId = imodelId;\n this.changesetId = changesetId;\n\n this._imodelVersion = changesetId ? IModelVersion.asOfChangeSet(changesetId) : IModelVersion.latest();\n }\n\n public static async create(requestContext: AccessToken, iModelData: IModelData): Promise<IModelSession> {\n let iTwinId;\n let imodelId;\n\n // Turn the iTwin name into an id\n if (iModelData.useITwinName) {\n if (!iModelData.iTwinName)\n throw new Error(`The iModel has no iTwin name, so it cannot get the iTwin.`);\n\n const client = new ITwinsAccessClient();\n const iTwinListResponse: ITwinsAPIResponse<ITwin[]> = await client.queryAsync(requestContext, ITwinSubClass.Project , {\n displayName: iModelData.iTwinName,\n });\n const iTwinList = iTwinListResponse.data;\n if (!iTwinList) {\n throw new Error(`ITwin ${iModelData.iTwinName} returned with no data when queried.`);\n }\n if (iTwinList.length === 0)\n throw new Error(`ITwin ${iModelData.iTwinName} was not found for the user.`);\n else if (iTwinList.length > 1)\n throw new Error(`Multiple iTwins named ${iModelData.iTwinName} were found for the user.`);\n\n iTwinId = iTwinList[0].id ?? iModelData.iTwinId!;\n } else\n iTwinId = iModelData.iTwinId!;\n\n if (iModelData.useName) {\n const imodelClient = new IModelsClient({ api: { baseUrl: `https://${process.env.IMJS_URL_PREFIX ?? \"\"}api.bentley.com/imodels`}});\n const imodels = imodelClient.iModels.getRepresentationList({\n authorization: async () => {\n const [scheme, token] = requestContext.split(\" \");\n if (!scheme || !token)\n ITwinError.throwError({\n iTwinErrorId: {\n key: IModelsErrorCode.InvalidIModelsRequest,\n scope: IModelsErrorScope,\n },\n message: \"Unsupported access token format\",\n });\n return Promise.resolve({ scheme, token });\n },\n urlParams: {\n iTwinId,\n name: iModelData.name,\n },\n });\n for await (const iModel of imodels) {\n imodelId = iModel.id;\n break;\n }\n if (!imodelId)\n throw new Error(`The iModel ${iModelData.name} does not exist in iTwin ${iTwinId}.`);\n } else\n imodelId = iModelData.id!;\n\n console.log(`Using iModel { name:${iModelData.name}, id:${iModelData.id}, iTwinId:${iModelData.iTwinId}, changesetId:${iModelData.changeSetId} }`); // eslint-disable-line no-console\n\n return new IModelSession(iTwinId, imodelId, iModelData.changeSetId);\n }\n\n public async getConnection(): Promise<CheckpointConnection> {\n return undefined === this._iModel ? this.open() : this._iModel;\n }\n\n public async open(): Promise<CheckpointConnection> {\n try {\n // eslint-disable-next-line no-console\n console.log(`Environment: ${process.env.IMJS_URL_PREFIX}`);\n this._iModel = await CheckpointConnection.openRemote(this.iTwinId, this.iModelId, this._imodelVersion);\n expect(this._iModel).to.exist;\n } catch (e: any) {\n throw new Error(`Failed to open test iModel. Error: ${e.message}`);\n }\n\n return this._iModel;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/rpcinterface-full-stack-tests",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0-dev.2",
|
|
4
4
|
"description": "Test the full iTwin.js Core stack (frontend and backend) using standard RPC interfaces",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -19,12 +19,13 @@
|
|
|
19
19
|
"url": "http://www.bentley.com"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@itwin/imodels-access-backend": "^
|
|
23
|
-
"@itwin/imodels-access-frontend": "^
|
|
24
|
-
"@itwin/imodels-client-
|
|
25
|
-
"@itwin/imodels-client-
|
|
22
|
+
"@itwin/imodels-access-backend": "^6.0.2",
|
|
23
|
+
"@itwin/imodels-access-frontend": "^6.0.2",
|
|
24
|
+
"@itwin/imodels-client-management": "^6.0.2",
|
|
25
|
+
"@itwin/imodels-client-authoring": "^6.0.2",
|
|
26
|
+
"@itwin/object-storage-azure": "^3.0.4",
|
|
26
27
|
"@itwin/eslint-plugin": "5.2.2-dev.2",
|
|
27
|
-
"@itwin/oidc-signin-tool": "^
|
|
28
|
+
"@itwin/oidc-signin-tool": "^5.0.2",
|
|
28
29
|
"@itwin/service-authorization": "^1.0.0",
|
|
29
30
|
"chai": "^4.3.10",
|
|
30
31
|
"chai-as-promised": "^7.1.1",
|
|
@@ -32,15 +33,15 @@
|
|
|
32
33
|
"dotenv-expand": "^5.1.0",
|
|
33
34
|
"mocha": "^11.1.0",
|
|
34
35
|
"openid-client": "^4.7.4",
|
|
35
|
-
"@itwin/
|
|
36
|
-
"@itwin/
|
|
37
|
-
"@itwin/core-bentley": "5.
|
|
38
|
-
"@itwin/core-frontend": "5.
|
|
39
|
-
"@itwin/core-
|
|
40
|
-
"@itwin/core-quantity": "5.
|
|
41
|
-
"@itwin/certa": "5.
|
|
42
|
-
"@itwin/presentation-
|
|
43
|
-
"@itwin/presentation-
|
|
36
|
+
"@itwin/core-geometry": "5.4.0-dev.2",
|
|
37
|
+
"@itwin/build-tools": "5.4.0-dev.2",
|
|
38
|
+
"@itwin/core-bentley": "5.4.0-dev.2",
|
|
39
|
+
"@itwin/core-frontend": "5.4.0-dev.2",
|
|
40
|
+
"@itwin/core-common": "5.4.0-dev.2",
|
|
41
|
+
"@itwin/core-quantity": "5.4.0-dev.2",
|
|
42
|
+
"@itwin/certa": "5.4.0-dev.2",
|
|
43
|
+
"@itwin/presentation-frontend": "5.4.0-dev.2",
|
|
44
|
+
"@itwin/presentation-common": "5.4.0-dev.2"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@itwin/itwins-client": "^1.6.1",
|
|
@@ -63,10 +64,10 @@
|
|
|
63
64
|
"typescript": "~5.6.2",
|
|
64
65
|
"webpack": "^5.97.1",
|
|
65
66
|
"webpack-cli": "^5.0.1",
|
|
66
|
-
"@itwin/core-backend": "5.
|
|
67
|
-
"@itwin/
|
|
68
|
-
"@itwin/
|
|
69
|
-
"@itwin/presentation-backend": "5.
|
|
67
|
+
"@itwin/core-backend": "5.4.0-dev.2",
|
|
68
|
+
"@itwin/express-server": "5.4.0-dev.2",
|
|
69
|
+
"@itwin/ecschema-metadata": "5.4.0-dev.2",
|
|
70
|
+
"@itwin/presentation-backend": "5.4.0-dev.2",
|
|
70
71
|
"internal-tools": "3.0.0-dev.69"
|
|
71
72
|
},
|
|
72
73
|
"scripts": {
|