@fluidframework/tool-utils 2.0.0-dev.7.4.0.215930 → 2.0.0-dev.7.4.0.216897

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 (46) hide show
  1. package/api-extractor-lint.json +13 -0
  2. package/api-extractor.json +0 -4
  3. package/api-report/tool-utils.api.md +13 -13
  4. package/dist/fluidToolRC.d.ts +15 -0
  5. package/dist/fluidToolRC.d.ts.map +1 -1
  6. package/dist/fluidToolRC.js +9 -0
  7. package/dist/fluidToolRC.js.map +1 -1
  8. package/dist/odspTokenManager.d.ts +15 -0
  9. package/dist/odspTokenManager.d.ts.map +1 -1
  10. package/dist/odspTokenManager.js +9 -0
  11. package/dist/odspTokenManager.js.map +1 -1
  12. package/dist/packageVersion.d.ts +1 -1
  13. package/dist/packageVersion.js +1 -1
  14. package/dist/packageVersion.js.map +1 -1
  15. package/dist/snapshotNormalizer.d.ts +9 -1
  16. package/dist/snapshotNormalizer.d.ts.map +1 -1
  17. package/dist/snapshotNormalizer.js +6 -1
  18. package/dist/snapshotNormalizer.js.map +1 -1
  19. package/dist/tool-utils-alpha.d.ts +29 -88
  20. package/dist/tool-utils-beta.d.ts +29 -88
  21. package/dist/tool-utils-public.d.ts +29 -88
  22. package/dist/tool-utils-untrimmed.d.ts +39 -1
  23. package/lib/fluidToolRC.d.ts +15 -0
  24. package/lib/fluidToolRC.d.ts.map +1 -1
  25. package/lib/fluidToolRC.js +9 -0
  26. package/lib/fluidToolRC.js.map +1 -1
  27. package/lib/odspTokenManager.d.ts +15 -0
  28. package/lib/odspTokenManager.d.ts.map +1 -1
  29. package/lib/odspTokenManager.js +9 -0
  30. package/lib/odspTokenManager.js.map +1 -1
  31. package/lib/packageVersion.d.ts +1 -1
  32. package/lib/packageVersion.js +1 -1
  33. package/lib/packageVersion.js.map +1 -1
  34. package/lib/snapshotNormalizer.d.ts +9 -1
  35. package/lib/snapshotNormalizer.d.ts.map +1 -1
  36. package/lib/snapshotNormalizer.js +6 -1
  37. package/lib/snapshotNormalizer.js.map +1 -1
  38. package/lib/tool-utils-alpha.d.ts +29 -88
  39. package/lib/tool-utils-beta.d.ts +29 -88
  40. package/lib/tool-utils-public.d.ts +29 -88
  41. package/lib/tool-utils-untrimmed.d.ts +39 -1
  42. package/package.json +7 -6
  43. package/src/fluidToolRC.ts +15 -0
  44. package/src/odspTokenManager.ts +15 -0
  45. package/src/packageVersion.ts +1 -1
  46. package/src/snapshotNormalizer.ts +9 -1
@@ -1,92 +1,33 @@
1
- import { IClientConfig } from '@fluidframework/odsp-doclib-utils';
2
- import { IOdspTokens } from '@fluidframework/odsp-doclib-utils';
3
1
  import { ITree } from '@fluidframework/protocol-definitions';
4
2
 
