@fluidframework/odsp-driver-definitions 2.1.0-274160 → 2.1.0-276985

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.
Files changed (62) hide show
  1. package/README.md +3 -1
  2. package/api-report/{odsp-driver-definitions.alpha.api.md → odsp-driver-definitions.legacy.alpha.api.md} +6 -0
  3. package/dist/errors.d.ts +6 -0
  4. package/dist/errors.d.ts.map +1 -1
  5. package/dist/errors.js +1 -0
  6. package/dist/errors.js.map +1 -1
  7. package/dist/factory.d.ts +5 -0
  8. package/dist/factory.d.ts.map +1 -1
  9. package/dist/factory.js.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +2 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/legacy.d.ts +1 -1
  15. package/dist/odspCache.d.ts +5 -0
  16. package/dist/odspCache.d.ts.map +1 -1
  17. package/dist/odspCache.js.map +1 -1
  18. package/dist/resolvedUrl.d.ts +7 -0
  19. package/dist/resolvedUrl.d.ts.map +1 -1
  20. package/dist/resolvedUrl.js +2 -0
  21. package/dist/resolvedUrl.js.map +1 -1
  22. package/dist/sessionProvider.d.ts +3 -0
  23. package/dist/sessionProvider.d.ts.map +1 -1
  24. package/dist/sessionProvider.js.map +1 -1
  25. package/dist/tokenFetch.d.ts +29 -0
  26. package/dist/tokenFetch.d.ts.map +1 -1
  27. package/dist/tokenFetch.js +18 -1
  28. package/dist/tokenFetch.js.map +1 -1
  29. package/lib/errors.d.ts +6 -0
  30. package/lib/errors.d.ts.map +1 -1
  31. package/lib/errors.js +1 -0
  32. package/lib/errors.js.map +1 -1
  33. package/lib/factory.d.ts +5 -0
  34. package/lib/factory.d.ts.map +1 -1
  35. package/lib/factory.js.map +1 -1
  36. package/lib/index.d.ts +1 -1
  37. package/lib/index.d.ts.map +1 -1
  38. package/lib/index.js +1 -1
  39. package/lib/index.js.map +1 -1
  40. package/lib/legacy.d.ts +1 -1
  41. package/lib/odspCache.d.ts +5 -0
  42. package/lib/odspCache.d.ts.map +1 -1
  43. package/lib/odspCache.js.map +1 -1
  44. package/lib/resolvedUrl.d.ts +7 -0
  45. package/lib/resolvedUrl.d.ts.map +1 -1
  46. package/lib/resolvedUrl.js +2 -0
  47. package/lib/resolvedUrl.js.map +1 -1
  48. package/lib/sessionProvider.d.ts +3 -0
  49. package/lib/sessionProvider.d.ts.map +1 -1
  50. package/lib/sessionProvider.js.map +1 -1
  51. package/lib/tokenFetch.d.ts +29 -0
  52. package/lib/tokenFetch.d.ts.map +1 -1
  53. package/lib/tokenFetch.js +16 -0
  54. package/lib/tokenFetch.js.map +1 -1
  55. package/package.json +4 -4
  56. package/src/errors.ts +5 -0
  57. package/src/factory.ts +5 -0
  58. package/src/index.ts +1 -0
  59. package/src/odspCache.ts +5 -0
  60. package/src/resolvedUrl.ts +7 -0
  61. package/src/sessionProvider.ts +3 -0
  62. package/src/tokenFetch.ts +40 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/odsp-driver-definitions",
3
- "version": "2.1.0-274160",
3
+ "version": "2.1.0-276985",
4
4
  "description": "Socket storage implementation for SPO and ODC",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -57,7 +57,7 @@
57
57
  "main": "lib/index.js",
58
58
  "types": "lib/public.d.ts",
59
59
  "dependencies": {
60
- "@fluidframework/driver-definitions": "2.1.0-274160"
60
+ "@fluidframework/driver-definitions": "2.1.0-276985"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@arethetypeswrong/cli": "^0.15.2",
@@ -81,8 +81,8 @@
81
81
  },
82
82
  "scripts": {
83
83
  "api": "fluid-build . --task api",
84
- "api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
85
- "api-extractor:esnext": "flub generate entrypoints --outFileAlpha legacy --outDir ./lib --node10TypeCompat",
84
+ "api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
85
+ "api-extractor:esnext": "flub generate entrypoints --outDir ./lib --node10TypeCompat",
86
86
  "build": "fluid-build . --task build",
87
87
  "build:commonjs": "fluid-build . --task commonjs",
88
88
  "build:compile": "fluid-build . --task compile",
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
@@ -37,6 +37,7 @@ export {
37
37
  OdspResourceTokenFetchOptions,
38
38
  TokenFetcher,
39
39
  TokenFetchOptions,
40
+ authHeaderFromTokenResponse,
40
41
  tokenFromResponse,
41
42
  TokenResponse,
42
43
  } from "./tokenFetch.js";
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 {
@@ -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 {
@@ -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 = (