@fluidframework/odsp-driver-definitions 2.0.0-internal.3.0.0 → 2.0.0-internal.3.1.0

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 (59) hide show
  1. package/.eslintrc.js +6 -9
  2. package/api-extractor.json +2 -2
  3. package/dist/errors.d.ts +23 -0
  4. package/dist/errors.d.ts.map +1 -1
  5. package/dist/errors.js +19 -11
  6. package/dist/errors.js.map +1 -1
  7. package/dist/factory.d.ts.map +1 -1
  8. package/dist/factory.js.map +1 -1
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/odspCache.d.ts +1 -1
  13. package/dist/odspCache.d.ts.map +1 -1
  14. package/dist/odspCache.js.map +1 -1
  15. package/dist/packageVersion.d.ts +1 -1
  16. package/dist/packageVersion.js +1 -1
  17. package/dist/packageVersion.js.map +1 -1
  18. package/dist/resolvedUrl.d.ts +4 -4
  19. package/dist/resolvedUrl.d.ts.map +1 -1
  20. package/dist/resolvedUrl.js +2 -2
  21. package/dist/resolvedUrl.js.map +1 -1
  22. package/dist/tokenFetch.d.ts.map +1 -1
  23. package/dist/tokenFetch.js +3 -1
  24. package/dist/tokenFetch.js.map +1 -1
  25. package/lib/errors.d.ts +23 -0
  26. package/lib/errors.d.ts.map +1 -1
  27. package/lib/errors.js +19 -11
  28. package/lib/errors.js.map +1 -1
  29. package/lib/factory.d.ts.map +1 -1
  30. package/lib/factory.js.map +1 -1
  31. package/lib/index.d.ts +2 -2
  32. package/lib/index.d.ts.map +1 -1
  33. package/lib/index.js +1 -1
  34. package/lib/index.js.map +1 -1
  35. package/lib/odspCache.d.ts +1 -1
  36. package/lib/odspCache.d.ts.map +1 -1
  37. package/lib/odspCache.js.map +1 -1
  38. package/lib/packageVersion.d.ts +1 -1
  39. package/lib/packageVersion.js +1 -1
  40. package/lib/packageVersion.js.map +1 -1
  41. package/lib/resolvedUrl.d.ts +4 -4
  42. package/lib/resolvedUrl.d.ts.map +1 -1
  43. package/lib/resolvedUrl.js +2 -2
  44. package/lib/resolvedUrl.js.map +1 -1
  45. package/lib/tokenFetch.d.ts.map +1 -1
  46. package/lib/tokenFetch.js +3 -1
  47. package/lib/tokenFetch.js.map +1 -1
  48. package/package.json +69 -64
  49. package/prettier.config.cjs +1 -1
  50. package/src/errors.ts +57 -49
  51. package/src/factory.ts +128 -128
  52. package/src/index.ts +14 -2
  53. package/src/odspCache.ts +50 -50
  54. package/src/packageVersion.ts +1 -1
  55. package/src/resolvedUrl.ts +85 -87
  56. package/src/tokenFetch.ts +44 -37
  57. package/tsconfig.esnext.json +6 -6
  58. package/tsconfig.json +9 -13
  59. package/.editorconfig +0 -7
package/src/tokenFetch.ts CHANGED
@@ -7,49 +7,49 @@
7
7
  * Represents token response
8
8
  */
9
9
  export interface TokenResponse {
10
- /** Token value */
11
- token: string;
10
+ /** Token value */
11
+ token: string;
12
12
 
13
- /** Flag indicating whether token was obtained from local cache */
14
- fromCache?: boolean;
13
+ /** Flag indicating whether token was obtained from local cache */
14
+ fromCache?: boolean;
15
15
  }
16
16
 
17
17
  /**
18
18
  * Represents access token fetch options
19
19
  */
20
20
  export interface TokenFetchOptions {
21
- /**
22
- * Value indicating whether fresh token has to be returned.
23
- * If false then it is okay to return cached unexpired token if available.
24
- */
25
- refresh: boolean;
21
+ /**
22
+ * Value indicating whether fresh token has to be returned.
23
+ * If false then it is okay to return cached unexpired token if available.
24
+ */
25
+ refresh: boolean;
26
26
 
27
- /**
28
- * Claims that have to be passed with token fetch request.
29
- * These can be used to specify additional information that must be passed to token authority.
30
- */
31
- claims?: string;
27
+ /**
28
+ * Claims that have to be passed with token fetch request.
29
+ * These can be used to specify additional information that must be passed to token authority.
30
+ */
31
+ claims?: string;
32
32
 
33
- /**
34
- * Tenant id of authority that must be handling token fetch.
35
- * If it is not specified then it is up to token fetching logic to determine which tenant authority
36
- * to use to issue access token.
37
- */
38
- tenantId?: string;
33
+ /**
34
+ * Tenant id of authority that must be handling token fetch.
35
+ * If it is not specified then it is up to token fetching logic to determine which tenant authority
36
+ * to use to issue access token.
37
+ */
38
+ tenantId?: string;
39
39
  }