5
- /** The prefix that all GC blob names start with. */
6
- export declare const gcBlobPrefix = "__gc";
7
-
8
- export declare const getMicrosoftConfiguration: () => IClientConfig;
9
-
10
- /**
11
- * Helper function that normalizes the given snapshot tree. It sorts objects and arrays in the snapshot. It also
12
- * normalizes certain blob contents for which the order of content does not matter. For example, garbage collection
13
- * blobs contains objects / arrays whose element order do not matter.
14
- * @param snapshot - The snapshot tree to normalize.
15
- * @param config - Configs to use when normalizing snapshot. For example, it can contain paths of blobs whose contents
16
- * should be normalized as well.
17
- * @returns a copy of the normalized snapshot tree.
18
- */
19
- export declare function getNormalizedSnapshot(snapshot: ITree, config?: ISnapshotNormalizerConfig): ITree;
20
-
21
- export declare interface IAsyncCache<TKey, TValue> {
22
- get(key: TKey): Promise<TValue | undefined>;
23
- save(key: TKey, value: TValue): Promise<void>;
24
- lock<T>(callback: () => Promise<T>): Promise<T>;
25
- }
26
-
27
- export declare interface IOdspTokenManagerCacheKey {
28
- readonly isPush: boolean;
29
- readonly userOrServer: string;
30
- }
31
-
32
- export declare interface IResources {
33
- tokens?: {
34
- version?: number;
35
- data: {
36
- [key: string]: {
37
- storage?: IOdspTokens;
38
- push?: IOdspTokens;
39
- };
40
- };
41
- };
42
- }
43
-
44
- export declare interface ISnapshotNormalizerConfig {
45
- blobsToNormalize?: string[];
46
- /**
47
- * channel types who's content (non-attribute) blobs will be excluded.
48
- * this is used to exclude the content of channels who's content cannot be compared
49
- * as the content is non-deterministic between snapshot at the same sequence number.
50
- */
51
- excludedChannelContentTypes?: string[];
52
- }
53
-
54
- export declare function loadRC(): Promise<IResources>;
55
-
56
- export declare function lockRC(): Promise<any>;
57
-
58
- export declare type OdspTokenConfig = {
59
- type: "password";
60
- username: string;
61
- password: string;
62
- } | {
63
- type: "browserLogin";
64
- navigator: (url: string) => void;
65
- redirectUriCallback?: (tokens: IOdspTokens) => Promise<string>;
66
- };
67
-
68
- export declare class OdspTokenManager {
69
- private readonly tokenCache?;
70
- private readonly storageCache;
71
- private readonly pushCache;
72
- private readonly cacheMutex;
73
- constructor(tokenCache?: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens> | undefined);
74
- updateTokensCache(key: IOdspTokenManagerCacheKey, value: IOdspTokens): Promise<void>;
75
- private updateTokensCacheWithoutLock;
76
- getOdspTokens(server: string, clientConfig: IClientConfig, tokenConfig: OdspTokenConfig, forceRefresh?: boolean, forceReauth?: boolean): Promise<IOdspTokens>;
77
- getPushTokens(server: string, clientConfig: IClientConfig, tokenConfig: OdspTokenConfig, forceRefresh?: boolean, forceReauth?: boolean): Promise<IOdspTokens>;
78
- private getTokenFromCache;
79
- private static getCacheKey;
80
- private getTokens;
81
- private getTokensCore;
82
- private acquireTokensWithPassword;
83
- private acquireTokensViaBrowserLogin;
84
- private onTokenRetrievalFromCache;
85
- private extractAuthorizationCode;
86
- }
87
-
88
- export declare const odspTokensCache: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens>;
89
-
90
- export declare function saveRC(rc: IResources): Promise<void>;
3
+ /* Excluded from this release type: gcBlobPrefix */
4
+
5
+ /* Excluded from this release type: getMicrosoftConfiguration */
6
+
7
+ /* Excluded from this release type: getNormalizedSnapshot */
8
+
9
+ /* Excluded from this release type: IAsyncCache */
10
+
11
+ /* Excluded from this release type: IClientConfig */
12
+
13
+ /* Excluded from this release type: IOdspTokenManagerCacheKey */
14
+
15
+ /* Excluded from this release type: IOdspTokens */
16
+
17
+ /* Excluded from this release type: IResources */
18
+
19
+ /* Excluded from this release type: ISnapshotNormalizerConfig */
20
+
21
+ /* Excluded from this release type: loadRC */
22
+
23
+ /* Excluded from this release type: lockRC */
24
+
25
+ /* Excluded from this release type: OdspTokenConfig */
26
+
27
+ /* Excluded from this release type: OdspTokenManager */
28
+
29
+ /* Excluded from this release type: odspTokensCache */
30
+
31
+ /* Excluded from this release type: saveRC */
91
32
 
92
33
  export { }
@@ -1,92 +1,33 @@
1
- import { IClientConfig } from '@fluidframework/odsp-doclib-utils';
2
- import { IOdspTokens } from '@fluidframework/odsp-doclib-utils';
3
1
  import { ITree } from '@fluidframework/protocol-definitions';
4
2
 
