@fluidframework/odsp-driver-definitions 2.1.0-274160 → 2.1.0-276326
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.alpha.api.md → odsp-driver-definitions.legacy.alpha.api.md} +6 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -0
- package/dist/errors.js.map +1 -1
- package/dist/factory.d.ts +5 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -1
- package/dist/odspCache.d.ts +5 -0
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/odspCache.js.map +1 -1
- package/dist/resolvedUrl.d.ts +7 -0
- package/dist/resolvedUrl.d.ts.map +1 -1
- package/dist/resolvedUrl.js +2 -0
- package/dist/resolvedUrl.js.map +1 -1
- package/dist/sessionProvider.d.ts +3 -0
- package/dist/sessionProvider.d.ts.map +1 -1
- package/dist/sessionProvider.js.map +1 -1
- package/dist/tokenFetch.d.ts +29 -0
- package/dist/tokenFetch.d.ts.map +1 -1
- package/dist/tokenFetch.js +18 -1
- package/dist/tokenFetch.js.map +1 -1
- package/lib/errors.d.ts +6 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -0
- package/lib/errors.js.map +1 -1
- package/lib/factory.d.ts +5 -0
- package/lib/factory.d.ts.map +1 -1
- package/lib/factory.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -1
- package/lib/odspCache.d.ts +5 -0
- package/lib/odspCache.d.ts.map +1 -1
- package/lib/odspCache.js.map +1 -1
- package/lib/resolvedUrl.d.ts +7 -0
- package/lib/resolvedUrl.d.ts.map +1 -1
- package/lib/resolvedUrl.js +2 -0
- package/lib/resolvedUrl.js.map +1 -1
- package/lib/sessionProvider.d.ts +3 -0
- package/lib/sessionProvider.d.ts.map +1 -1
- package/lib/sessionProvider.js.map +1 -1
- package/lib/tokenFetch.d.ts +29 -0
- package/lib/tokenFetch.d.ts.map +1 -1
- package/lib/tokenFetch.js +16 -0
- package/lib/tokenFetch.js.map +1 -1
- package/package.json +4 -4
- package/src/errors.ts +5 -0
- package/src/factory.ts +5 -0
- package/src/index.ts +1 -0
- package/src/odspCache.ts +5 -0
- package/src/resolvedUrl.ts +7 -0
- package/src/sessionProvider.ts +3 -0
- package/src/tokenFetch.ts +40 -0
package/src/errors.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
/**
|
|
13
13
|
* ODSP Error types.
|
|
14
14
|
* Different error types that may be thrown by the ODSP driver.
|
|
15
|
+
* @legacy
|
|
15
16
|
* @alpha
|
|
16
17
|
*/
|
|
17
18
|
export const OdspErrorTypes = {
|
|
@@ -63,11 +64,13 @@ export const OdspErrorTypes = {
|
|
|
63
64
|
blockedIPAddress: "blockedIPAddress",
|
|
64
65
|
} as const;
|
|
65
66
|
/**
|
|
67
|
+
* @legacy
|
|
66
68
|
* @alpha
|
|
67
69
|
*/
|
|
68
70
|
export type OdspErrorTypes = (typeof OdspErrorTypes)[keyof typeof OdspErrorTypes];
|
|
69
71
|
|
|
70
72
|
/**
|
|
73
|
+
* @legacy
|
|
71
74
|
* @alpha
|
|
72
75
|
*/
|
|
73
76
|
export interface IOdspErrorAugmentations {
|
|
@@ -92,6 +95,7 @@ export interface IOdspErrorAugmentations {
|
|
|
92
95
|
/**
|
|
93
96
|
* Base interface for all errors and warnings
|
|
94
97
|
* Superset of IDriverErrorBase, but with Odsp-specific errorType and properties
|
|
98
|
+
* @legacy
|
|
95
99
|
* @alpha
|
|
96
100
|
*/
|
|
97
101
|
export interface IOdspError
|
|
@@ -101,6 +105,7 @@ export interface IOdspError
|
|
|
101
105
|
}
|
|
102
106
|
|
|
103
107
|
/**
|
|
108
|
+
* @legacy
|
|
104
109
|
* @alpha
|
|
105
110
|
*/
|
|
106
111
|
export type OdspError = IOdspError | (DriverError & IOdspErrorAugmentations);
|
package/src/factory.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
+
* @legacy
|
|
7
8
|
* @alpha
|
|
8
9
|
*/
|
|
9
10
|
export interface ISnapshotOptions {
|
|
@@ -29,6 +30,7 @@ export interface ISnapshotOptions {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/**
|
|
33
|
+
* @legacy
|
|
32
34
|
* @alpha
|
|
33
35
|
*/
|
|
34
36
|
export interface IOpsCachingPolicy {
|
|
@@ -60,10 +62,12 @@ export interface IOpsCachingPolicy {
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
/**
|
|
65
|
+
* @legacy
|
|
63
66
|
* @alpha
|
|
64
67
|
*/
|
|
65
68
|
export interface ICollabSessionOptions {
|
|
66
69
|
/**
|
|
70
|
+
* @deprecated starting in 2.0-RC3. No longer needed.
|
|
67
71
|
* Value indicating the display name for session that admits unauthenticated user.
|
|
68
72
|
* This name will be used in attribution associated with edits made by such user.
|
|
69
73
|
*/
|
|
@@ -82,6 +86,7 @@ export interface ICollabSessionOptions {
|
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
/**
|
|
89
|
+
* @legacy
|
|
85
90
|
* @alpha
|
|
86
91
|
*/
|
|
87
92
|
export interface HostStoragePolicy {
|
package/src/index.ts
CHANGED
package/src/odspCache.ts
CHANGED
|
@@ -21,6 +21,7 @@ export const maximumCacheDurationMs: FiveDaysMs = 432_000_000; // 5 days in ms
|
|
|
21
21
|
*/
|
|
22
22
|
export const snapshotKey = "snapshot";
|
|
23
23
|
/**
|
|
24
|
+
* @legacy
|
|
24
25
|
* @alpha
|
|
25
26
|
*/
|
|
26
27
|
export type CacheContentType = "snapshot" | "ops";
|
|
@@ -31,6 +32,7 @@ export type CacheContentType = "snapshot" | "ops";
|
|
|
31
32
|
* to implement storage / identify files.
|
|
32
33
|
*/
|
|
33
34
|
/**
|
|
35
|
+
* @legacy
|
|
34
36
|
* @alpha
|
|
35
37
|
*/
|
|
36
38
|
export interface IFileEntry {
|
|
@@ -50,6 +52,7 @@ export interface IFileEntry {
|
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* Cache entry. Identifies file that this entry belongs to, and type of content stored in it.
|
|
55
|
+
* @legacy
|
|
53
56
|
* @alpha
|
|
54
57
|
*/
|
|
55
58
|
export interface IEntry {
|
|
@@ -73,6 +76,7 @@ export interface IEntry {
|
|
|
73
76
|
|
|
74
77
|
/**
|
|
75
78
|
* Cache entry. Identifies file that this entry belongs to, and type of content stored in it.
|
|
79
|
+
* @legacy
|
|
76
80
|
* @alpha
|
|
77
81
|
*/
|
|
78
82
|
export interface ICacheEntry extends IEntry {
|
|
@@ -88,6 +92,7 @@ export interface ICacheEntry extends IEntry {
|
|
|
88
92
|
* cache implementation that does not survive across sessions. Snapshot entires stored in the
|
|
89
93
|
* IPersistedCache will be considered stale and removed after 2 days. Read the README for more
|
|
90
94
|
* information.
|
|
95
|
+
* @legacy
|
|
91
96
|
* @alpha
|
|
92
97
|
*/
|
|
93
98
|
export interface IPersistedCache {
|
package/src/resolvedUrl.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { IResolvedUrl } from "@fluidframework/driver-definitions/internal";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
+
* @legacy
|
|
9
10
|
* @alpha
|
|
10
11
|
*/
|
|
11
12
|
export interface IOdspUrlParts {
|
|
@@ -16,6 +17,7 @@ export interface IOdspUrlParts {
|
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Sharing scope of the share links created for a file.
|
|
20
|
+
* @legacy
|
|
19
21
|
* @alpha
|
|
20
22
|
*/
|
|
21
23
|
export enum SharingLinkScope {
|
|
@@ -27,6 +29,7 @@ export enum SharingLinkScope {
|
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
31
|
* View/edit permission role for a sharing link.
|
|
32
|
+
* @legacy
|
|
30
33
|
* @alpha
|
|
31
34
|
*/
|
|
32
35
|
export enum SharingLinkRole {
|
|
@@ -37,6 +40,7 @@ export enum SharingLinkRole {
|
|
|
37
40
|
/**
|
|
38
41
|
* Defines the permissions scope for a share link requested to be created during the creation the file in ODSP.
|
|
39
42
|
* Providing these properties to the /snapshot api will also create and return the requested kind of sharing link.
|
|
43
|
+
* @legacy
|
|
40
44
|
* @alpha
|
|
41
45
|
*/
|
|
42
46
|
export interface ISharingLinkKind {
|
|
@@ -50,6 +54,7 @@ export interface ISharingLinkKind {
|
|
|
50
54
|
|
|
51
55
|
/**
|
|
52
56
|
* Sharing link data received from the /snapshot api response.
|
|
57
|
+
* @legacy
|
|
53
58
|
* @alpha
|
|
54
59
|
*/
|
|
55
60
|
export interface ISharingLink extends ISharingLinkKind {
|
|
@@ -60,6 +65,7 @@ export interface ISharingLink extends ISharingLinkKind {
|
|
|
60
65
|
* Sharing link data created for the ODSP item.
|
|
61
66
|
* Contains information about either sharing link created while creating a new file or
|
|
62
67
|
* a redeemable share link created when loading an existing file
|
|
68
|
+
* @legacy
|
|
63
69
|
* @alpha
|
|
64
70
|
*/
|
|
65
71
|
export interface ShareLinkInfoType {
|
|
@@ -91,6 +97,7 @@ export interface ShareLinkInfoType {
|
|
|
91
97
|
sharingLinkToRedeem?: string;
|
|
92
98
|
}
|
|
93
99
|
/**
|
|
100
|
+
* @legacy
|
|
94
101
|
* @alpha
|
|
95
102
|
*/
|
|
96
103
|
export interface IOdspResolvedUrl extends IResolvedUrl, IOdspUrlParts {
|
package/src/sessionProvider.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { IResolvedUrl } from "@fluidframework/driver-definitions/internal";
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Socket storage discovery api response
|
|
10
|
+
* @legacy
|
|
10
11
|
* @alpha
|
|
11
12
|
*/
|
|
12
13
|
export interface ISocketStorageDiscovery {
|
|
@@ -50,6 +51,7 @@ export interface ISocketStorageDiscovery {
|
|
|
50
51
|
/**
|
|
51
52
|
* An interface that allows a concrete instance of a driver factory to interrogate itself
|
|
52
53
|
* to find out if it is session aware.
|
|
54
|
+
* @legacy
|
|
53
55
|
* @alpha
|
|
54
56
|
*/
|
|
55
57
|
export interface IProvideSessionAwareDriverFactory {
|
|
@@ -59,6 +61,7 @@ export interface IProvideSessionAwareDriverFactory {
|
|
|
59
61
|
/**
|
|
60
62
|
* An interface that allows a concrete instance of a driver factory to call the `getRelayServiceSessionInfo`
|
|
61
63
|
* function if it session aware.
|
|
64
|
+
* @legacy
|
|
62
65
|
* @alpha
|
|
63
66
|
*/
|
|
64
67
|
export interface IRelaySessionAwareDriverFactory extends IProvideSessionAwareDriverFactory {
|
package/src/tokenFetch.ts
CHANGED
|
@@ -5,12 +5,20 @@
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Represents token response
|
|
8
|
+
* @legacy
|
|
8
9
|
* @alpha
|
|
9
10
|
*/
|
|
10
11
|
export interface TokenResponse {
|
|
11
12
|
/** Token value */
|
|
12
13
|
token: string;
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Authorization header value will be used verbatim when making network call that requires the token.
|
|
17
|
+
* If not returned the token value will be assumed to be a Bearer token and will be used to generate the
|
|
18
|
+
* Authorization header value in the following format: `Bearer ${token}`.
|
|
19
|
+
*/
|
|
20
|
+
readonly authorizationHeader?: string;
|
|
21
|
+
|
|
14
22
|
/**
|
|
15
23
|
* Whether or not the token was obtained from local cache.
|
|
16
24
|
* @remarks `undefined` indicates that it could not be determined whether or not the token was obtained this way.
|
|
@@ -20,6 +28,7 @@ export interface TokenResponse {
|
|
|
20
28
|
|
|
21
29
|
/**
|
|
22
30
|
* Represents access token fetch options
|
|
31
|
+
* @legacy
|
|
23
32
|
* @alpha
|
|
24
33
|
*/
|
|
25
34
|
export interface TokenFetchOptions {
|
|
@@ -41,10 +50,19 @@ export interface TokenFetchOptions {
|
|
|
41
50
|
* to use to issue access token.
|
|
42
51
|
*/
|
|
43
52
|
tenantId?: string;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Request that will be made using the fetched token.
|
|
56
|
+
* - url: full request url, including query params
|
|
57
|
+
* - method: method type
|
|
58
|
+
* Request info may be encoded into the returned token that the receiver can use to validate that caller is allowed to make specific call.
|
|
59
|
+
*/
|
|
60
|
+
readonly request?: { url: string; method: "GET" | "POST" | "PATCH" | "DELETE" | "PUT" };
|
|
44
61
|
}
|
|
45
62
|
|
|
46
63
|
/**
|
|
47
64
|
* Represents access token fetch options for ODSP resource
|
|
65
|
+
* @legacy
|
|
48
66
|
* @alpha
|
|
49
67
|
*/
|
|
50
68
|
export interface OdspResourceTokenFetchOptions extends TokenFetchOptions {
|
|
@@ -64,6 +82,7 @@ export interface OdspResourceTokenFetchOptions extends TokenFetchOptions {
|
|
|
64
82
|
* @returns If successful, TokenResponse object representing token value along with flag indicating
|
|
65
83
|
* whether token came from cache. Legacy implementation may return a string for token value;
|
|
66
84
|
* in this case it should be assumes that fromCache signal is undefined. Null is returned in case of failure.
|
|
85
|
+
* @legacy
|
|
67
86
|
* @alpha
|
|
68
87
|
*/
|
|
69
88
|
export type TokenFetcher<T> = (options: T) => Promise<string | TokenResponse | null>;
|
|
@@ -83,6 +102,25 @@ export const tokenFromResponse = (
|
|
|
83
102
|
? null
|
|
84
103
|
: tokenResponse.token;
|
|
85
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Helper method which transforms return value for TokenFetcher method to Authorization header value
|
|
107
|
+
* @param tokenResponse - return value for TokenFetcher method
|
|
108
|
+
* @returns Authorization header value
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
export const authHeaderFromTokenResponse = (
|
|
112
|
+
tokenResponse: string | TokenResponse | null | undefined,
|
|
113
|
+
): string | null => {
|
|
114
|
+
if (typeof tokenResponse === "object" && tokenResponse?.authorizationHeader !== undefined) {
|
|
115
|
+
return tokenResponse.authorizationHeader;
|
|
116
|
+
}
|
|
117
|
+
const token = tokenFromResponse(tokenResponse);
|
|
118
|
+
if (token !== null) {
|
|
119
|
+
return `Bearer ${token}`;
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
};
|
|
123
|
+
|
|
86
124
|
/**
|
|
87
125
|
* Helper method which returns flag indicating whether token response comes from local cache
|
|
88
126
|
* @param tokenResponse - return value for TokenFetcher method
|
|
@@ -101,11 +139,13 @@ export const isTokenFromCache = (
|
|
|
101
139
|
* Identity types supported by ODSP driver.
|
|
102
140
|
* `Consumer` represents user authenticated with Microsoft Account (MSA).
|
|
103
141
|
* `Enterprise` represents user authenticated with M365 tenant account.
|
|
142
|
+
* @legacy
|
|
104
143
|
* @alpha
|
|
105
144
|
*/
|
|
106
145
|
export type IdentityType = "Consumer" | "Enterprise";
|
|
107
146
|
|
|
108
147
|
/**
|
|
148
|
+
* @returns Authorization header value
|
|
109
149
|
* @internal
|
|
110
150
|
*/
|
|
111
151
|
export type InstrumentedStorageTokenFetcher = (
|