@fluid-experimental/odsp-end-to-end-tests 2.3.0-288113 → 2.4.0-294316
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
|
@@ -42,6 +42,9 @@ export class OdspTestTokenProvider {
|
|
|
42
42
|
...credentials,
|
|
43
43
|
};
|
|
44
44
|
const response = await unauthPostAsync(getFetchTokenUrl(server), new URLSearchParams(body));
|
|
45
|
+
if (!response.ok) {
|
|
46
|
+
throw new Error(`Failed to obtain tokens: ${await response.text()}`);
|
|
47
|
+
}
|
|
45
48
|
const parsedResponse = await response.json();
|
|
46
49
|
const accessToken = parsedResponse.access_token;
|
|
47
50
|
const refreshToken = parsedResponse.refresh_token;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OdspTokenFactory.js","sourceRoot":"","sources":["../../src/test/OdspTokenFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAGN,gBAAgB,EAChB,eAAe,GACf,MAAM,4CAA4C,CAAC;AAKpD;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAGjC,YAAY,WAA6B;QACxC,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAAC,OAAe,EAAE,OAAgB;QACjE,MAAM,SAAS,GAAG,sEAAsE,CAAC;QACzF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC1D,OAAO;YACN,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,MAAM,CAAC,WAAW;SACzB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,OAAe,EAAE,OAAgB;QAC/D,MAAM,gBAAgB,GAAG,GAAG,OAAO,qBAAqB,CAAC;QACzD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,gBAAgB,CA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E,CAAC;IACtC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n\nimport { IOdspTokenProvider } from \"@fluidframework/odsp-client/internal\";\nimport {\n\tIPublicClientConfig,\n\tTokenRequestCredentials,\n\tgetFetchTokenUrl,\n\tunauthPostAsync,\n} from \"@fluidframework/odsp-doclib-utils/internal\";\nimport { TokenResponse } from \"@fluidframework/odsp-driver-definitions/internal\";\n\nimport { IOdspCredentials } from \"./OdspClientFactory.js\";\n\n/**\n * This class implements the IOdspTokenProvider interface and provides methods for fetching push and storage tokens.\n */\nexport class OdspTestTokenProvider implements IOdspTokenProvider {\n\tprivate readonly creds: IOdspCredentials;\n\n\tconstructor(credentials: IOdspCredentials) {\n\t\tthis.creds = credentials;\n\t}\n\n\tpublic async fetchWebsocketToken(siteUrl: string, refresh: boolean): Promise<TokenResponse> {\n\t\tconst pushScope = \"offline_access https://pushchannel.1drv.ms/PushChannel.ReadWrite.All\";\n\t\tconst tokens = await this.fetchTokens(siteUrl, pushScope);\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\ttoken: tokens.accessToken,\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(siteUrl: string, refresh: boolean): Promise<TokenResponse> {\n\t\tconst sharePointScopes = `${siteUrl}/Container.Selected`;\n\t\tconst tokens = await this.fetchTokens(siteUrl, sharePointScopes);\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\ttoken: tokens.accessToken,\n\t\t};\n\t}\n\n\tprivate async fetchTokens(\n\t\tsiteUrl: string,\n\t\tscope: string,\n\t): Promise<{\n\t\taccessToken: string;\n\t\trefreshToken: string;\n\t}> {\n\t\tconst server = new URL(siteUrl).host;\n\t\tconst clientConfig: IPublicClientConfig = {\n\t\t\tclientId: this.creds.clientId,\n\t\t};\n\t\tconst credentials: TokenRequestCredentials = {\n\t\t\tgrant_type: \"password\",\n\t\t\tusername: this.creds.email,\n\t\t\tpassword: this.creds.password,\n\t\t};\n\t\tconst body = {\n\t\t\tscope,\n\t\t\tclient_id: clientConfig.clientId,\n\t\t\t...credentials,\n\t\t};\n\t\tconst response = await unauthPostAsync(\n\t\t\tgetFetchTokenUrl(server),\n\t\t\tnew URLSearchParams(body),\n\t\t);\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`Failed to obtain tokens: ${await response.text()}`);\n\t\t}\n\n\t\tconst parsedResponse = await response.json();\n\t\tconst accessToken = parsedResponse.access_token;\n\t\tconst refreshToken = parsedResponse.refresh_token;\n\n\t\treturn { accessToken, refreshToken };\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-experimental/odsp-end-to-end-tests",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0-294316",
|
|
4
4
|
"description": "Odsp client end to end tests",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -33,21 +33,21 @@
|
|
|
33
33
|
"temp-directory": "nyc/.nyc_output"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@fluid-internal/mocha-test-setup": "2.
|
|
37
|
-
"@fluidframework/aqueduct": "2.
|
|
38
|
-
"@fluidframework/container-definitions": "2.
|
|
39
|
-
"@fluidframework/container-loader": "2.
|
|
40
|
-
"@fluidframework/core-interfaces": "2.
|
|
41
|
-
"@fluidframework/counter": "2.
|
|
42
|
-
"@fluidframework/fluid-static": "2.
|
|
43
|
-
"@fluidframework/map": "2.
|
|
44
|
-
"@fluidframework/matrix": "2.
|
|
45
|
-
"@fluidframework/odsp-client": "2.
|
|
46
|
-
"@fluidframework/odsp-doclib-utils": "2.
|
|
47
|
-
"@fluidframework/odsp-driver-definitions": "2.
|
|
48
|
-
"@fluidframework/sequence": "2.
|
|
49
|
-
"@fluidframework/telemetry-utils": "2.
|
|
50
|
-
"@fluidframework/test-utils": "2.
|
|
36
|
+
"@fluid-internal/mocha-test-setup": "2.4.0-294316",
|
|
37
|
+
"@fluidframework/aqueduct": "2.4.0-294316",
|
|
38
|
+
"@fluidframework/container-definitions": "2.4.0-294316",
|
|
39
|
+
"@fluidframework/container-loader": "2.4.0-294316",
|
|
40
|
+
"@fluidframework/core-interfaces": "2.4.0-294316",
|
|
41
|
+
"@fluidframework/counter": "2.4.0-294316",
|
|
42
|
+
"@fluidframework/fluid-static": "2.4.0-294316",
|
|
43
|
+
"@fluidframework/map": "2.4.0-294316",
|
|
44
|
+
"@fluidframework/matrix": "2.4.0-294316",
|
|
45
|
+
"@fluidframework/odsp-client": "2.4.0-294316",
|
|
46
|
+
"@fluidframework/odsp-doclib-utils": "2.4.0-294316",
|
|
47
|
+
"@fluidframework/odsp-driver-definitions": "2.4.0-294316",
|
|
48
|
+
"@fluidframework/sequence": "2.4.0-294316",
|
|
49
|
+
"@fluidframework/telemetry-utils": "2.4.0-294316",
|
|
50
|
+
"@fluidframework/test-utils": "2.4.0-294316",
|
|
51
51
|
"@types/sinon": "^17.0.3",
|
|
52
52
|
"mocha": "^10.2.0",
|
|
53
53
|
"mocha-json-output-reporter": "^2.0.1",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@biomejs/biome": "~1.8.3",
|
|
61
61
|
"@fluidframework/build-common": "^2.0.3",
|
|
62
|
-
"@fluidframework/build-tools": "^0.
|
|
63
|
-
"@fluidframework/eslint-config-fluid": "^5.
|
|
62
|
+
"@fluidframework/build-tools": "^0.46.0",
|
|
63
|
+
"@fluidframework/eslint-config-fluid": "^5.4.0",
|
|
64
64
|
"@types/mocha": "^9.1.1",
|
|
65
65
|
"@types/nock": "^9.3.0",
|
|
66
66
|
"@types/node": "^18.19.0",
|
|
@@ -84,7 +84,8 @@
|
|
|
84
84
|
},
|
|
85
85
|
"typeValidation": {
|
|
86
86
|
"disabled": true,
|
|
87
|
-
"broken": {}
|
|
87
|
+
"broken": {},
|
|
88
|
+
"entrypoint": "internal"
|
|
88
89
|
},
|
|
89
90
|
"scripts": {
|
|
90
91
|
"build": "fluid-build . --task build",
|
|
@@ -70,6 +70,9 @@ export class OdspTestTokenProvider implements IOdspTokenProvider {
|
|
|
70
70
|
getFetchTokenUrl(server),
|
|
71
71
|
new URLSearchParams(body),
|
|
72
72
|
);
|
|
73
|
+
if (!response.ok) {
|
|
74
|
+
throw new Error(`Failed to obtain tokens: ${await response.text()}`);
|
|
75
|
+
}
|
|
73
76
|
|
|
74
77
|
const parsedResponse = await response.json();
|
|
75
78
|
const accessToken = parsedResponse.access_token;
|