5
- /** The prefix that all GC blob names start with. */
6
- export declare const gcBlobPrefix = "__gc";
7
-
8
- export declare const getMicrosoftConfiguration: () => IClientConfig;
9
-
10
- /**
11
- * Helper function that normalizes the given snapshot tree. It sorts objects and arrays in the snapshot. It also
12
- * normalizes certain blob contents for which the order of content does not matter. For example, garbage collection
13
- * blobs contains objects / arrays whose element order do not matter.
14
- * @param snapshot - The snapshot tree to normalize.
15
- * @param config - Configs to use when normalizing snapshot. For example, it can contain paths of blobs whose contents
16
- * should be normalized as well.
17
- * @returns a copy of the normalized snapshot tree.
18
- */
19
- export declare function getNormalizedSnapshot(snapshot: ITree, config?: ISnapshotNormalizerConfig): ITree;
20
-
21
- export declare interface IAsyncCache<TKey, TValue> {
22
- get(key: TKey): Promise<TValue | undefined>;
23
- save(key: TKey, value: TValue): Promise<void>;
24
- lock<T>(callback: () => Promise<T>): Promise<T>;
25
- }
26
-
27
- export declare interface IOdspTokenManagerCacheKey {
28
- readonly isPush: boolean;
29
- readonly userOrServer: string;
30
- }
31
-
32
- export declare interface IResources {
33
- tokens?: {
34
- version?: number;
35
- data: {
36
- [key: string]: {
37
- storage?: IOdspTokens;
38
- push?: IOdspTokens;
39
- };
40
- };
41
- };
42
- }
43
-
44
- export declare interface ISnapshotNormalizerConfig {
45
- blobsToNormalize?: string[];
46
- /**
47
- * channel types who's content (non-attribute) blobs will be excluded.
48
- * this is used to exclude the content of channels who's content cannot be compared
49
- * as the content is non-deterministic between snapshot at the same sequence number.
50
- */
51
- excludedChannelContentTypes?: string[];
52
- }
53
-
54
- export declare function loadRC(): Promise<IResources>;
55
-
56
- export declare function lockRC(): Promise<any>;
57
-
58
- export declare type OdspTokenConfig = {
59
- type: "password";
60
- username: string;
61
- password: string;
62
- } | {
63
- type: "browserLogin";
64
- navigator: (url: string) => void;
65
- redirectUriCallback?: (tokens: IOdspTokens) => Promise<string>;
66
- };
67
-
68
- export declare class OdspTokenManager {
69
- private readonly tokenCache?;
70
- private readonly storageCache;
71
- private readonly pushCache;
72
- private readonly cacheMutex;
73
- constructor(tokenCache?: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens> | undefined);
74
- updateTokensCache(key: IOdspTokenManagerCacheKey, value: IOdspTokens): Promise<void>;
75
- private updateTokensCacheWithoutLock;
76
- getOdspTokens(server: string, clientConfig: IClientConfig, tokenConfig: OdspTokenConfig, forceRefresh?: boolean, forceReauth?: boolean): Promise<IOdspTokens>;
77
- getPushTokens(server: string, clientConfig: IClientConfig, tokenConfig: OdspTokenConfig, forceRefresh?: boolean, forceReauth?: boolean): Promise<IOdspTokens>;
78
- private getTokenFromCache;
79
- private static getCacheKey;
80
- private getTokens;
81
- private getTokensCore;
82
- private acquireTokensWithPassword;
83
- private acquireTokensViaBrowserLogin;
84
- private onTokenRetrievalFromCache;
85
- private extractAuthorizationCode;
86
- }
87
-
88
- export declare const odspTokensCache: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens>;
89
-
90
- export declare function saveRC(rc: IResources): Promise<void>;
3
+ /* Excluded from this release type: gcBlobPrefix */
4
+
5
+ /* Excluded from this release type: getMicrosoftConfiguration */
6
+
7
+ /* Excluded from this release type: getNormalizedSnapshot */
8
+
9
+ /* Excluded from this release type: IAsyncCache */
10
+
11
+ /* Excluded from this release type: IClientConfig */
12
+
13
+ /* Excluded from this release type: IOdspTokenManagerCacheKey */
14
+
15
+ /* Excluded from this release type: IOdspTokens */
16
+
17
+ /* Excluded from this release type: IResources */
18
+
19
+ /* Excluded from this release type: ISnapshotNormalizerConfig */
20
+
21
+ /* Excluded from this release type: loadRC */
22
+
23
+ /* Excluded from this release type: lockRC */
24
+
25
+ /* Excluded from this release type: OdspTokenConfig */
26
+
27
+ /* Excluded from this release type: OdspTokenManager */
28
+
29
+ /* Excluded from this release type: odspTokensCache */
30
+
31
+ /* Excluded from this release type: saveRC */
91
32
 
92
33
  export { }
@@ -1,92 +1,33 @@
1
- import { IClientConfig } from '@fluidframework/odsp-doclib-utils';
2
- import { IOdspTokens } from '@fluidframework/odsp-doclib-utils';
3
1
  import { ITree } from '@fluidframework/protocol-definitions';
4
2
 
