@fluidframework/tool-utils 1.4.0-115997 → 2.0.0-dev-rc.1.0.0.224419

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 (74) hide show
  1. package/.eslintrc.js +19 -31
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +117 -0
  4. package/README.md +68 -1
  5. package/api-extractor-lint.json +4 -0
  6. package/api-extractor.json +2 -2
  7. package/api-report/tool-utils.api.md +95 -0
  8. package/dist/fluidToolRC.d.ts +15 -0
  9. package/dist/fluidToolRC.d.ts.map +1 -1
  10. package/dist/fluidToolRC.js +9 -0
  11. package/dist/fluidToolRC.js.map +1 -1
  12. package/dist/httpHelpers.d.ts +3 -2
  13. package/dist/httpHelpers.d.ts.map +1 -1
  14. package/dist/httpHelpers.js +6 -2
  15. package/dist/httpHelpers.js.map +1 -1
  16. package/dist/index.d.ts +3 -3
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +12 -13
  19. package/dist/index.js.map +1 -1
  20. package/dist/odspTokenManager.d.ts +16 -1
  21. package/dist/odspTokenManager.d.ts.map +1 -1
  22. package/dist/odspTokenManager.js +21 -15
  23. package/dist/odspTokenManager.js.map +1 -1
  24. package/dist/packageVersion.d.ts +1 -1
  25. package/dist/packageVersion.d.ts.map +1 -1
  26. package/dist/packageVersion.js +1 -1
  27. package/dist/packageVersion.js.map +1 -1
  28. package/dist/snapshotNormalizer.d.ts +9 -1
  29. package/dist/snapshotNormalizer.d.ts.map +1 -1
  30. package/dist/snapshotNormalizer.js +63 -20
  31. package/dist/snapshotNormalizer.js.map +1 -1
  32. package/dist/tool-utils-alpha.d.ts +35 -0
  33. package/dist/tool-utils-beta.d.ts +35 -0
  34. package/dist/tool-utils-public.d.ts +35 -0
  35. package/dist/tool-utils-untrimmed.d.ts +130 -0
  36. package/dist/tsdoc-metadata.json +11 -0
  37. package/lib/fluidToolRC.d.ts +15 -0
  38. package/lib/fluidToolRC.d.ts.map +1 -1
  39. package/lib/fluidToolRC.js +9 -0
  40. package/lib/fluidToolRC.js.map +1 -1
  41. package/lib/httpHelpers.d.ts +3 -2
  42. package/lib/httpHelpers.d.ts.map +1 -1
  43. package/lib/httpHelpers.js +6 -2
  44. package/lib/httpHelpers.js.map +1 -1
  45. package/lib/index.d.ts +3 -3
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/index.js +3 -3
  48. package/lib/index.js.map +1 -1
  49. package/lib/odspTokenManager.d.ts +16 -1
  50. package/lib/odspTokenManager.d.ts.map +1 -1
  51. package/lib/odspTokenManager.js +19 -10
  52. package/lib/odspTokenManager.js.map +1 -1
  53. package/lib/packageVersion.d.ts +1 -1
  54. package/lib/packageVersion.d.ts.map +1 -1
  55. package/lib/packageVersion.js +1 -1
  56. package/lib/packageVersion.js.map +1 -1
  57. package/lib/snapshotNormalizer.d.ts +9 -1
  58. package/lib/snapshotNormalizer.d.ts.map +1 -1
  59. package/lib/snapshotNormalizer.js +61 -18
  60. package/lib/snapshotNormalizer.js.map +1 -1
  61. package/lib/tool-utils-alpha.d.ts +35 -0
  62. package/lib/tool-utils-beta.d.ts +35 -0
  63. package/lib/tool-utils-public.d.ts +35 -0
  64. package/lib/tool-utils-untrimmed.d.ts +130 -0
  65. package/package.json +75 -59
  66. package/prettier.config.cjs +8 -0
  67. package/src/fluidToolRC.ts +51 -36
  68. package/src/httpHelpers.ts +58 -44
  69. package/src/index.ts +13 -3
  70. package/src/odspTokenManager.ts +318 -311
  71. package/src/packageVersion.ts +1 -1
  72. package/src/snapshotNormalizer.ts +207 -141
  73. package/tsconfig.esnext.json +6 -6
  74. package/tsconfig.json +10 -16
package/.eslintrc.js CHANGED
@@ -4,34 +4,22 @@
4
4
  */
