@fluidframework/odsp-driver-definitions 2.0.0-rc.4.0.8 → 2.0.0-rc.4.0.9
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/api-report/odsp-driver-definitions.api.md +1 -1
- package/dist/tokenFetch.d.ts +0 -1
- package/dist/tokenFetch.d.ts.map +1 -1
- package/dist/tokenFetch.js +0 -1
- package/dist/tokenFetch.js.map +1 -1
- package/lib/tokenFetch.d.ts +0 -1
- package/lib/tokenFetch.d.ts.map +1 -1
- package/lib/tokenFetch.js +0 -1
- package/lib/tokenFetch.js.map +1 -1
- package/package.json +5 -5
- package/src/tokenFetch.ts +0 -1
- package/dist/public.d.ts +0 -12
- package/lib/public.d.ts +0 -12
package/dist/tokenFetch.d.ts
CHANGED
|
@@ -79,7 +79,6 @@ export type TokenFetcher<T> = (options: T) => Promise<string | TokenResponse | n
|
|
|
79
79
|
* @param tokenResponse - return value for TokenFetcher method
|
|
80
80
|
* @returns Token value
|
|
81
81
|
* @internal
|
|
82
|
-
* @deprecated - Use authHeaderFromTokenResponse instead
|
|
83
82
|
*/
|
|
84
83
|
export declare const tokenFromResponse: (tokenResponse: string | TokenResponse | null | undefined) => string | null;
|
|
85
84
|
/**
|
package/dist/tokenFetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenFetch.d.ts","sourceRoot":"","sources":["../src/tokenFetch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAEtC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;OAG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@ exports.isTokenFromCache = exports.authHeaderFromTokenResponse = exports.tokenFr
|
|
|
10
10
|
* @param tokenResponse - return value for TokenFetcher method
|
|
11
11
|
* @returns Token value
|
|
12
12
|
* @internal
|
|
13
|
-
* @deprecated - Use authHeaderFromTokenResponse instead
|
|
14
13
|
*/
|
|
15
14
|
const tokenFromResponse = (tokenResponse) => tokenResponse === null || typeof tokenResponse === "string"
|
|
16
15
|
? tokenResponse
|
package/dist/tokenFetch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenFetch.js","sourceRoot":"","sources":["../src/tokenFetch.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkFH
|
|
1
|
+
{"version":3,"file":"tokenFetch.js","sourceRoot":"","sources":["../src/tokenFetch.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkFH;;;;;GAKG;AACI,MAAM,iBAAiB,GAAG,CAChC,aAAwD,EACxC,EAAE,CAClB,aAAa,KAAK,IAAI,IAAI,OAAO,aAAa,KAAK,QAAQ;IAC1D,CAAC,CAAC,aAAa;IACf,CAAC,CAAC,aAAa,KAAK,SAAS;QAC7B,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;AAPX,QAAA,iBAAiB,qBAON;AAExB;;;;;GAKG;AACI,MAAM,2BAA2B,GAAG,CAC1C,aAAwD,EACxC,EAAE;IAClB,IAAI,OAAO,aAAa,KAAK,QAAQ,IAAI,aAAa,EAAE,mBAAmB,KAAK,SAAS,EAAE;QAC1F,OAAO,aAAa,CAAC,mBAAmB,CAAC;KACzC;IACD,MAAM,KAAK,GAAG,IAAA,yBAAiB,EAAC,aAAa,CAAC,CAAC;IAC/C,IAAI,KAAK,KAAK,IAAI,EAAE;QACnB,OAAO,UAAU,KAAK,EAAE,CAAC;KACzB;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAXW,QAAA,2BAA2B,+BAWtC;AAEF;;;;;;GAMG;AACI,MAAM,gBAAgB,GAAG,CAC/B,aAA4C,EACtB,EAAE,CACxB,aAAa,KAAK,IAAI,IAAI,OAAO,aAAa,KAAK,QAAQ;IAC1D,CAAC,CAAC,SAAS;IACX,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC;AALf,QAAA,gBAAgB,oBAKD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Represents token response\n * @beta\n */\nexport interface TokenResponse {\n\t/** Token value */\n\ttoken: string;\n\n\t/**\n\t * Authorization header value will be used verbatim when making network call that requires the token.\n\t * If not returned the token value will be assumed to be a Bearer token and will be used to generate the\n\t * Authorization header value in the following format: `Bearer ${token}`.\n\t */\n\treadonly authorizationHeader?: string;\n\n\t/**\n\t * Whether or not the token was obtained from local cache.\n\t * @remarks `undefined` indicates that it could not be determined whether or not the token was obtained this way.\n\t */\n\tfromCache?: boolean;\n}\n\n/**\n * Represents access token fetch options\n * @alpha\n */\nexport interface TokenFetchOptions {\n\t/**\n\t * Value indicating whether fresh token has to be returned.\n\t * If false then it is okay to return cached unexpired token if available.\n\t */\n\trefresh: boolean;\n\n\t/**\n\t * Claims that have to be passed with token fetch request.\n\t * These can be used to specify additional information that must be passed to token authority.\n\t */\n\tclaims?: string;\n\n\t/**\n\t * Tenant id of authority that must be handling token fetch.\n\t * If it is not specified then it is up to token fetching logic to determine which tenant authority\n\t * to use to issue access token.\n\t */\n\ttenantId?: string;\n\n\t/**\n\t * Request that will be made using the fetched token.\n\t * - url: full request url, including query params\n\t * - method: method type\n\t * Request info may be encoded into the returned token that the receiver can use to validate that caller is allowed to make specific call.\n\t */\n\treadonly request?: { url: string; method: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" | \"PUT\" };\n}\n\n/**\n * Represents access token fetch options for ODSP resource\n * @alpha\n */\nexport interface OdspResourceTokenFetchOptions extends TokenFetchOptions {\n\t/** Site url representing ODSP resource location */\n\tsiteUrl: string;\n\n\t/** ODSP drive id where resource resides. Optional, used only when fetching token to access ODSP file */\n\tdriveId?: string;\n\n\t/** ODSP item id representing resource. Optional, used only when fetching token to access ODSP file */\n\titemId?: string;\n}\n\n/**\n * Method signature for callback method used to fetch access token\n * @param options - token fetch options\n * @returns If successful, TokenResponse object representing token value along with flag indicating\n * whether token came from cache. Legacy implementation may return a string for token value;\n * in this case it should be assumes that fromCache signal is undefined. Null is returned in case of failure.\n * @alpha\n */\nexport type TokenFetcher<T> = (options: T) => Promise<string | TokenResponse | null>;\n\n/**\n * Helper method which transforms return value for TokenFetcher method to token string\n * @param tokenResponse - return value for TokenFetcher method\n * @returns Token value\n * @internal\n */\nexport const tokenFromResponse = (\n\ttokenResponse: string | TokenResponse | null | undefined,\n): string | null =>\n\ttokenResponse === null || typeof tokenResponse === \"string\"\n\t\t? tokenResponse\n\t\t: tokenResponse === undefined\n\t\t? null\n\t\t: tokenResponse.token;\n\n/**\n * Helper method which transforms return value for TokenFetcher method to Authorization header value\n * @param tokenResponse - return value for TokenFetcher method\n * @returns Authorization header value\n * @internal\n */\nexport const authHeaderFromTokenResponse = (\n\ttokenResponse: string | TokenResponse | null | undefined,\n): string | null => {\n\tif (typeof tokenResponse === \"object\" && tokenResponse?.authorizationHeader !== undefined) {\n\t\treturn tokenResponse.authorizationHeader;\n\t}\n\tconst token = tokenFromResponse(tokenResponse);\n\tif (token !== null) {\n\t\treturn `Bearer ${token}`;\n\t}\n\treturn null;\n};\n\n/**\n * Helper method which returns flag indicating whether token response comes from local cache\n * @param tokenResponse - return value for TokenFetcher method\n * @returns Value indicating whether response came from cache.\n * Undefined is returned when we could not determine the source of token.\n * @internal\n */\nexport const isTokenFromCache = (\n\ttokenResponse: string | TokenResponse | null,\n): boolean | undefined =>\n\ttokenResponse === null || typeof tokenResponse === \"string\"\n\t\t? undefined\n\t\t: tokenResponse.fromCache;\n\n/**\n * Identity types supported by ODSP driver.\n * `Consumer` represents user authenticated with Microsoft Account (MSA).\n * `Enterprise` represents user authenticated with M365 tenant account.\n * @alpha\n */\nexport type IdentityType = \"Consumer\" | \"Enterprise\";\n\n/**\n * @returns Authorization header value\n * @internal\n */\nexport type InstrumentedStorageTokenFetcher = (\n\toptions: TokenFetchOptions,\n\tname: string,\n\talwaysRecordTokenFetchTelemetry?: boolean,\n) => Promise<string>;\n\n/**\n * @internal\n */\nexport type InstrumentedTokenFetcher = (\n\toptions: TokenFetchOptions,\n\tname: string,\n\talwaysRecordTokenFetchTelemetry?: boolean,\n) => Promise<string | null>;\n"]}
|
package/lib/tokenFetch.d.ts
CHANGED
|
@@ -79,7 +79,6 @@ export type TokenFetcher<T> = (options: T) => Promise<string | TokenResponse | n
|
|
|
79
79
|
* @param tokenResponse - return value for TokenFetcher method
|
|
80
80
|
* @returns Token value
|
|
81
81
|
* @internal
|
|
82
|
-
* @deprecated - Use authHeaderFromTokenResponse instead
|
|
83
82
|
*/
|
|
84
83
|
export declare const tokenFromResponse: (tokenResponse: string | TokenResponse | null | undefined) => string | null;
|
|
85
84
|
/**
|
package/lib/tokenFetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenFetch.d.ts","sourceRoot":"","sources":["../src/tokenFetch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAEtC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,GAAG,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AM,CAAC;IAEhB,wGAAwG;IACxG,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,sGAAsG;IACtG,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,MAAM,GAAG,aAAa,GAAG,IAAI,CAAC,CAAC;AAErF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,kBACd,MAAM,GAAG,aAAa,GAAG,IAAI,GAAG,SAAS,KACtD,MAAM,GAAG,IAKW,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,kBACxB,MAAM,GAAG,aAAa,GAAG,IAAI,GAAG,SAAS,KACtD,MAAM,GAAG,IASX,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,kBACb,MAAM,GAAG,aAAa,GAAG,IAAI,KAC1C,OAAO,GAAG,SAGc,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,YAAY,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,+BAA+B,GAAG,CAC7C,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,MAAM,EACZ,+BAA+B,CAAC,EAAE,OAAO,KACrC,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,CACtC,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,MAAM,EACZ,+BAA+B,CAAC,EAAE,OAAO,KACrC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC"}
|
package/lib/tokenFetch.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* @param tokenResponse - return value for TokenFetcher method
|
|
8
8
|
* @returns Token value
|
|
9
9
|
* @internal
|
|
10
|
-
* @deprecated - Use authHeaderFromTokenResponse instead
|
|
11
10
|
*/
|
|
12
11
|
export const tokenFromResponse = (tokenResponse) => tokenResponse === null || typeof tokenResponse === "string"
|
|
13
12
|
? tokenResponse
|
package/lib/tokenFetch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenFetch.js","sourceRoot":"","sources":["../src/tokenFetch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkFH
|
|
1
|
+
{"version":3,"file":"tokenFetch.js","sourceRoot":"","sources":["../src/tokenFetch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkFH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAChC,aAAwD,EACxC,EAAE,CAClB,aAAa,KAAK,IAAI,IAAI,OAAO,aAAa,KAAK,QAAQ;IAC1D,CAAC,CAAC,aAAa;IACf,CAAC,CAAC,aAAa,KAAK,SAAS;QAC7B,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;AAExB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAC1C,aAAwD,EACxC,EAAE;IAClB,IAAI,OAAO,aAAa,KAAK,QAAQ,IAAI,aAAa,EAAE,mBAAmB,KAAK,SAAS,EAAE;QAC1F,OAAO,aAAa,CAAC,mBAAmB,CAAC;KACzC;IACD,MAAM,KAAK,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;IAC/C,IAAI,KAAK,KAAK,IAAI,EAAE;QACnB,OAAO,UAAU,KAAK,EAAE,CAAC;KACzB;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC/B,aAA4C,EACtB,EAAE,CACxB,aAAa,KAAK,IAAI,IAAI,OAAO,aAAa,KAAK,QAAQ;IAC1D,CAAC,CAAC,SAAS;IACX,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Represents token response\n * @beta\n */\nexport interface TokenResponse {\n\t/** Token value */\n\ttoken: string;\n\n\t/**\n\t * Authorization header value will be used verbatim when making network call that requires the token.\n\t * If not returned the token value will be assumed to be a Bearer token and will be used to generate the\n\t * Authorization header value in the following format: `Bearer ${token}`.\n\t */\n\treadonly authorizationHeader?: string;\n\n\t/**\n\t * Whether or not the token was obtained from local cache.\n\t * @remarks `undefined` indicates that it could not be determined whether or not the token was obtained this way.\n\t */\n\tfromCache?: boolean;\n}\n\n/**\n * Represents access token fetch options\n * @alpha\n */\nexport interface TokenFetchOptions {\n\t/**\n\t * Value indicating whether fresh token has to be returned.\n\t * If false then it is okay to return cached unexpired token if available.\n\t */\n\trefresh: boolean;\n\n\t/**\n\t * Claims that have to be passed with token fetch request.\n\t * These can be used to specify additional information that must be passed to token authority.\n\t */\n\tclaims?: string;\n\n\t/**\n\t * Tenant id of authority that must be handling token fetch.\n\t * If it is not specified then it is up to token fetching logic to determine which tenant authority\n\t * to use to issue access token.\n\t */\n\ttenantId?: string;\n\n\t/**\n\t * Request that will be made using the fetched token.\n\t * - url: full request url, including query params\n\t * - method: method type\n\t * Request info may be encoded into the returned token that the receiver can use to validate that caller is allowed to make specific call.\n\t */\n\treadonly request?: { url: string; method: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" | \"PUT\" };\n}\n\n/**\n * Represents access token fetch options for ODSP resource\n * @alpha\n */\nexport interface OdspResourceTokenFetchOptions extends TokenFetchOptions {\n\t/** Site url representing ODSP resource location */\n\tsiteUrl: string;\n\n\t/** ODSP drive id where resource resides. Optional, used only when fetching token to access ODSP file */\n\tdriveId?: string;\n\n\t/** ODSP item id representing resource. Optional, used only when fetching token to access ODSP file */\n\titemId?: string;\n}\n\n/**\n * Method signature for callback method used to fetch access token\n * @param options - token fetch options\n * @returns If successful, TokenResponse object representing token value along with flag indicating\n * whether token came from cache. Legacy implementation may return a string for token value;\n * in this case it should be assumes that fromCache signal is undefined. Null is returned in case of failure.\n * @alpha\n */\nexport type TokenFetcher<T> = (options: T) => Promise<string | TokenResponse | null>;\n\n/**\n * Helper method which transforms return value for TokenFetcher method to token string\n * @param tokenResponse - return value for TokenFetcher method\n * @returns Token value\n * @internal\n */\nexport const tokenFromResponse = (\n\ttokenResponse: string | TokenResponse | null | undefined,\n): string | null =>\n\ttokenResponse === null || typeof tokenResponse === \"string\"\n\t\t? tokenResponse\n\t\t: tokenResponse === undefined\n\t\t? null\n\t\t: tokenResponse.token;\n\n/**\n * Helper method which transforms return value for TokenFetcher method to Authorization header value\n * @param tokenResponse - return value for TokenFetcher method\n * @returns Authorization header value\n * @internal\n */\nexport const authHeaderFromTokenResponse = (\n\ttokenResponse: string | TokenResponse | null | undefined,\n): string | null => {\n\tif (typeof tokenResponse === \"object\" && tokenResponse?.authorizationHeader !== undefined) {\n\t\treturn tokenResponse.authorizationHeader;\n\t}\n\tconst token = tokenFromResponse(tokenResponse);\n\tif (token !== null) {\n\t\treturn `Bearer ${token}`;\n\t}\n\treturn null;\n};\n\n/**\n * Helper method which returns flag indicating whether token response comes from local cache\n * @param tokenResponse - return value for TokenFetcher method\n * @returns Value indicating whether response came from cache.\n * Undefined is returned when we could not determine the source of token.\n * @internal\n */\nexport const isTokenFromCache = (\n\ttokenResponse: string | TokenResponse | null,\n): boolean | undefined =>\n\ttokenResponse === null || typeof tokenResponse === \"string\"\n\t\t? undefined\n\t\t: tokenResponse.fromCache;\n\n/**\n * Identity types supported by ODSP driver.\n * `Consumer` represents user authenticated with Microsoft Account (MSA).\n * `Enterprise` represents user authenticated with M365 tenant account.\n * @alpha\n */\nexport type IdentityType = \"Consumer\" | \"Enterprise\";\n\n/**\n * @returns Authorization header value\n * @internal\n */\nexport type InstrumentedStorageTokenFetcher = (\n\toptions: TokenFetchOptions,\n\tname: string,\n\talwaysRecordTokenFetchTelemetry?: boolean,\n) => Promise<string>;\n\n/**\n * @internal\n */\nexport type InstrumentedTokenFetcher = (\n\toptions: TokenFetchOptions,\n\tname: string,\n\talwaysRecordTokenFetchTelemetry?: boolean,\n) => Promise<string | null>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/odsp-driver-definitions",
|
|
3
|
-
"version": "2.0.0-rc.4.0.
|
|
3
|
+
"version": "2.0.0-rc.4.0.9",
|
|
4
4
|
"description": "Socket storage implementation for SPO and ODC",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
17
|
"import": {
|
|
18
|
-
"types": "./lib/
|
|
18
|
+
"types": "./lib/index.d.ts",
|
|
19
19
|
"default": "./lib/index.js"
|
|
20
20
|
},
|
|
21
21
|
"require": {
|
|
22
|
-
"types": "./dist/
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
23
|
"default": "./dist/index.js"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"main": "lib/index.js",
|
|
58
|
-
"types": "lib/
|
|
58
|
+
"types": "lib/index.d.ts",
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@fluidframework/driver-definitions": ">=2.0.0-rc.4.0.
|
|
60
|
+
"@fluidframework/driver-definitions": ">=2.0.0-rc.4.0.9 <2.0.0-rc.4.1.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@arethetypeswrong/cli": "^0.15.2",
|
package/src/tokenFetch.ts
CHANGED
|
@@ -88,7 +88,6 @@ export type TokenFetcher<T> = (options: T) => Promise<string | TokenResponse | n
|
|
|
88
88
|
* @param tokenResponse - return value for TokenFetcher method
|
|
89
89
|
* @returns Token value
|
|
90
90
|
* @internal
|
|
91
|
-
* @deprecated - Use authHeaderFromTokenResponse instead
|
|
92
91
|
*/
|
|
93
92
|
export const tokenFromResponse = (
|
|
94
93
|
tokenResponse: string | TokenResponse | null | undefined,
|
package/dist/public.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export {}
|
|
12
|
-
|
package/lib/public.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export {}
|
|
12
|
-
|