5
- /** The prefix that all GC blob names start with. */
6
- export declare const gcBlobPrefix = "__gc";
7
-
8
- export declare const getMicrosoftConfiguration: () => IClientConfig;
9
-
10
- /**
11
- * Helper function that normalizes the given snapshot tree. It sorts objects and arrays in the snapshot. It also
12
- * normalizes certain blob contents for which the order of content does not matter. For example, garbage collection
13
- * blobs contains objects / arrays whose element order do not matter.
14
- * @param snapshot - The snapshot tree to normalize.
15
- * @param config - Configs to use when normalizing snapshot. For example, it can contain paths of blobs whose contents
16
- * should be normalized as well.
17
- * @returns a copy of the normalized snapshot tree.
18
- */
19
- export declare function getNormalizedSnapshot(snapshot: ITree, config?: ISnapshotNormalizerConfig): ITree;
20
-
21
- export declare interface IAsyncCache<TKey, TValue> {
22
- get(key: TKey): Promise<TValue | undefined>;
23
- save(key: TKey, value: TValue): Promise<void>;
24
- lock<T>(callback: () => Promise<T>): Promise<T>;
25
- }
26
-
27
- export declare interface IOdspTokenManagerCacheKey {
28
- readonly isPush: boolean;
29
- readonly userOrServer: string;
30
- }
31
-
32
- export declare interface IResources {
33
- tokens?: {
34
- version?: number;
35
- data: {
36
- [key: string]: {
37
- storage?: IOdspTokens;
38
- push?: IOdspTokens;
39
- };
40
- };
41
- };
42
- }
43
-
44
- export declare interface ISnapshotNormalizerConfig {
45
- blobsToNormalize?: string[];
46
- /**
47
- * channel types who's content (non-attribute) blobs will be excluded.
48
- * this is used to exclude the content of channels who's content cannot be compared
49
- * as the content is non-deterministic between snapshot at the same sequence number.
50
- */
51
- excludedChannelContentTypes?: string[];
52
- }
53
-
54
- export declare function loadRC(): Promise<IResources>;
55
-
56
- export declare function lockRC(): Promise<any>;
57
-
58
- export declare type OdspTokenConfig = {
59
- type: "password";
60
- username: string;
61
- password: string;
62
- } | {
63
- type: "browserLogin";
64
- navigator: (url: string) => void;
65
- redirectUriCallback?: (tokens: IOdspTokens) => Promise<string>;
66
- };
67
-
68
- export declare class OdspTokenManager {
69
- private readonly tokenCache?;
70
- private readonly storageCache;
71
- private readonly pushCache;
72
- private readonly cacheMutex;
73
- constructor(tokenCache?: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens> | undefined);
74
- updateTokensCache(key: IOdspTokenManagerCacheKey, value: IOdspTokens): Promise<void>;
75
- private updateTokensCacheWithoutLock;
76
- getOdspTokens(server: string, clientConfig: IClientConfig, tokenConfig: OdspTokenConfig, forceRefresh?: boolean, forceReauth?: boolean): Promise<IOdspTokens>;
77
- getPushTokens(server: string, clientConfig: IClientConfig, tokenConfig: OdspTokenConfig, forceRefresh?: boolean, forceReauth?: boolean): Promise<IOdspTokens>;
78
- private getTokenFromCache;
79
- private static getCacheKey;
80
- private getTokens;
81
- private getTokensCore;
82
- private acquireTokensWithPassword;
83
- private acquireTokensViaBrowserLogin;
84
- private onTokenRetrievalFromCache;
85
- private extractAuthorizationCode;
86
- }
87
-
88
- export declare const odspTokensCache: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens>;
89
-
90
- export declare function saveRC(rc: IResources): Promise<void>;
3
+ /* Excluded from this release type: gcBlobPrefix */
4
+
5
+ /* Excluded from this release type: getMicrosoftConfiguration */
6
+
7
+ /* Excluded from this release type: getNormalizedSnapshot */
8
+
9
+ /* Excluded from this release type: IAsyncCache */
10
+
11
+ /* Excluded from this release type: IClientConfig */
12
+
13
+ /* Excluded from this release type: IOdspTokenManagerCacheKey */
14
+
15
+ /* Excluded from this release type: IOdspTokens */
16
+
17
+ /* Excluded from this release type: IResources */
18
+
19
+ /* Excluded from this release type: ISnapshotNormalizerConfig */
20
+
21
+ /* Excluded from this release type: loadRC */
22
+
23
+ /* Excluded from this release type: lockRC */
24
+
25
+ /* Excluded from this release type: OdspTokenConfig */
26
+
27
+ /* Excluded from this release type: OdspTokenManager */
28
+
29
+ /* Excluded from this release type: odspTokensCache */
30
+
31
+ /* Excluded from this release type: saveRC */
91
32
 
92
33
  export { }
@@ -2,9 +2,16 @@ import { IClientConfig } from '@fluidframework/odsp-doclib-utils';
2
2
  import { IOdspTokens } from '@fluidframework/odsp-doclib-utils';
3
3
  import { ITree } from '@fluidframework/protocol-definitions';
4
4
 
5
- /** The prefix that all GC blob names start with. */
5
+ /**
6
+ * The prefix that all GC blob names start with.
7
+ *
8
+ * @internal
9
+ */
6
10
  export declare const gcBlobPrefix = "__gc";