5
5
 
6
6
  module.exports = {
7
- "extends": [
8
- require.resolve("@fluidframework/eslint-config-fluid")
9
- ],
10
- "parserOptions": {
11
- "project": ["./tsconfig.json", "./src/test/tsconfig.json"]
12
- },
13
- "rules": {
14
- "@typescript-eslint/strict-boolean-expressions": "off",
15
- "unicorn/filename-case": [
16
- "error",
17
- {
18
- "cases": {
19
- "camelCase": true,
20
- "pascalCase": true
21
- },
22
- "ignore": [
23
- /.*fluidToolRC\.ts$/,
24
- ]
25
- }
26
- ],
27
- },
28
- overrides: [
29
- {
30
- // Rules only for type validation files
31
- files: ["**/types/*validate*Previous*.ts"],
32
- rules: {
33
- "@typescript-eslint/comma-spacing": "off",
34
- },
35
- },
36
- ],
37
- }
7
+ extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"],
8
+ parserOptions: {
9
+ project: ["./tsconfig.json", "./src/test/tsconfig.json"],
10
+ },
11
+ rules: {
12
+ "@typescript-eslint/strict-boolean-expressions": "off",
13
+ "import/no-nodejs-modules": "off",
14
+ "unicorn/filename-case": [
15
+ "error",
16
+ {
17
+ cases: {
18
+ camelCase: true,
19
+ pascalCase: true,
20
+ },
21
+ ignore: [/.*fluidToolRC\.ts$/],
22
+ },
23
+ ],
24
+ },
25
+ };
package/.mocharc.js ADDED
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ "use strict";
7
+
8
+ const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common");
9
+
10
+ const packageDir = __dirname;
11
+ const config = getFluidTestMochaConfig(packageDir);
12
+ module.exports = config;
package/CHANGELOG.md ADDED
@@ -0,0 +1,117 @@
1
+ # @fluidframework/tool-utils
2
+
3
+ ## 2.0.0-internal.8.0.0
4
+
5
+ Dependency updates only.
6
+
7
+ ## 2.0.0-internal.7.4.0
8
+
9
+ Dependency updates only.
10
+
11
+ ## 2.0.0-internal.7.3.0
12
+
13
+ Dependency updates only.
14
+
15
+ ## 2.0.0-internal.7.2.0
16
+
17
+ Dependency updates only.
18
+
19
+ ## 2.0.0-internal.7.1.0
20
+
21
+ Dependency updates only.
22
+
23
+ ## 2.0.0-internal.7.0.0
24
+
25
+ ### Major Changes
26
+
27
+ - Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
28
+
29
+ This included the following changes from the protocol-definitions release:
30
+
31
+ - Updating signal interfaces for some planned improvements. The intention is split the interface between signals
32
+ submitted by clients to the server and the resulting signals sent from the server to clients.
33
+ - A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
34
+ been added, which will be the typing for signals sent from the client to the server. Both extend a new
35
+ ISignalMessageBase interface that contains common members.
36
+ - The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
37
+
38
+ - Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
39
+
40
+ Dependencies on the following Fluid server package have been updated to version 2.0.1:
41
+
42
+ - @fluidframework/gitresources: 2.0.1
43
+ - @fluidframework/server-kafka-orderer: 2.0.1
44
+ - @fluidframework/server-lambdas: 2.0.1
45
+ - @fluidframework/server-lambdas-driver: 2.0.1
46
+ - @fluidframework/server-local-server: 2.0.1
47
+ - @fluidframework/server-memory-orderer: 2.0.1
48
+ - @fluidframework/protocol-base: 2.0.1
49
+ - @fluidframework/server-routerlicious: 2.0.1
50
+ - @fluidframework/server-routerlicious-base: 2.0.1
51
+ - @fluidframework/server-services: 2.0.1
52
+ - @fluidframework/server-services-client: 2.0.1
53
+ - @fluidframework/server-services-core: 2.0.1
54
+ - @fluidframework/server-services-ordering-kafkanode: 2.0.1
55
+ - @fluidframework/server-services-ordering-rdkafka: 2.0.1
56
+ - @fluidframework/server-services-ordering-zookeeper: 2.0.1
57
+ - @fluidframework/server-services-shared: 2.0.1
58
+ - @fluidframework/server-services-telemetry: 2.0.1
59
+ - @fluidframework/server-services-utils: 2.0.1
60
+ - @fluidframework/server-test-utils: 2.0.1
61
+ - tinylicious: 2.0.1
62
+
63
+ - Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
64
+
65
+ The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
66
+
67
+ ## 2.0.0-internal.6.4.0
68
+
69
+ Dependency updates only.
70
+
71
+ ## 2.0.0-internal.6.3.0
72
+
73
+ Dependency updates only.
74
+
75
+ ## 2.0.0-internal.6.2.0
76
+
77
+ Dependency updates only.
78
+
79
+ ## 2.0.0-internal.6.1.0
80
+
81
+ Dependency updates only.
82
+
83
+ ## 2.0.0-internal.6.0.0
84
+
85
+ ### Major Changes
86
+
87
+ - Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
88
+
89
+ Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
90
+
91
+ ## 2.0.0-internal.5.4.0
92
+
93
+ Dependency updates only.
94
+
95
+ ## 2.0.0-internal.5.3.0
96
+
97
+ Dependency updates only.
98
+
99
+ ## 2.0.0-internal.5.2.0
100
+
101
+ Dependency updates only.
102
+
103
+ ## 2.0.0-internal.5.1.0
104
+
105
+ Dependency updates only.
106
+
107
+ ## 2.0.0-internal.5.0.0
108
+
109
+ Dependency updates only.
110
+
111
+ ## 2.0.0-internal.4.4.0
112
+
113
+ Dependency updates only.
114
+
115
+ ## 2.0.0-internal.4.1.0
116
+
117
+ Dependency updates only.
package/README.md CHANGED
@@ -2,4 +2,71 @@
2
2
 
