@fluid-tools/fetch-tool 0.53.0-46105

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 (41) hide show
  1. package/.eslintrc.js +17 -0
  2. package/LICENSE +21 -0
  3. package/README.md +114 -0
  4. package/bin/fluid-fetch +2 -0
  5. package/dist/fluidAnalyzeMessages.d.ts +8 -0
  6. package/dist/fluidAnalyzeMessages.d.ts.map +1 -0
  7. package/dist/fluidAnalyzeMessages.js +598 -0
  8. package/dist/fluidAnalyzeMessages.js.map +1 -0
  9. package/dist/fluidFetch.d.ts +6 -0
  10. package/dist/fluidFetch.d.ts.map +1 -0
  11. package/dist/fluidFetch.js +119 -0
  12. package/dist/fluidFetch.js.map +1 -0
  13. package/dist/fluidFetchArgs.d.ts +35 -0
  14. package/dist/fluidFetchArgs.d.ts.map +1 -0
  15. package/dist/fluidFetchArgs.js +206 -0
  16. package/dist/fluidFetchArgs.js.map +1 -0
  17. package/dist/fluidFetchInit.d.ts +9 -0
  18. package/dist/fluidFetchInit.d.ts.map +1 -0
  19. package/dist/fluidFetchInit.js +161 -0
  20. package/dist/fluidFetchInit.js.map +1 -0
  21. package/dist/fluidFetchMessages.d.ts +7 -0
  22. package/dist/fluidFetchMessages.d.ts.map +1 -0
  23. package/dist/fluidFetchMessages.js +264 -0
  24. package/dist/fluidFetchMessages.js.map +1 -0
  25. package/dist/fluidFetchSharePoint.d.ts +10 -0
  26. package/dist/fluidFetchSharePoint.d.ts.map +1 -0
  27. package/dist/fluidFetchSharePoint.js +95 -0
  28. package/dist/fluidFetchSharePoint.js.map +1 -0
  29. package/dist/fluidFetchSnapshot.d.ts +7 -0
  30. package/dist/fluidFetchSnapshot.d.ts.map +1 -0
  31. package/dist/fluidFetchSnapshot.js +289 -0
  32. package/dist/fluidFetchSnapshot.js.map +1 -0
  33. package/package.json +65 -0
  34. package/src/fluidAnalyzeMessages.ts +687 -0
  35. package/src/fluidFetch.ts +123 -0
  36. package/src/fluidFetchArgs.ts +224 -0
  37. package/src/fluidFetchInit.ts +168 -0
  38. package/src/fluidFetchMessages.ts +280 -0
  39. package/src/fluidFetchSharePoint.ts +141 -0
  40. package/src/fluidFetchSnapshot.ts +383 -0
  41. package/tsconfig.json +17 -0