7
11
 
12
+ /**
13
+ * @internal
14
+ */
8
15
  export declare const getMicrosoftConfiguration: () => IClientConfig;
9
16
 
10
17
  /**
@@ -15,20 +22,30 @@ export declare const getMicrosoftConfiguration: () => IClientConfig;
15
22
  * @param config - Configs to use when normalizing snapshot. For example, it can contain paths of blobs whose contents
16
23
  * should be normalized as well.
17
24
  * @returns a copy of the normalized snapshot tree.
25
+ * @internal
18
26
  */
19
27
  export declare function getNormalizedSnapshot(snapshot: ITree, config?: ISnapshotNormalizerConfig): ITree;
20
28
 
29
+ /**
30
+ * @internal
31
+ */
21
32
  export declare interface IAsyncCache<TKey, TValue> {
22
33
  get(key: TKey): Promise<TValue | undefined>;
23
34
  save(key: TKey, value: TValue): Promise<void>;
24
35
  lock<T>(callback: () => Promise<T>): Promise<T>;
25
36
  }
26
37
 
38
+ /**
39
+ * @internal
40
+ */
27
41
  export declare interface IOdspTokenManagerCacheKey {
28
42
  readonly isPush: boolean;
29
43
  readonly userOrServer: string;
30
44
  }
31
45
 