40
40
 
41
41
  /**
42
42
  * Represents access token fetch options for ODSP resource
43
43
  */
44
44
  export interface OdspResourceTokenFetchOptions extends TokenFetchOptions {
45
- /** Site url representing ODSP resource location */
46
- siteUrl: string;
45
+ /** Site url representing ODSP resource location */
46
+ siteUrl: string;
47
47
 
48
- /** ODSP drive id where resource resides. Optional, used only when fetching token to access ODSP file */
49
- driveId?: string;
48
+ /** ODSP drive id where resource resides. Optional, used only when fetching token to access ODSP file */
49
+ driveId?: string;
50
50
 
51
- /** ODSP item id representing resource. Optional, used only when fetching token to access ODSP file */
52
- itemId?: string;
51
+ /** ODSP item id representing resource. Optional, used only when fetching token to access ODSP file */
52
+ itemId?: string;
53
53
  }
54
54
 
55
55
  /**
@@ -66,10 +66,14 @@ export type TokenFetcher<T> = (options: T) => Promise<string | TokenResponse | n
66
66
  * @param tokenResponse - return value for TokenFetcher method
67
67
  * @returns Token value
68
68
  */
69
- export const tokenFromResponse = (tokenResponse: string | TokenResponse | null | undefined): string | null =>
70
- tokenResponse === null || typeof tokenResponse === "string"
71
- ? tokenResponse
72
- : tokenResponse === undefined ? null : tokenResponse.token;
69
+ export const tokenFromResponse = (
70
+ tokenResponse: string | TokenResponse | null | undefined,
71
+ ): string | null =>
72
+ tokenResponse === null || typeof tokenResponse === "string"
73
+ ? tokenResponse
74
+ : tokenResponse === undefined
75
+ ? null
76
+ : tokenResponse.token;
73
77
 
74
78
  /**
75
79
  * Helper method which returns flag indicating whether token response comes from local cache
@@ -77,10 +81,12 @@ export const tokenFromResponse = (tokenResponse: string | TokenResponse | null |
77
81
  * @returns Value indicating whether response came from cache.
78
82
  * Undefined is returned when we could not determine the source of token.
79
83
  */
80
- export const isTokenFromCache = (tokenResponse: string | TokenResponse | null): boolean | undefined =>
81
- tokenResponse === null || typeof tokenResponse === "string"
82
- ? undefined
83
- : tokenResponse.fromCache;
84
+ export const isTokenFromCache = (
85
+ tokenResponse: string | TokenResponse | null,
86
+ ): boolean | undefined =>
87
+ tokenResponse === null || typeof tokenResponse === "string"
88
+ ? undefined
89
+ : tokenResponse.fromCache;
84
90
 
85
91
  /**
86
92
  * Identity types supported by ODSP driver.
@@ -90,6 +96,7 @@ export const isTokenFromCache = (tokenResponse: string | TokenResponse | null):
90
96
  export type IdentityType = "Consumer" | "Enterprise";
91
97
 
92
98
  export type InstrumentedStorageTokenFetcher = (
93
- options: TokenFetchOptions,
94
- name: string,
95
- alwaysRecordTokenFetchTelemetry?: boolean) => Promise<string | null>;
99
+ options: TokenFetchOptions,
100
+ name: string,
101
+ alwaysRecordTokenFetchTelemetry?: boolean,
102
+ ) => Promise<string | null>;
@@ -1,7 +1,7 @@
1
1
  {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./lib",
5
- "module": "esnext"
6
- },
7
- }
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./lib",
5
+ "module": "esnext",
6
+ },
7
+ }
package/tsconfig.json CHANGED
@@ -1,14 +1,10 @@
1
1
  {
2
- "extends": "@fluidframework/build-common/ts-common-config.json",
3
- "exclude": [
4
- "src/test/**/*"
5
- ],
6
- "compilerOptions": {
7
- "rootDir": "./src",
8
- "outDir": "./dist",
9
- "composite": true
10
- },
11
- "include": [
12
- "src/**/*"
13
- ]
14
- }
2
+ "extends": "@fluidframework/build-common/ts-common-config.json",
3
+ "exclude": ["src/test/**/*"],
4
+ "compilerOptions": {
5
+ "rootDir": "./src",
6
+ "outDir": "./dist",
7
+ "composite": true,
8
+ },
9
+ "include": ["src/**/*"],
10
+ }
package/.editorconfig DELETED
@@ -1,7 +0,0 @@
1
- [*]
2
- indent_size = 4
3
- trim_trailing_whitespace = true
4
- insert_final_newline = true
5
-
6
- [package.json]
7
- indent_size = 2