package/.eslintrc.js ADDED
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ module.exports = {
7
+ "extends": [
8
+ "@fluidframework/eslint-config-fluid/eslint7"
9
+ ],
10
+ "rules": {
11
+ "@typescript-eslint/no-use-before-define": "off",
12
+ "@typescript-eslint/strict-boolean-expressions": "off",
13
+ "no-null/no-null": "off",
14
+ "prefer-arrow/prefer-arrow-functions": "off",
15
+ "import/no-internal-modules": "off"
16
+ }
17
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) Microsoft Corporation and contributors. All rights reserved.
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,114 @@
1
+ # @fluid-tools/fetch-tool
2
+
3
+ Connection using ODSP or routerlicious driver to dump the messages or snapshot information on the server.
4
+ In order to connect to ODSP, the clientID and clientSecret must be set as environment variables login__microsoft__clientId and login__microsoft__secret, respectively. If you have access to the keyvault this can be done by running [this tool](../../../tools/getkeys).
5
+
6
+ ## Usage
7
+
8
+ Usage: fluid-fetch [options] "URL"
9
+ URL: <ODSP joinSession URL>|<Routerlicious URL>
10
+ Options:
11
+ --dump:rawmessage : dump all messages
12
+ --dump:rawmessage:overwrite : dump all messages and overwrite existing messages.json
13
+ --dump:snapshotVersion : dump a list of snapshot version
14
+ --dump:snapshotTree : dump the snapshot trees
15
+ --dump:snapshotBlob : dump the contents of snapshot blobs
16
+ --forceRefreshToken : Force refresh token (SPO only)
17
+ --stat:message : show a table of message type counts and size
18
+ --stat:snapshot : show a table of snapshot path and blob size
19
+ --stat:dataType : show a table of data type
20
+ --stat:channel : show a table of channel
21
+ --filter:messageType <type> : filter message by <type>
22
+ --jwt <token> : token to be used for routerlicious URLs
23
+ --numSnapshotVersions <number> : Number of versions to load (default:10)
24
+ --snapshotVersionIndex <number> : Index of the version to dump
25
+ --saveDir <outdir> : Save data of the snapshots and messages
26
+
27
+ ## Example Output
28
+
29
+ ### Messages Stats
30
+
31
+ **--stat:message**
32
+
33
+ 105 total messages (103 delta storage, 2 initial ws messages, 0 dup)
34
+ Message Type (All) | Count Bytes
35
+ ----------------------------------------------------------------------------------------------------
36
+ join | 19 7588
37
+ propose | 1 269
38
+ noop | 15 2806
39
+ attach | 1 278
40
+ op | 53 23854
41
+ leave | 16 3810
42
+ ----------------------------------------------------------------------------------------------------
43
+ Total | 105 38605
44
+
45
+
46
+ **--stat:dataType**
47
+
48
+ 107 total messages (105 delta storage, 2 initial ws messages, 0 dup)
49
+ Data Type (Operations only) | Count Bytes
50
+ ----------------------------------------------------------------------------------------------------
51
+ map | 28 13172
52
+ mergeTree | 20 7450
53
+ ----------------------------------------------------------------------------------------------------
54
+ Total | 48 20622
55
+
56
+ **--stat:channel**
57
+
58
+ 109 total messages (107 delta storage, 2 initial ws messages, 0 dup)
59
+ Channel name (Operations only) | Count Bytes
60
+ ----------------------------------------------------------------------------------------------------
61
+ [defaultDataStore]/root (map) | 3 1232
62
+ [defaultDataStore]/0fb26504-369f-4234-ad97-0a303d3ec81f (map) | 0 0
63
+ [defaultDataStore]/74577601-3af5-49a1-9ca5-db5d9ee128a8 (mergeTree) | 20 7450
64
+ [defaultDataStore]/91ac6df2-dda6-409a-b5e3-be84ce9ab138 (map) | 25 11940
65
+ [defaultDataStore]/92ebb388-68a0-4fc2-859e-5c01f12e992d (map) | 0 0
66
+ ----------------------------------------------------------------------------------------------------
67
+ Total | 48 20622
68
+
69
+ ### Snapshot Stats
70
+
71
+ **--stat:snapshot**
72
+
73
+ Blob Path | Bytes
74
+ ----------------------------------------------------------------------------------------------------
75
+ !CONTAINER!/.attributes | 156
76
+ !CONTAINER!/.blobs | 4
77
+ !CONTAINER!/.gitmodules | 140
78
+ !CONTAINER!/deltas | 872
79
+ !CONTAINER!/quorumMembers | 220
80
+ !CONTAINER!/quorumProposals | 4
81
+ !CONTAINER!/quorumValues | 184
82
+ [defaultDataStore]/.component | 32
83
+ [defaultDataStore]/0fb26504-369f-4234-ad97-0a303d3ec81f/.attributes | 64
84
+ [defaultDataStore]/0fb26504-369f-4234-ad97-0a303d3ec81f/header | 4
85
+ [defaultDataStore]/74577601-3af5-49a1-9ca5-db5d9ee128a8/.attributes | 72
86
+ [defaultDataStore]/74577601-3af5-49a1-9ca5-db5d9ee128a8/content/header | 448
87
+ [defaultDataStore]/74577601-3af5-49a1-9ca5-db5d9ee128a8/content/catchupOps | 4
88
+ [defaultDataStore]/74577601-3af5-49a1-9ca5-db5d9ee128a8/header | 180
89
+ [defaultDataStore]/91ac6df2-dda6-409a-b5e3-be84ce9ab138/.attributes | 64
90
+ [defaultDataStore]/91ac6df2-dda6-409a-b5e3-be84ce9ab138/header | 168
91
+ [defaultDataStore]/92ebb388-68a0-4fc2-859e-5c01f12e992d/.attributes | 64
92
+ [defaultDataStore]/92ebb388-68a0-4fc2-859e-5c01f12e992d/header | 4
93
+ [defaultDataStore]/root/.attributes | 64
94
+ [defaultDataStore]/root/header | 300
95
+ ----------------------------------------------------------------------------------------------------
96
+ Total snapshot size | 3048
97
+
98
+ ## Debugging
99
+
100
+ If you would like to debug fetch-tool, you can create a unit test. Remember to add tsconfig.json and list mocha in devDependencies.
101
+
102
+ In the unit test, you can use `setArguments()` from fluidFetchArgs to pass in arguments you want to test. Then call the methods you want to run and you will be able to set breakpoints in vscode.
103
+
104
+ **Example**
105
+ ```js
106
+ describe("fetch tool", () => {
107
+ it("can fetch messages", async () => {
108
+ fluidFetchArgs.setArguments(your_args);
109
+ const documentService = await fluidFetchInit(your_paramURL);
110
+ await fluidFetchMessages(documentService, your_saveDir);
111
+ });
112
+ });
113
+ ```
114
+
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/fluidFetch.js');
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export declare const formatNumber: (num: number) => string;
6
+ export declare function printMessageStats(generator: any, // AsyncGenerator<ISequencedDocumentMessage[]>,
7
+ dumpMessageStats: boolean, dumpMessages: boolean, messageTypeFilter?: Set<string>): Promise<void>;
8
+ //# sourceMappingURL=fluidAnalyzeMessages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fluidAnalyzeMessages.d.ts","sourceRoot":"","sources":["../src/fluidAnalyzeMessages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwEH,eAAO,MAAM,YAAY,QAAS,MAAM,KAAG,MAA8D,CAAC;AA8V1G,wBAAsB,iBAAiB,CACnC,SAAS,KAAA,EAAE,+CAA+C;AAC1D,gBAAgB,EAAE,OAAO,EACzB,YAAY,EAAE,OAAO,EACrB,iBAAiB,GAAE,GAAG,CAAC,MAAM,CAAqB,iBAwCrD"}