46
+ /**
47
+ * @internal
48
+ */
32
49
  export declare interface IResources {
33
50
  tokens?: {
34
51
  version?: number;
@@ -41,6 +58,9 @@ export declare interface IResources {
41
58
  };
42
59
  }
43
60
 
61
+ /**
62
+ * @internal
63
+ */
44
64
  export declare interface ISnapshotNormalizerConfig {
45
65
  blobsToNormalize?: string[];
46
66
  /**
@@ -51,10 +71,19 @@ export declare interface ISnapshotNormalizerConfig {
51
71
  excludedChannelContentTypes?: string[];
52
72
  }
53
73
 
74
+ /**
75
+ * @internal
76
+ */
54
77
  export declare function loadRC(): Promise<IResources>;
55
78
 
79
+ /**
80
+ * @internal
81
+ */
56
82
  export declare function lockRC(): Promise<any>;
57
83
 
84
+ /**
85
+ * @internal
86
+ */
58
87
  export declare type OdspTokenConfig = {
59
88
  type: "password";
60
89
  username: string;
@@ -65,6 +94,9 @@ export declare type OdspTokenConfig = {
65
94
  redirectUriCallback?: (tokens: IOdspTokens) => Promise<string>;
66
95
  };
67
96
 
97
+ /**
98
+ * @internal
99
+ */
68
100
  export declare class OdspTokenManager {
69
101
  private readonly tokenCache?;
70
102
  private readonly storageCache;
@@ -85,8 +117,14 @@ export declare class OdspTokenManager {
85
117
  private extractAuthorizationCode;
86
118
  }
87
119
 
120
+ /**
121
+ * @internal
122
+ */
88
123
  export declare const odspTokensCache: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens>;
89
124
 
125
+ /**
126
+ * @internal
127
+ */
90
128
  export declare function saveRC(rc: IResources): Promise<void>;
91
129
 
92
130
  export { }
@@ -3,11 +3,17 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { IOdspTokens } from "@fluidframework/odsp-doclib-utils";
6
+ /**
7
+ * @internal
8
+ */
6
9
  export interface IAsyncCache<TKey, TValue> {
7
10
  get(key: TKey): Promise<TValue | undefined>;
8
11
  save(key: TKey, value: TValue): Promise<void>;
9
12
  lock<T>(callback: () => Promise<T>): Promise<T>;
10
13
  }
14
+ /**
15
+ * @internal
16
+ */
11
17
  export interface IResources {
12
18
  tokens?: {
13
19
  version?: number;
@@ -19,7 +25,16 @@ export interface IResources {
19
25
  };
20
26
  };
21
27
  }
28
+ /**
29
+ * @internal
30
+ */
22
31
  export declare function loadRC(): Promise<IResources>;
32
+ /**
33
+ * @internal
34
+ */
23
35
  export declare function saveRC(rc: IResources): Promise<void>;
36
+ /**
37
+ * @internal
38
+ */
24
39
  export declare function lockRC(): Promise<any>;
25
40
  //# sourceMappingURL=fluidToolRC.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fluidToolRC.d.ts","sourceRoot":"","sources":["../src/fluidToolRC.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE,MAAM,WAAW,WAAW,CAAC,IAAI,EAAE,MAAM;IACxC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,UAAU;IAC1B,MAAM,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE;YACL,CAAC,GAAG,EAAE,MAAM,GAAG;gBACd,OAAO,CAAC,EAAE,WAAW,CAAC;gBACtB,IAAI,CAAC,EAAE,WAAW,CAAC;aACnB,CAAC;SACF,CAAC;KACF,CAAC;CACF;AAID,wBAAsB,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC,CAclD;AAED,wBAAsB,MAAM,CAAC,EAAE,EAAE,UAAU,iBAI1C;AAED,wBAAsB,MAAM,iBAS3B"}
1
+ {"version":3,"file":"fluidToolRC.d.ts","sourceRoot":"","sources":["../src/fluidToolRC.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,IAAI,EAAE,MAAM;IACxC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,MAAM,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE;YACL,CAAC,GAAG,EAAE,MAAM,GAAG;gBACd,OAAO,CAAC,EAAE,WAAW,CAAC;gBACtB,IAAI,CAAC,EAAE,WAAW,CAAC;aACnB,CAAC;SACF,CAAC;KACF,CAAC;CACF;AAID;;GAEG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC,CAclD;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,EAAE,EAAE,UAAU,iBAI1C;AAED;;GAEG;AACH,wBAAsB,MAAM,iBAS3B"}
@@ -8,6 +8,9 @@ import path from "path";
8
8
  import util from "util";
9
9
  import { lock } from "proper-lockfile";
10
10
  const getRCFileName = () => path.join(os.homedir(), ".fluidtoolrc");
11
+ /**
12
+ * @internal
13
+ */
11
14
  export async function loadRC() {
12
15
  const readFile = util.promisify(fs.readFile);
13
16
  const exists = util.promisify(fs.exists);
@@ -24,11 +27,17 @@ export async function loadRC() {
24
27
  }
25
28
  return {};
26
29
  }
30
+ /**
31
+ * @internal
32
+ */
27
33
  export async function saveRC(rc) {
28
34
  const writeFile = util.promisify(fs.writeFile);
29
35
  const content = JSON.stringify(rc, undefined, 2);
30
36
  return writeFile(getRCFileName(), Buffer.from(content, "utf8"));
31
37
  }
38
+ /**
39
+ * @internal
40
+ */
32
41
  export async function lockRC() {
33
42
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
34
43
  return lock(getRCFileName(), {
@@ -1 +1 @@
1
- {"version":3,"file":"fluidToolRC.js","sourceRoot":"","sources":["../src/fluidToolRC.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAqBvC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;AAEpE,MAAM,CAAC,KAAK,UAAU,MAAM;IAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,IAAI,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAE;QAC3B,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI;YACH,+DAA+D;YAC/D,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;SACxC;QAAC,OAAO,CAAC,EAAE;YACX,UAAU;SACV;KACD;IACD,OAAO,EAAE,CAAC;AACX,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,EAAc;IAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACjD,OAAO,SAAS,CAAC,aAAa,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM;IAC3B,+DAA+D;IAC/D,OAAO,IAAI,CAAC,aAAa,EAAE,EAAE;QAC5B,OAAO,EAAE;YACR,OAAO,EAAE,IAAI;SACb;QACD,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,KAAK;KACf,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport fs from \"fs\";\nimport os from \"os\";\nimport path from \"path\";\nimport util from \"util\";\nimport { lock } from \"proper-lockfile\";\nimport { IOdspTokens } from \"@fluidframework/odsp-doclib-utils\";\n\nexport interface IAsyncCache<TKey, TValue> {\n\tget(key: TKey): Promise<TValue | undefined>;\n\tsave(key: TKey, value: TValue): Promise<void>;\n\tlock<T>(callback: () => Promise<T>): Promise<T>;\n}\n\nexport interface IResources {\n\ttokens?: {\n\t\tversion?: number;\n\t\tdata: {\n\t\t\t[key: string]: {\n\t\t\t\tstorage?: IOdspTokens;\n\t\t\t\tpush?: IOdspTokens;\n\t\t\t};\n\t\t};\n\t};\n}\n\nconst getRCFileName = () => path.join(os.homedir(), \".fluidtoolrc\");\n\nexport async function loadRC(): Promise<IResources> {\n\tconst readFile = util.promisify(fs.readFile);\n\tconst exists = util.promisify(fs.exists);\n\tconst fileName = getRCFileName();\n\tif (await exists(fileName)) {\n\t\tconst buf = await readFile(fileName);\n\t\ttry {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn JSON.parse(buf.toString(\"utf8\"));\n\t\t} catch (e) {\n\t\t\t// Nothing\n\t\t}\n\t}\n\treturn {};\n}\n\nexport async function saveRC(rc: IResources) {\n\tconst writeFile = util.promisify(fs.writeFile);\n\tconst content = JSON.stringify(rc, undefined, 2);\n\treturn writeFile(getRCFileName(), Buffer.from(content, \"utf8\"));\n}\n\nexport async function lockRC() {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn lock(getRCFileName(), {\n\t\tretries: {\n\t\t\tforever: true,\n\t\t},\n\t\tstale: 60000,\n\t\trealpath: false,\n\t});\n}\n"]}
1
+ {"version":3,"file":"fluidToolRC.js","sourceRoot":"","sources":["../src/fluidToolRC.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AA2BvC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM;IAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,IAAI,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAE;QAC3B,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI;YACH,+DAA+D;YAC/D,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;SACxC;QAAC,OAAO,CAAC,EAAE;YACX,UAAU;SACV;KACD;IACD,OAAO,EAAE,CAAC;AACX,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,EAAc;IAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACjD,OAAO,SAAS,CAAC,aAAa,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM;IAC3B,+DAA+D;IAC/D,OAAO,IAAI,CAAC,aAAa,EAAE,EAAE;QAC5B,OAAO,EAAE;YACR,OAAO,EAAE,IAAI;SACb;QACD,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,KAAK;KACf,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport fs from \"fs\";\nimport os from \"os\";\nimport path from \"path\";\nimport util from \"util\";\nimport { lock } from \"proper-lockfile\";\nimport { IOdspTokens } from \"@fluidframework/odsp-doclib-utils\";\n\n/**\n * @internal\n */\nexport interface IAsyncCache<TKey, TValue> {\n\tget(key: TKey): Promise<TValue | undefined>;\n\tsave(key: TKey, value: TValue): Promise<void>;\n\tlock<T>(callback: () => Promise<T>): Promise<T>;\n}\n\n/**\n * @internal\n */\nexport interface IResources {\n\ttokens?: {\n\t\tversion?: number;\n\t\tdata: {\n\t\t\t[key: string]: {\n\t\t\t\tstorage?: IOdspTokens;\n\t\t\t\tpush?: IOdspTokens;\n\t\t\t};\n\t\t};\n\t};\n}\n\nconst getRCFileName = () => path.join(os.homedir(), \".fluidtoolrc\");\n\n/**\n * @internal\n */\nexport async function loadRC(): Promise<IResources> {\n\tconst readFile = util.promisify(fs.readFile);\n\tconst exists = util.promisify(fs.exists);\n\tconst fileName = getRCFileName();\n\tif (await exists(fileName)) {\n\t\tconst buf = await readFile(fileName);\n\t\ttry {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn JSON.parse(buf.toString(\"utf8\"));\n\t\t} catch (e) {\n\t\t\t// Nothing\n\t\t}\n\t}\n\treturn {};\n}\n\n/**\n * @internal\n */\nexport async function saveRC(rc: IResources) {\n\tconst writeFile = util.promisify(fs.writeFile);\n\tconst content = JSON.stringify(rc, undefined, 2);\n\treturn writeFile(getRCFileName(), Buffer.from(content, \"utf8\"));\n}\n\n/**\n * @internal\n */\nexport async function lockRC() {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn lock(getRCFileName(), {\n\t\tretries: {\n\t\t\tforever: true,\n\t\t},\n\t\tstale: 60000,\n\t\trealpath: false,\n\t});\n}\n"]}
@@ -4,7 +4,13 @@
4
4
  */
5
5
  import { IOdspTokens, IClientConfig } from "@fluidframework/odsp-doclib-utils";
6
6
  import { IAsyncCache } from "./fluidToolRC";
7
+ /**
8
+ * @internal
9
+ */
7
10
  export declare const getMicrosoftConfiguration: () => IClientConfig;
11
+ /**
12
+ * @internal
13
+ */
8
14
  export type OdspTokenConfig = {
9
15
  type: "password";
10
16
  username: string;
@@ -14,10 +20,16 @@ export type OdspTokenConfig = {
14
20
  navigator: (url: string) => void;
15
21
  redirectUriCallback?: (tokens: IOdspTokens) => Promise<string>;
16
22
  };
23
+ /**
24
+ * @internal
25
+ */
17
26
  export interface IOdspTokenManagerCacheKey {
18
27
  readonly isPush: boolean;
19
28
  readonly userOrServer: string;
20
29
  }
30
+ /**
31
+ * @internal
32
+ */
21
33
  export declare class OdspTokenManager {
22
34
  private readonly tokenCache?;
23
35
  private readonly storageCache;
@@ -37,5 +49,8 @@ export declare class OdspTokenManager {
37
49
  private onTokenRetrievalFromCache;
38
50
  private extractAuthorizationCode;
39
51
  }
52
+ /**
53
+ * @internal
54
+ */
40
55
  export declare const odspTokensCache: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens>;
41
56
  //# sourceMappingURL=odspTokenManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"odspTokenManager.d.ts","sourceRoot":"","sources":["../src/odspTokenManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,WAAW,EACX,aAAa,EAOb,MAAM,mCAAmC,CAAC;AAI3C,OAAO,EAAE,WAAW,EAA0B,MAAM,eAAe,CAAC;AAOpE,eAAO,MAAM,yBAAyB,QAAO,aAe3C,CAAC;AAEH,MAAM,MAAM,eAAe,GACxB;IACA,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAChB,GACD;IACA,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9D,CAAC;AAEL,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC9B;AAiBD,qBAAa,gBAAgB;IAK3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IAJ7B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkC;IAC/D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkC;IAC5D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;gBAExB,UAAU,CAAC,iEAAqD;IAGrE,iBAAiB,CAAC,GAAG,EAAE,yBAAyB,EAAE,KAAK,EAAE,WAAW;YAMnE,4BAA4B;IAO7B,aAAa,CACzB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,eAAe,EAC5B,YAAY,UAAQ,EACpB,WAAW,UAAQ,GACjB,OAAO,CAAC,WAAW,CAAC;IAIV,aAAa,CACzB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,eAAe,EAC5B,YAAY,UAAQ,EACpB,WAAW,UAAQ,GACjB,OAAO,CAAC,WAAW,CAAC;YAIT,iBAAiB;IAe/B,OAAO,CAAC,MAAM,CAAC,WAAW;YAYZ,SAAS;YA0CT,aAAa;YA+Db,yBAAyB;YAezB,4BAA4B;YAuC5B,yBAAyB;IAMvC,OAAO,CAAC,wBAAwB;CAWhC;AAYD,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,yBAAyB,EAAE,WAAW,CA6B/E,CAAC"}
1
+ {"version":3,"file":"odspTokenManager.d.ts","sourceRoot":"","sources":["../src/odspTokenManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,WAAW,EACX,aAAa,EAOb,MAAM,mCAAmC,CAAC;AAI3C,OAAO,EAAE,WAAW,EAA0B,MAAM,eAAe,CAAC;AAOpE;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,aAe3C,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,eAAe,GACxB;IACA,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAChB,GACD;IACA,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9D,CAAC;AAEL;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC9B;AAiBD;;GAEG;AACH,qBAAa,gBAAgB;IAK3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IAJ7B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkC;IAC/D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkC;IAC5D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;gBAExB,UAAU,CAAC,iEAAqD;IAGrE,iBAAiB,CAAC,GAAG,EAAE,yBAAyB,EAAE,KAAK,EAAE,WAAW;YAMnE,4BAA4B;IAO7B,aAAa,CACzB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,eAAe,EAC5B,YAAY,UAAQ,EACpB,WAAW,UAAQ,GACjB,OAAO,CAAC,WAAW,CAAC;IAIV,aAAa,CACzB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,eAAe,EAC5B,YAAY,UAAQ,EACpB,WAAW,UAAQ,GACjB,OAAO,CAAC,WAAW,CAAC;YAIT,iBAAiB;IAe/B,OAAO,CAAC,MAAM,CAAC,WAAW;YAYZ,SAAS;YA0CT,aAAa;YA+Db,yBAAyB;YAezB,4BAA4B;YAuC5B,yBAAyB;IAMvC,OAAO,CAAC,wBAAwB;CAWhC;AAYD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,yBAAyB,EAAE,WAAW,CA6B/E,CAAC"}
@@ -12,6 +12,9 @@ import { serverListenAndHandle, endResponse } from "./httpHelpers";
12
12
  const odspAuthRedirectPort = 7000;
13
13
  const odspAuthRedirectOrigin = `http://localhost:${odspAuthRedirectPort}`;
14
14
  const odspAuthRedirectUri = new URL("/auth/callback", odspAuthRedirectOrigin).href;
15
+ /**
16
+ * @internal
17
+ */
15
18
  export const getMicrosoftConfiguration = () => ({
16
19
  get clientId() {
17
20
  if (!process.env.login__microsoft__clientId) {
@@ -38,6 +41,9 @@ const isValidToken = (token) => {
38
41
  const cacheKeyToString = (key) => {
39
42
  return `${key.userOrServer}${key.isPush ? "[Push]" : ""}`;
40
43
  };
44
+ /**
45
+ * @internal
46
+ */
41
47
  export class OdspTokenManager {
42
48
  constructor(tokenCache) {
43
49
  this.tokenCache = tokenCache;
@@ -212,6 +218,9 @@ async function loadAndPatchRC() {
212
218
  }
213
219
  return rc;
214
220
  }
221
+ /**
222
+ * @internal
223
+ */
215
224
  export const odspTokensCache = {
216
225
  async get(key) {
217
226
  const rc = await loadAndPatchRC();