3
3
  Shared utilities for tools.
4
4
 
5
- See [GitHub](https://github.com/microsoft/FluidFramework) for more details on the Fluid Framework and packages within.
5
+ <!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README:scripts=FALSE) -->
6
+
7
+ <!-- prettier-ignore-start -->
8
+ <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
9
+
10
+ ## Using Fluid Framework libraries
11
+
12
+ When taking a dependency on a Fluid Framework library, we recommend using a `^` (caret) version range, such as `^1.3.4`.
13
+ While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
14
+ library consumers should always prefer `^`.
15
+
16
+ Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
17
+ you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
18
+ Standard `^` and `~` ranges will not work as expected.
19
+ See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
20
+ package for more information including tools to convert between version schemes.
21
+
22
+ ## Installation
23
+
24
+ To get started, install the package by running the following command:
25
+
26
+ ```bash
27
+ npm i @fluidframework/tool-utils
28
+ ```
29
+
30
+ ## API Documentation
31
+
32
+ API documentation for **@fluidframework/tool-utils** is available at <https://fluidframework.com/docs/apis/tool-utils>.
33
+
34
+ ## Contribution Guidelines
35
+
36
+ There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
37
+
38
+ - Participate in Q&A in our [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
39
+ - [Submit bugs](https://github.com/microsoft/FluidFramework/issues) and help us verify fixes as they are checked in.
40
+ - Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls).
41
+ - [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).
42
+
43
+ Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/wiki).
44
+
45
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
46
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
47
+
48
+ This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
49
+ Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
50
+ Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
51
+
52
+ ## Help
53
+
54
+ Not finding what you're looking for in this README? Check out our [GitHub
55
+ Wiki](https://github.com/microsoft/FluidFramework/wiki) or [fluidframework.com](https://fluidframework.com/docs/).
56
+
57
+ Still not finding what you're looking for? Please [file an
58
+ issue](https://github.com/microsoft/FluidFramework/wiki/Submitting-Bugs-and-Feature-Requests).
59
+
60
+ Thank you!
61
+
62
+ ## Trademark
63
+
64
+ This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
65
+
66
+ Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
67
+
68
+ Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
69
+
70
+ <!-- prettier-ignore-end -->
71
+
72
+ <!-- AUTO-GENERATED-CONTENT:END -->
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../common/build/build-common/api-extractor-lint.json"
4
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "@fluidframework/build-common/api-extractor-common-report.json"
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../common/build/build-common/api-extractor-base.json"
4
4
  }
@@ -0,0 +1,95 @@
1
+ ## API Report File for "@fluidframework/tool-utils"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { IClientConfig } from '@fluidframework/odsp-doclib-utils';
8
+ import { IOdspTokens } from '@fluidframework/odsp-doclib-utils';
9
+ import { ITree } from '@fluidframework/protocol-definitions';
10
+
11
+ // @internal
12
+ export const gcBlobPrefix = "__gc";
13
+
14
+ // @internal (undocumented)
15
+ export const getMicrosoftConfiguration: () => IClientConfig;
16
+
17
+ // @internal
18
+ export function getNormalizedSnapshot(snapshot: ITree, config?: ISnapshotNormalizerConfig): ITree;
19
+
20
+ // @internal (undocumented)
21
+ export interface IAsyncCache<TKey, TValue> {
22
+ // (undocumented)
23
+ get(key: TKey): Promise<TValue | undefined>;
24
+ // (undocumented)
25
+ lock<T>(callback: () => Promise<T>): Promise<T>;
26
+ // (undocumented)
27
+ save(key: TKey, value: TValue): Promise<void>;
28
+ }
29
+
30
+ // @internal (undocumented)
31
+ export interface IOdspTokenManagerCacheKey {
32
+ // (undocumented)
33
+ readonly isPush: boolean;
34
+ // (undocumented)
35
+ readonly userOrServer: string;
36
+ }
37
+
38
+ // @internal (undocumented)
39
+ export interface IResources {
40
+ // (undocumented)
41
+ tokens?: {
42
+ version?: number;
43
+ data: {
44
+ [key: string]: {
45
+ storage?: IOdspTokens;
46
+ push?: IOdspTokens;
47
+ };
48
+ };
49
+ };
50
+ }
51
+
52
+ // @internal (undocumented)
53
+ export interface ISnapshotNormalizerConfig {
54
+ // (undocumented)
55
+ blobsToNormalize?: string[];
56
+ excludedChannelContentTypes?: string[];
57
+ }
58
+
59
+ // @internal (undocumented)
60
+ export function loadRC(): Promise<IResources>;
61
+
62
+ // @internal (undocumented)
63
+ export function lockRC(): Promise<any>;
64
+
65
+ // @internal (undocumented)
66
+ export type OdspTokenConfig = {
67
+ type: "password";
68
+ username: string;
69
+ password: string;
70
+ } | {
71
+ type: "browserLogin";
72
+ navigator: (url: string) => void;
73
+ redirectUriCallback?: (tokens: IOdspTokens) => Promise<string>;
74
+ };
75
+
76
+ // @internal (undocumented)
77
+ export class OdspTokenManager {
78
+ constructor(tokenCache?: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens> | undefined);
79
+ // (undocumented)
80
+ getOdspTokens(server: string, clientConfig: IClientConfig, tokenConfig: OdspTokenConfig, forceRefresh?: boolean, forceReauth?: boolean): Promise<IOdspTokens>;
81
+ // (undocumented)
82
+ getPushTokens(server: string, clientConfig: IClientConfig, tokenConfig: OdspTokenConfig, forceRefresh?: boolean, forceReauth?: boolean): Promise<IOdspTokens>;
83
+ // (undocumented)
84
+ updateTokensCache(key: IOdspTokenManagerCacheKey, value: IOdspTokens): Promise<void>;
85
+ }
86
+
87
+ // @internal (undocumented)
88
+ export const odspTokensCache: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens>;
89
+
90
+ // @internal (undocumented)
91
+ export function saveRC(rc: IResources): Promise<void>;
92
+
93
+ // (No @packageDocumentation comment for this package)
94
+
95
+ ```
@@ -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":"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M,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"}
@@ -14,6 +14,9 @@ const path_1 = __importDefault(require("path"));
14
14
  const util_1 = __importDefault(require("util"));
15
15
  const proper_lockfile_1 = require("proper-lockfile");
16
16
  const getRCFileName = () => path_1.default.join(os_1.default.homedir(), ".fluidtoolrc");
17
+ /**
18
+ * @internal
19
+ */
17
20
  async function loadRC() {
18
21
  const readFile = util_1.default.promisify(fs_1.default.readFile);
19
22
  const exists = util_1.default.promisify(fs_1.default.exists);
@@ -31,12 +34,18 @@ async function loadRC() {
31
34
  return {};
32
35
  }
33
36
  exports.loadRC = loadRC;
37
+ /**
38
+ * @internal
39
+ */
34
40
  async function saveRC(rc) {
35
41
  const writeFile = util_1.default.promisify(fs_1.default.writeFile);
36
42
  const content = JSON.stringify(rc, undefined, 2);
37
43
  return writeFile(getRCFileName(), Buffer.from(content, "utf8"));
38
44
  }
39
45
  exports.saveRC = saveRC;
46
+ /**
47
+ * @internal
48
+ */
40
49
  async function lockRC() {
41
50
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
42
51
  return (0, proper_lockfile_1.lock)(getRCFileName(), {
@@ -1 +1 @@
1
- {"version":3,"file":"fluidToolRC.js","sourceRoot":"","sources":["../src/fluid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AAO,EAAE,IAAI;SAChB;QACD,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,KAAK;KAClB,CAAC,CAAC;AACP,CAAC;AATD,wBASC","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 get(key: TKey): Promise<TValue | undefined>;\n save(key: TKey, value: TValue): Promise<void>;\n lock<T>(callback: () => Promise<T>): Promise<T>;\n}\n\nexport interface IResources {\n tokens?: {\n version?: number;\n data: {\n [key: string]: {\n storage?: IOdspTokens;\n push?: IOdspTokens;\n };\n };\n };\n}\n\nconst getRCFileName = () => path.join(os.homedir(), \".fluidtoolrc\");\n\nexport async function loadRC(): Promise<IResources> {\n const readFile = util.promisify(fs.readFile);\n const exists = util.promisify(fs.exists);\n const fileName = getRCFileName();\n if (await exists(fileName)) {\n const buf = await readFile(fileName);\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return JSON.parse(buf.toString(\"utf8\"));\n } catch (e) {\n // Nothing\n }\n }\n return {};\n}\n\nexport async function saveRC(rc: IResources) {\n const writeFile = util.promisify(fs.writeFile);\n const content = JSON.stringify(rc, undefined, 2);\n return writeFile(getRCFileName(), Buffer.from(content, \"utf8\"));\n}\n\nexport async function lockRC() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return lock(getRCFileName(), {\n retries: {\n forever: true,\n },\n stale: 60000,\n realpath: false,\n });\n}\n"]}
1
+ {"version":3,"file":"fluidToolRC.js","sourceRoot":"","sources":["../src/fluidToolRC.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AACxB,gDAAwB;AACxB,qDAAuC;AA2BvC,MAAM,a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AC;AATD,wBASC","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"]}
@@ -3,6 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  /// <reference types="node" />
6
+ /// <reference types="node" />
6
7
  import http from "http";
7
8
  import { Socket } from "net";
8
9
  export interface ITrackedHttpServer {
@@ -11,8 +12,8 @@ export interface ITrackedHttpServer {
11
12
  fullyClose(): void;
12
13
  }
13
14
  export declare function createTrackedServer(port: number, requestListener: http.RequestListener): ITrackedHttpServer;
14
- export declare type OnceListenerHandler<T> = (req: http.IncomingMessage, res: http.ServerResponse) => Promise<T>;
15
- export declare type OnceListenerResult<T> = Promise<() => Promise<T>>;
15
+ export type OnceListenerHandler<T> = (req: http.IncomingMessage, res: http.ServerResponse) => Promise<T>;
16
+ export type OnceListenerResult<T> = Promise<() => Promise<T>>;
16
17
  export declare const serverListenAndHandle: <T>(port: number, handler: OnceListenerHandler<T>) => OnceListenerResult<T>;
17
18
  export declare const endResponse: (response: http.ServerResponse) => Promise<void>;
18
19
  //# sourceMappingURL=httpHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"httpHelpers.d.ts","sourceRoot":"","sources":["../src/httpHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAE7B,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,UAAU,IAAI,IAAI,CAAC;CACtB;AACD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,eAAe,GAAG,kBAAkB,CAe3G;AACD,oBAAY,mBAAmB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AACzG,oBAAY,kBAAkB,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,eAAO,MAAM,qBAAqB,YAAmB,MAAM,2DAmBrD,CAAC;AAEP,eAAO,MAAM,WAAW,aAAoB,KAAK,cAAc,KAAG,QAAQ,IAAI,CAM5E,CAAC"}
1
+ {"version":3,"file":"httpHelpers.d.ts","sourceRoot":"","sources":["../src/httpHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAE7B,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,UAAU,IAAI,IAAI,CAAC;CACnB;AACD,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,IAAI,CAAC,eAAe,GACnC,kBAAkB,CAiBpB;AACD,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CACpC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,KACpB,OAAO,CAAC,CAAC,CAAC,CAAC;AAChB,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,eAAO,MAAM,qBAAqB,YAC3B,MAAM,2DAuBV,CAAC;AAEJ,eAAO,MAAM,WAAW,aAAoB,KAAK,cAAc,KAAG,QAAQ,IAAI,CAO3E,CAAC"}
@@ -17,7 +17,9 @@ function createTrackedServer(port, requestListener) {
17
17
  socket.on("close", () => sockets.delete(socket));
18
18
  });
19
19
  return {
20
- server, sockets, fullyClose() {
20
+ server,
21
+ sockets,
22
+ fullyClose() {
21
23
  server.close();
22
24
  sockets.forEach((socket) => socket.destroy());
23
25
  },
@@ -36,7 +38,9 @@ new Promise((outerResolve, outerReject) => {
36
38
  res.end();
37
39
  return;
38
40
  }
39
- handler(req, res).finally(() => httpServer.fullyClose()).then((result) => innerResolve(result), (error) => innerReject(error));
41
+ handler(req, res)
42
+ .finally(() => httpServer.fullyClose())
43
+ .then((result) => innerResolve(result), (error) => innerReject(error));
40
44
  });
41
45
  outerResolve(async () => innerP);
42
46
  });
@@ -1 +1 @@
1
- {"version":3,"file":"httpHelpers.js","sourceRoot":"","sources":["../src/httpHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,gDAAwB;AAQxB,SAAgB,mBAAmB,CAAC,IAAY,EAAE,eAAqC;IACnF,MAAM,MAAM,GAAG,cAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAElC,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;QAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,OAAO;QACH,MAAM,EAAE,OAAO,EAAE,UAAU;YACvB,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAClD,CAAC;KACJ,CAAC;AACN,CAAC;AAfD,kDAeC;AAGM,MAAM,qBAAqB,GAAG,KAAK,EAAK,IAAY,EAAE,OAA+B,EAAyB,EAAE;AACnH,+CAA+C;AAC/C,IAAI,OAAO,CAAC,CAAC,YAAY,EAAE,WAAW,EAAE,EAAE;IAC1C,+CAA+C;IAC3C,MAAM,MAAM,GAAG,IAAI,OAAO,CAAI,CAAC,YAAY,EAAE,WAAW,EAAE,EAAE;QACxD,MAAM,UAAU,GAAG,mBAAmB,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACtD,iBAAiB;YACjB,IAAI,GAAG,CAAC,GAAG,KAAK,cAAc,EAAE;gBAC5B,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC,CAAC;gBACvD,GAAG,CAAC,GAAG,EAAE,CAAC;gBACV,OAAO;aACV;YACD,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CACzD,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,EAChC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAChC,CAAC;QACN,CAAC,CAAC,CAAC;QACH,YAAY,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAnBM,QAAA,qBAAqB,yBAmB3B;AAEA,MAAM,WAAW,GAAG,KAAK,EAAE,QAA6B,EAAiB,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC/G,IAAI;QACA,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;KACzB;IAAC,OAAO,KAAK,EAAE;QACZ,MAAM,CAAC,KAAK,CAAC,CAAC;KACjB;AACL,CAAC,CAAC,CAAC;AANU,QAAA,WAAW,eAMrB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport http from \"http\";\nimport { Socket } from \"net\";\n\nexport interface ITrackedHttpServer {\n readonly server: http.Server;\n readonly sockets: Set<Socket>;\n fullyClose(): void;\n}\nexport function createTrackedServer(port: number, requestListener: http.RequestListener): ITrackedHttpServer {\n const server = http.createServer(requestListener).listen(port);\n const sockets = new Set<Socket>();\n\n server.on(\"connection\", (socket) => {\n sockets.add(socket);\n socket.on(\"close\", () => sockets.delete(socket));\n });\n\n return {\n server, sockets, fullyClose() {\n server.close();\n sockets.forEach((socket) => socket.destroy());\n },\n };\n}\nexport type OnceListenerHandler<T> = (req: http.IncomingMessage, res: http.ServerResponse) => Promise<T>;\nexport type OnceListenerResult<T> = Promise<() => Promise<T>>;\nexport const serverListenAndHandle = async <T>(port: number, handler: OnceListenerHandler<T>): OnceListenerResult<T> =>\n // eslint-disable-next-line promise/param-names\n new Promise((outerResolve, outerReject) => {\n // eslint-disable-next-line promise/param-names\n const innerP = new Promise<T>((innerResolve, innerReject) => {\n const httpServer = createTrackedServer(port, (req, res) => {\n // ignore favicon\n if (req.url === \"/favicon.ico\") {\n res.writeHead(200, { \"Content-Type\": \"image/x-icon\" });\n res.end();\n return;\n }\n handler(req, res).finally(() => httpServer.fullyClose()).then(\n (result) => innerResolve(result),\n (error) => innerReject(error),\n );\n });\n outerResolve(async () => innerP);\n });\n });\n\nexport const endResponse = async (response: http.ServerResponse): Promise<void> => new Promise((resolve, reject) => {\n try {\n response.end(resolve);\n } catch (error) {\n reject(error);\n }\n});\n"]}
1
+ {"version":3,"file":"httpHelpers.js","sourceRoot":"","sources":["../src/httpHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,gDAAwB;AAQxB,SAAgB,mBAAmB,CAClC,IAAY,EACZ,eAAqC;IAErC,MAAM,MAAM,GAAG,cAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAElC,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;QAClC,OAAO,CAAC,GAAG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AAM,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAxBS,QAAA,qBAAqB,yBAwB9B;AAEG,MAAM,WAAW,GAAG,KAAK,EAAE,QAA6B,EAAiB,EAAE,CACjF,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC/B,IAAI;QACH,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;KACtB;IAAC,OAAO,KAAK,EAAE;QACf,MAAM,CAAC,KAAK,CAAC,CAAC;KACd;AACF,CAAC,CAAC,CAAC;AAPS,QAAA,WAAW,eAOpB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport http from \"http\";\nimport { Socket } from \"net\";\n\nexport interface ITrackedHttpServer {\n\treadonly server: http.Server;\n\treadonly sockets: Set<Socket>;\n\tfullyClose(): void;\n}\nexport function createTrackedServer(\n\tport: number,\n\trequestListener: http.RequestListener,\n): ITrackedHttpServer {\n\tconst server = http.createServer(requestListener).listen(port);\n\tconst sockets = new Set<Socket>();\n\n\tserver.on(\"connection\", (socket) => {\n\t\tsockets.add(socket);\n\t\tsocket.on(\"close\", () => sockets.delete(socket));\n\t});\n\n\treturn {\n\t\tserver,\n\t\tsockets,\n\t\tfullyClose() {\n\t\t\tserver.close();\n\t\t\tsockets.forEach((socket) => socket.destroy());\n\t\t},\n\t};\n}\nexport type OnceListenerHandler<T> = (\n\treq: http.IncomingMessage,\n\tres: http.ServerResponse,\n) => Promise<T>;\nexport type OnceListenerResult<T> = Promise<() => Promise<T>>;\nexport const serverListenAndHandle = async <T>(\n\tport: number,\n\thandler: OnceListenerHandler<T>,\n): OnceListenerResult<T> =>\n\t// eslint-disable-next-line promise/param-names\n\tnew Promise((outerResolve, outerReject) => {\n\t\t// eslint-disable-next-line promise/param-names\n\t\tconst innerP = new Promise<T>((innerResolve, innerReject) => {\n\t\t\tconst httpServer = createTrackedServer(port, (req, res) => {\n\t\t\t\t// ignore favicon\n\t\t\t\tif (req.url === \"/favicon.ico\") {\n\t\t\t\t\tres.writeHead(200, { \"Content-Type\": \"image/x-icon\" });\n\t\t\t\t\tres.end();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\thandler(req, res)\n\t\t\t\t\t.finally(() => httpServer.fullyClose())\n\t\t\t\t\t.then(\n\t\t\t\t\t\t(result) => innerResolve(result),\n\t\t\t\t\t\t(error) => innerReject(error),\n\t\t\t\t\t);\n\t\t\t});\n\t\t\touterResolve(async () => innerP);\n\t\t});\n\t});\n\nexport const endResponse = async (response: http.ServerResponse): Promise<void> =>\n\tnew Promise((resolve, reject) => {\n\t\ttry {\n\t\t\tresponse.end(resolve);\n\t\t} catch (error) {\n\t\t\treject(error);\n\t\t}\n\t});\n"]}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export * from "./fluidToolRC";
6
- export * from "./odspTokenManager";
7
- export * from "./snapshotNormalizer";
5
+ export { IAsyncCache, IResources, loadRC, lockRC, saveRC } from "./fluidToolRC";
6
+ export { getMicrosoftConfiguration, IOdspTokenManagerCacheKey, OdspTokenConfig, OdspTokenManager, odspTokensCache, } from "./odspTokenManager";
7
+ export { gcBlobPrefix, getNormalizedSnapshot, ISnapshotNormalizerConfig, } from "./snapshotNormalizer";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EACN,yBAAyB,EACzB,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,eAAe,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,GACzB,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -3,18 +3,17 @@
3
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
4
  * Licensed under the MIT License.
5
5
  */
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
6
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./fluidToolRC"), exports);
18
- __exportStar(require("./odspTokenManager"), exports);
19
- __exportStar(require("./snapshotNormalizer"), exports);
7
+ exports.getNormalizedSnapshot = exports.gcBlobPrefix = exports.odspTokensCache = exports.OdspTokenManager = exports.getMicrosoftConfiguration = exports.saveRC = exports.lockRC = exports.loadRC = void 0;
8
+ var fluidToolRC_1 = require("./fluidToolRC");
9
+ Object.defineProperty(exports, "loadRC", { enumerable: true, get: function () { return fluidToolRC_1.loadRC; } });
10
+ Object.defineProperty(exports, "lockRC", { enumerable: true, get: function () { return fluidToolRC_1.lockRC; } });
11
+ Object.defineProperty(exports, "saveRC", { enumerable: true, get: function () { return fluidToolRC_1.saveRC; } });
12
+ var odspTokenManager_1 = require("./odspTokenManager");
13
+ Object.defineProperty(exports, "getMicrosoftConfiguration", { enumerable: true, get: function () { return odspTokenManager_1.getMicrosoftConfiguration; } });
14
+ Object.defineProperty(exports, "OdspTokenManager", { enumerable: true, get: function () { return odspTokenManager_1.OdspTokenManager; } });
15
+ Object.defineProperty(exports, "odspTokensCache", { enumerable: true, get: function () { return odspTokenManager_1.odspTokensCache; } });
16
+ var snapshotNormalizer_1 = require("./snapshotNormalizer");
17
+ Object.defineProperty(exports, "gcBlobPrefix", { enumerable: true, get: function () { return snapshotNormalizer_1.gcBlobPrefix; } });
18
+ Object.defineProperty(exports, "getNormalizedSnapshot", { enumerable: true, get: function () { return snapshotNormalizer_1.getNormalizedSnapshot; } });
20
19
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,gDAA8B;AAC9B,qDAAmC;AACnC,uDAAqC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport * from \"./fluidToolRC\";\nexport * from \"./odspTokenManager\";\nexport * from \"./snapshotNormalizer\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6CAAgF;AAA9C,qGAAA,MAAM,OAAA;AAAE,qGAAA,MAAM,OAAA;AAAE,qGAAA,MAAM,OAAA;AACxD,uDAM4B;AAL3B,6HAAA,yBAAyB,OAAA;AAGzB,oHAAA,gBAAgB,OAAA;AAChB,mHAAA,eAAe,OAAA;AAEhB,2DAI8B;AAH7B,kHAAA,YAAY,OAAA;AACZ,2HAAA,qBAAqB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { IAsyncCache, IResources, loadRC, lockRC, saveRC } from \"./fluidToolRC\";\nexport {\n\tgetMicrosoftConfiguration,\n\tIOdspTokenManagerCacheKey,\n\tOdspTokenConfig,\n\tOdspTokenManager,\n\todspTokensCache,\n} from \"./odspTokenManager\";\nexport {\n\tgcBlobPrefix,\n\tgetNormalizedSnapshot,\n\tISnapshotNormalizerConfig,\n} from \"./snapshotNormalizer\";\n"]}
@@ -4,8 +4,14 @@
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;
8
- export declare type OdspTokenConfig = {
11
+ /**
12
+ * @internal
13
+ */
14
+ export type OdspTokenConfig = {
9
15
  type: "password";
10
16
  username: string;
11
17
  password: string;
@@ -14,10 +20,16 @@ export declare 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,EACH,WAAW,EACX,aAAa,EAOhB,MAAM,mCAAmC,CAAC;AAI3C,OAAO,EAAE,WAAW,EAA0B,MAAM,eAAe,CAAC;AAOpE,eAAO,MAAM,yBAAyB,QAAO,aAa3C,CAAC;AAEH,oBAAY,e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