@fgv/ts-web-extras 5.1.0-2 → 5.1.0-21

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 (263) hide show
  1. package/dist/packlets/crypto-utils/browserCryptoProvider.js +208 -18
  2. package/dist/packlets/crypto-utils/browserCryptoProvider.js.map +1 -1
  3. package/dist/packlets/file-tree/fileApiTreeAccessors.js +1 -1
  4. package/dist/packlets/file-tree/fileApiTreeAccessors.js.map +1 -1
  5. package/dist/packlets/file-tree/httpTreeAccessors.js +72 -42
  6. package/dist/packlets/file-tree/httpTreeAccessors.js.map +1 -1
  7. package/dist/ts-web-extras.d.ts +59 -7
  8. package/dist/tsdoc-metadata.json +1 -1
  9. package/lib/packlets/crypto-utils/browserCryptoProvider.d.ts +52 -5
  10. package/lib/packlets/crypto-utils/browserCryptoProvider.d.ts.map +1 -1
  11. package/lib/packlets/crypto-utils/browserCryptoProvider.js +207 -17
  12. package/lib/packlets/crypto-utils/browserCryptoProvider.js.map +1 -1
  13. package/lib/packlets/file-tree/fileApiTreeAccessors.d.ts +1 -1
  14. package/lib/packlets/file-tree/fileApiTreeAccessors.js +1 -1
  15. package/lib/packlets/file-tree/fileApiTreeAccessors.js.map +1 -1
  16. package/lib/packlets/file-tree/httpTreeAccessors.d.ts +6 -0
  17. package/lib/packlets/file-tree/httpTreeAccessors.d.ts.map +1 -1
  18. package/lib/packlets/file-tree/httpTreeAccessors.js +72 -42
  19. package/lib/packlets/file-tree/httpTreeAccessors.js.map +1 -1
  20. package/package.json +27 -26
  21. package/.rush/temp/chunked-rush-logs/ts-web-extras.build.chunks.jsonl +0 -75
  22. package/.rush/temp/chunked-rush-logs/ts-web-extras.test.chunks.jsonl +0 -75
  23. package/.rush/temp/operation/build/all.log +0 -75
  24. package/.rush/temp/operation/build/error.log +0 -18
  25. package/.rush/temp/operation/build/log-chunks.jsonl +0 -75
  26. package/.rush/temp/operation/build/state.json +0 -3
  27. package/.rush/temp/operation/test/all.log +0 -75
  28. package/.rush/temp/operation/test/error.log +0 -18
  29. package/.rush/temp/operation/test/log-chunks.jsonl +0 -75
  30. package/.rush/temp/operation/test/state.json +0 -3
  31. package/.rush/temp/shrinkwrap-deps.json +0 -635
  32. package/CHANGELOG.md +0 -23
  33. package/config/api-extractor.json +0 -343
  34. package/config/jest.config.json +0 -19
  35. package/config/rig.json +0 -16
  36. package/config/typedoc.json +0 -6
  37. package/dist/test/mocks/idb-keyval.js +0 -6
  38. package/dist/test/mocks/idb-keyval.js.map +0 -1
  39. package/dist/test/setupTests.js +0 -74
  40. package/dist/test/setupTests.js.map +0 -1
  41. package/dist/test/unit/browserHashProvider.test.js +0 -140
  42. package/dist/test/unit/browserHashProvider.test.js.map +0 -1
  43. package/dist/test/unit/directoryHandleStore.test.js +0 -190
  44. package/dist/test/unit/directoryHandleStore.test.js.map +0 -1
  45. package/dist/test/unit/fileApiTreeAccessors.test.js +0 -1188
  46. package/dist/test/unit/fileApiTreeAccessors.test.js.map +0 -1
  47. package/dist/test/unit/fileApiTypes.test.js +0 -472
  48. package/dist/test/unit/fileApiTypes.test.js.map +0 -1
  49. package/dist/test/unit/fileSystemAccessTreeAccessors.test.js +0 -622
  50. package/dist/test/unit/fileSystemAccessTreeAccessors.test.js.map +0 -1
  51. package/dist/test/unit/fileTreeHelpers.test.js +0 -590
  52. package/dist/test/unit/fileTreeHelpers.test.js.map +0 -1
  53. package/dist/test/unit/httpTreeAccessors.test.js +0 -1229
  54. package/dist/test/unit/httpTreeAccessors.test.js.map +0 -1
  55. package/dist/test/unit/localStorageTreeAccessors.test.js +0 -812
  56. package/dist/test/unit/localStorageTreeAccessors.test.js.map +0 -1
  57. package/dist/test/unit/urlParams.test.js +0 -393
  58. package/dist/test/unit/urlParams.test.js.map +0 -1
  59. package/dist/test/utils/fileSystemAccessMocks.js +0 -271
  60. package/dist/test/utils/fileSystemAccessMocks.js.map +0 -1
  61. package/dist/test/utils/testHelpers.js +0 -124
  62. package/dist/test/utils/testHelpers.js.map +0 -1
  63. package/docs/@fgv/namespaces/CryptoUtils/README.md +0 -18
  64. package/docs/@fgv/namespaces/CryptoUtils/classes/BrowserCryptoProvider.md +0 -203
  65. package/docs/@fgv/namespaces/CryptoUtils/classes/BrowserHashProvider.md +0 -63
  66. package/docs/@fgv/namespaces/CryptoUtils/functions/createBrowserCryptoProvider.md +0 -18
  67. package/docs/@fgv/namespaces/FileTreeHelpers/README.md +0 -19
  68. package/docs/@fgv/namespaces/FileTreeHelpers/functions/extractFileListMetadata.md +0 -23
  69. package/docs/@fgv/namespaces/FileTreeHelpers/functions/extractFileMetadata.md +0 -23
  70. package/docs/@fgv/namespaces/FileTreeHelpers/functions/fromDirectoryUpload.md +0 -33
  71. package/docs/@fgv/namespaces/FileTreeHelpers/functions/fromFileList.md +0 -33
  72. package/docs/@fgv/namespaces/FileTreeHelpers/functions/getOriginalFile.md +0 -25
  73. package/docs/@fgv/namespaces/FileTreeHelpers/variables/defaultFileApiTreeInitParams.md +0 -11
  74. package/docs/README.md +0 -78
  75. package/docs/classes/DirectoryHandleStore.md +0 -116
  76. package/docs/classes/FileApiTreeAccessors.md +0 -286
  77. package/docs/classes/FileSystemAccessTreeAccessors.md +0 -557
  78. package/docs/classes/HttpTreeAccessors.md +0 -508
  79. package/docs/classes/LocalStorageTreeAccessors.md +0 -520
  80. package/docs/functions/exportAsJson.md +0 -23
  81. package/docs/functions/exportUsingFileSystemAPI.md +0 -26
  82. package/docs/functions/extractDirectoryPath.md +0 -23
  83. package/docs/functions/isDirectoryHandle.md +0 -23
  84. package/docs/functions/isFileHandle.md +0 -23
  85. package/docs/functions/isFilePath.md +0 -21
  86. package/docs/functions/parseContextFilter.md +0 -22
  87. package/docs/functions/parseQualifierDefaults.md +0 -22
  88. package/docs/functions/parseResourceTypes.md +0 -22
  89. package/docs/functions/parseUrlParameters.md +0 -15
  90. package/docs/functions/safeShowDirectoryPicker.md +0 -24
  91. package/docs/functions/safeShowOpenFilePicker.md +0 -24
  92. package/docs/functions/safeShowSaveFilePicker.md +0 -24
  93. package/docs/functions/supportsFileSystemAccess.md +0 -23
  94. package/docs/interfaces/FilePickerAcceptType.md +0 -16
  95. package/docs/interfaces/FileSystemCreateWritableOptions.md +0 -15
  96. package/docs/interfaces/FileSystemDirectoryHandle.md +0 -187
  97. package/docs/interfaces/FileSystemFileHandle.md +0 -106
  98. package/docs/interfaces/FileSystemGetDirectoryOptions.md +0 -15
  99. package/docs/interfaces/FileSystemGetFileOptions.md +0 -15
  100. package/docs/interfaces/FileSystemHandle.md +0 -69
  101. package/docs/interfaces/FileSystemHandlePermissionDescriptor.md +0 -15
  102. package/docs/interfaces/FileSystemRemoveOptions.md +0 -15
  103. package/docs/interfaces/FileSystemWritableFileStream.md +0 -127
  104. package/docs/interfaces/IDirectoryHandleTreeInitializer.md +0 -17
  105. package/docs/interfaces/IFileHandleTreeInitializer.md +0 -16
  106. package/docs/interfaces/IFileListTreeInitializer.md +0 -15
  107. package/docs/interfaces/IFileMetadata.md +0 -19
  108. package/docs/interfaces/IFileSystemAccessTreeParams.md +0 -30
  109. package/docs/interfaces/IFsAccessApis.md +0 -57
  110. package/docs/interfaces/IHttpTreeParams.md +0 -32
  111. package/docs/interfaces/ILocalStorageTreeParams.md +0 -30
  112. package/docs/interfaces/IUrlConfigOptions.md +0 -27
  113. package/docs/interfaces/ShowDirectoryPickerOptions.md +0 -17
  114. package/docs/interfaces/ShowOpenFilePickerOptions.md +0 -19
  115. package/docs/interfaces/ShowSaveFilePickerOptions.md +0 -19
  116. package/docs/type-aliases/TreeInitializer.md +0 -11
  117. package/docs/type-aliases/WellKnownDirectory.md +0 -11
  118. package/docs/type-aliases/WindowWithFsAccess.md +0 -11
  119. package/docs/variables/DEFAULT_DIRECTORY_HANDLE_DB.md +0 -11
  120. package/docs/variables/DEFAULT_DIRECTORY_HANDLE_STORE.md +0 -11
  121. package/etc/ts-web-extras.api.md +0 -433
  122. package/lib/test/mocks/idb-keyval.d.ts +0 -6
  123. package/lib/test/mocks/idb-keyval.d.ts.map +0 -1
  124. package/lib/test/mocks/idb-keyval.js +0 -9
  125. package/lib/test/mocks/idb-keyval.js.map +0 -1
  126. package/lib/test/setupTests.d.ts +0 -2
  127. package/lib/test/setupTests.d.ts.map +0 -1
  128. package/lib/test/setupTests.js +0 -76
  129. package/lib/test/setupTests.js.map +0 -1
  130. package/lib/test/unit/browserHashProvider.test.d.ts +0 -2
  131. package/lib/test/unit/browserHashProvider.test.d.ts.map +0 -1
  132. package/lib/test/unit/browserHashProvider.test.js +0 -142
  133. package/lib/test/unit/browserHashProvider.test.js.map +0 -1
  134. package/lib/test/unit/directoryHandleStore.test.d.ts +0 -2
  135. package/lib/test/unit/directoryHandleStore.test.d.ts.map +0 -1
  136. package/lib/test/unit/directoryHandleStore.test.js +0 -192
  137. package/lib/test/unit/directoryHandleStore.test.js.map +0 -1
  138. package/lib/test/unit/fileApiTreeAccessors.test.d.ts +0 -2
  139. package/lib/test/unit/fileApiTreeAccessors.test.d.ts.map +0 -1
  140. package/lib/test/unit/fileApiTreeAccessors.test.js +0 -1190
  141. package/lib/test/unit/fileApiTreeAccessors.test.js.map +0 -1
  142. package/lib/test/unit/fileApiTypes.test.d.ts +0 -2
  143. package/lib/test/unit/fileApiTypes.test.d.ts.map +0 -1
  144. package/lib/test/unit/fileApiTypes.test.js +0 -474
  145. package/lib/test/unit/fileApiTypes.test.js.map +0 -1
  146. package/lib/test/unit/fileSystemAccessTreeAccessors.test.d.ts +0 -2
  147. package/lib/test/unit/fileSystemAccessTreeAccessors.test.d.ts.map +0 -1
  148. package/lib/test/unit/fileSystemAccessTreeAccessors.test.js +0 -624
  149. package/lib/test/unit/fileSystemAccessTreeAccessors.test.js.map +0 -1
  150. package/lib/test/unit/fileTreeHelpers.test.d.ts +0 -2
  151. package/lib/test/unit/fileTreeHelpers.test.d.ts.map +0 -1
  152. package/lib/test/unit/fileTreeHelpers.test.js +0 -592
  153. package/lib/test/unit/fileTreeHelpers.test.js.map +0 -1
  154. package/lib/test/unit/httpTreeAccessors.test.d.ts +0 -2
  155. package/lib/test/unit/httpTreeAccessors.test.d.ts.map +0 -1
  156. package/lib/test/unit/httpTreeAccessors.test.js +0 -1231
  157. package/lib/test/unit/httpTreeAccessors.test.js.map +0 -1
  158. package/lib/test/unit/localStorageTreeAccessors.test.d.ts +0 -2
  159. package/lib/test/unit/localStorageTreeAccessors.test.d.ts.map +0 -1
  160. package/lib/test/unit/localStorageTreeAccessors.test.js +0 -814
  161. package/lib/test/unit/localStorageTreeAccessors.test.js.map +0 -1
  162. package/lib/test/unit/urlParams.test.d.ts +0 -2
  163. package/lib/test/unit/urlParams.test.d.ts.map +0 -1
  164. package/lib/test/unit/urlParams.test.js +0 -395
  165. package/lib/test/unit/urlParams.test.js.map +0 -1
  166. package/lib/test/utils/fileSystemAccessMocks.d.ts +0 -53
  167. package/lib/test/utils/fileSystemAccessMocks.d.ts.map +0 -1
  168. package/lib/test/utils/fileSystemAccessMocks.js +0 -277
  169. package/lib/test/utils/fileSystemAccessMocks.js.map +0 -1
  170. package/lib/test/utils/testHelpers.d.ts +0 -51
  171. package/lib/test/utils/testHelpers.d.ts.map +0 -1
  172. package/lib/test/utils/testHelpers.js +0 -133
  173. package/lib/test/utils/testHelpers.js.map +0 -1
  174. package/rush-logs/ts-web-extras.build.cache.log +0 -0
  175. package/rush-logs/ts-web-extras.build.error.log +0 -18
  176. package/rush-logs/ts-web-extras.build.log +0 -75
  177. package/rush-logs/ts-web-extras.test.cache.log +0 -1
  178. package/rush-logs/ts-web-extras.test.error.log +0 -18
  179. package/rush-logs/ts-web-extras.test.log +0 -75
  180. package/src/index.browser.ts +0 -24
  181. package/src/index.ts +0 -47
  182. package/src/packlets/crypto-utils/browserCryptoProvider.ts +0 -311
  183. package/src/packlets/crypto-utils/browserHashProvider.ts +0 -73
  184. package/src/packlets/crypto-utils/index.ts +0 -29
  185. package/src/packlets/file-api-types/index.ts +0 -366
  186. package/src/packlets/file-tree/directoryHandleStore.ts +0 -136
  187. package/src/packlets/file-tree/fileApiTreeAccessors.ts +0 -528
  188. package/src/packlets/file-tree/fileSystemAccessTreeAccessors.ts +0 -519
  189. package/src/packlets/file-tree/httpTreeAccessors.ts +0 -448
  190. package/src/packlets/file-tree/index.ts +0 -32
  191. package/src/packlets/file-tree/localStorageTreeAccessors.ts +0 -430
  192. package/src/packlets/helpers/fileTreeHelpers.ts +0 -107
  193. package/src/packlets/helpers/index.ts +0 -28
  194. package/src/packlets/url-utils/index.ts +0 -28
  195. package/src/packlets/url-utils/urlParams.ts +0 -245
  196. package/src/test/mocks/idb-keyval.ts +0 -5
  197. package/src/test/setupTests.ts +0 -87
  198. package/src/test/unit/browserHashProvider.test.ts +0 -155
  199. package/src/test/unit/browserHashProvider.test.ts.bak +0 -376
  200. package/src/test/unit/directoryHandleStore.test.ts +0 -251
  201. package/src/test/unit/fileApiTreeAccessors.test.ts +0 -1387
  202. package/src/test/unit/fileApiTypes.test.ts +0 -587
  203. package/src/test/unit/fileSystemAccessTreeAccessors.test.ts +0 -885
  204. package/src/test/unit/fileTreeHelpers.test.ts +0 -694
  205. package/src/test/unit/httpTreeAccessors.test.ts +0 -1571
  206. package/src/test/unit/localStorageTreeAccessors.test.ts +0 -1014
  207. package/src/test/unit/urlParams.test.ts +0 -464
  208. package/src/test/utils/fileSystemAccessMocks.ts +0 -353
  209. package/src/test/utils/testHelpers.ts +0 -155
  210. package/temp/build/typescript/ts_8nwakTlr.json +0 -1
  211. package/temp/coverage/base.css +0 -224
  212. package/temp/coverage/block-navigation.js +0 -87
  213. package/temp/coverage/crypto/browserHashProvider.ts.html +0 -304
  214. package/temp/coverage/crypto/index.html +0 -116
  215. package/temp/coverage/crypto-utils/browserCryptoProvider.ts.html +0 -1018
  216. package/temp/coverage/crypto-utils/browserHashProvider.ts.html +0 -304
  217. package/temp/coverage/crypto-utils/index.html +0 -131
  218. package/temp/coverage/favicon.png +0 -0
  219. package/temp/coverage/file-tree/directoryHandleStore.ts.html +0 -493
  220. package/temp/coverage/file-tree/fileApiTreeAccessors.ts.html +0 -1669
  221. package/temp/coverage/file-tree/fileSystemAccessTreeAccessors.ts.html +0 -1642
  222. package/temp/coverage/file-tree/httpTreeAccessors.ts.html +0 -1429
  223. package/temp/coverage/file-tree/index.html +0 -176
  224. package/temp/coverage/file-tree/localStorageTreeAccessors.ts.html +0 -1375
  225. package/temp/coverage/helpers/fileTreeHelpers.ts.html +0 -406
  226. package/temp/coverage/helpers/index.html +0 -116
  227. package/temp/coverage/index.html +0 -161
  228. package/temp/coverage/lcov-report/base.css +0 -224
  229. package/temp/coverage/lcov-report/block-navigation.js +0 -87
  230. package/temp/coverage/lcov-report/crypto/browserHashProvider.ts.html +0 -304
  231. package/temp/coverage/lcov-report/crypto/index.html +0 -116
  232. package/temp/coverage/lcov-report/crypto-utils/browserCryptoProvider.ts.html +0 -1018
  233. package/temp/coverage/lcov-report/crypto-utils/browserHashProvider.ts.html +0 -304
  234. package/temp/coverage/lcov-report/crypto-utils/index.html +0 -131
  235. package/temp/coverage/lcov-report/favicon.png +0 -0
  236. package/temp/coverage/lcov-report/file-tree/directoryHandleStore.ts.html +0 -493
  237. package/temp/coverage/lcov-report/file-tree/fileApiTreeAccessors.ts.html +0 -1669
  238. package/temp/coverage/lcov-report/file-tree/fileSystemAccessTreeAccessors.ts.html +0 -1642
  239. package/temp/coverage/lcov-report/file-tree/httpTreeAccessors.ts.html +0 -1429
  240. package/temp/coverage/lcov-report/file-tree/index.html +0 -176
  241. package/temp/coverage/lcov-report/file-tree/localStorageTreeAccessors.ts.html +0 -1375
  242. package/temp/coverage/lcov-report/helpers/fileTreeHelpers.ts.html +0 -406
  243. package/temp/coverage/lcov-report/helpers/index.html +0 -116
  244. package/temp/coverage/lcov-report/index.html +0 -161
  245. package/temp/coverage/lcov-report/prettify.css +0 -1
  246. package/temp/coverage/lcov-report/prettify.js +0 -2
  247. package/temp/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  248. package/temp/coverage/lcov-report/sorter.js +0 -210
  249. package/temp/coverage/lcov-report/url-utils/index.html +0 -116
  250. package/temp/coverage/lcov-report/url-utils/urlParams.ts.html +0 -820
  251. package/temp/coverage/lcov.info +0 -3597
  252. package/temp/coverage/prettify.css +0 -1
  253. package/temp/coverage/prettify.js +0 -2
  254. package/temp/coverage/sort-arrow-sprite.png +0 -0
  255. package/temp/coverage/sorter.js +0 -210
  256. package/temp/coverage/url-utils/index.html +0 -116
  257. package/temp/coverage/url-utils/urlParams.ts.html +0 -820
  258. package/temp/test/jest/haste-map-b931e4e63102f86c5bd4949f7dced44f-9d713eb41149188b4e5c0ae3d86d0a57-2ad8e16b24e391b8cdbe50b55c137169 +0 -0
  259. package/temp/test/jest/jest-transform-cache-b931e4e63102f86c5bd4949f7dced44f-79ef2876fae7ca75eedb2aa53dc48338/b5/package_b5f57afc9ec2c011239b1608ee5bdfa5 +0 -53
  260. package/temp/test/jest/perf-cache-b931e4e63102f86c5bd4949f7dced44f-da39a3ee5e6b4b0d3255bfef95601890 +0 -1
  261. package/temp/ts-web-extras.api.json +0 -8850
  262. package/temp/ts-web-extras.api.md +0 -433
  263. package/tsconfig.json +0 -7
package/CHANGELOG.md DELETED
@@ -1,23 +0,0 @@
1
- # Change Log - @fgv/ts-web-extras
2
-
3
- This log was last generated on Wed, 17 Dec 2025 18:08:09 GMT and should not be manually modified.
4
-
5
- ## 5.0.2
6
- Wed, 17 Dec 2025 18:08:09 GMT
7
-
8
- ### Updates
9
-
10
- - dual-publish
11
-
12
- ## 5.0.1
13
- Tue, 23 Sep 2025 03:13:55 GMT
14
-
15
- _Version update only_
16
-
17
- ## 5.0.0
18
- Tue, 23 Sep 2025 02:52:31 GMT
19
-
20
- ### Updates
21
-
22
- - initial checkin
23
-
@@ -1,343 +0,0 @@
1
- /**
2
- * Config file for API Extractor. For more info, please visit: https://api-extractor.com
3
- */
4
- {
5
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
6
- /**
7
- * Optionally specifies another JSON config file that this file extends from. This provides a way for
8
- * standard settings to be shared across multiple projects.
9
- *
10
- * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains
11
- * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be
12
- * resolved using NodeJS require().
13
- *
14
- * SUPPORTED TOKENS: none
15
- * DEFAULT VALUE: ""
16
- */
17
- // "extends": "./shared/api-extractor-base.json"
18
- // "extends": "my-package/include/api-extractor-base.json"
19
- /**
20
- * Determines the "<projectFolder>" token that can be used with other config file settings. The project folder
21
- * typically contains the tsconfig.json and package.json config files, but the path is user-defined.
22
- *
23
- * The path is resolved relative to the folder of the config file that contains the setting.
24
- *
25
- * The default value for "projectFolder" is the token "<lookup>", which means the folder is determined by traversing
26
- * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder
27
- * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error
28
- * will be reported.
29
- *
30
- * SUPPORTED TOKENS: <lookup>
31
- * DEFAULT VALUE: "<lookup>"
32
- */
33
- "projectFolder": "..",
34
- /**
35
- * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
36
- * analyzes the symbols exported by this module.
37
- *
38
- * The file extension must be ".d.ts" and not ".ts".
39
- *
40
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
41
- * prepend a folder token such as "<projectFolder>".
42
- *
43
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
44
- */
45
- "mainEntryPointFilePath": "<projectFolder>/lib/index.d.ts",
46
- /**
47
- * A list of NPM package names whose exports should be treated as part of this package.
48
- *
49
- * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1",
50
- * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part
51
- * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly
52
- * imports library2. To avoid this, we can specify:
53
- *
54
- * "bundledPackages": [ "library2" ],
55
- *
56
- * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been
57
- * local files for library1.
58
- */
59
- "bundledPackages": [],
60
- /**
61
- * Determines how the TypeScript compiler engine will be invoked by API Extractor.
62
- */
63
- "compiler": {
64
- /**
65
- * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.
66
- *
67
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
68
- * prepend a folder token such as "<projectFolder>".
69
- *
70
- * Note: This setting will be ignored if "overrideTsconfig" is used.
71
- *
72
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
73
- * DEFAULT VALUE: "<projectFolder>/tsconfig.json"
74
- */
75
- // "tsconfigFilePath": "<projectFolder>/tsconfig.json",
76
- /**
77
- * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
78
- * The object must conform to the TypeScript tsconfig schema:
79
- *
80
- * http://json.schemastore.org/tsconfig
81
- *
82
- * If omitted, then the tsconfig.json file will be read from the "projectFolder".
83
- *
84
- * DEFAULT VALUE: no overrideTsconfig section
85
- */
86
- // "overrideTsconfig": {
87
- // . . .
88
- // }
89
- /**
90
- * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
91
- * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when
92
- * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses
93
- * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck.
94
- *
95
- * DEFAULT VALUE: false
96
- */
97
- // "skipLibCheck": true,
98
- },
99
- /**
100
- * Configures how the API report file (*.api.md) will be generated.
101
- */
102
- "apiReport": {
103
- /**
104
- * (REQUIRED) Whether to generate an API report.
105
- */
106
- "enabled": true
107
- /**
108
- * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
109
- * a full file path.
110
- *
111
- * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/".
112
- *
113
- * SUPPORTED TOKENS: <packageName>, <unscopedPackageName>
114
- * DEFAULT VALUE: "<unscopedPackageName>.api.md"
115
- */
116
- // "reportFileName": "<unscopedPackageName>.api.md",
117
- /**
118
- * Specifies the folder where the API report file is written. The file name portion is determined by
119
- * the "reportFileName" setting.
120
- *
121
- * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy,
122
- * e.g. for an API review.
123
- *
124
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
125
- * prepend a folder token such as "<projectFolder>".
126
- *
127
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
128
- * DEFAULT VALUE: "<projectFolder>/etc/"
129
- */
130
- // "reportFolder": "<projectFolder>/etc/",
131
- /**
132
- * Specifies the folder where the temporary report file is written. The file name portion is determined by
133
- * the "reportFileName" setting.
134
- *
135
- * After the temporary file is written to disk, it is compared with the file in the "reportFolder".
136
- * If they are different, a production build will fail.
137
- *
138
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
139
- * prepend a folder token such as "<projectFolder>".
140
- *
141
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
142
- * DEFAULT VALUE: "<projectFolder>/temp/"
143
- */
144
- // "reportTempFolder": "<projectFolder>/temp/"
145
- },
146
- /**
147
- * Configures how the doc model file (*.api.json) will be generated.
148
- */
149
- "docModel": {
150
- /**
151
- * (REQUIRED) Whether to generate a doc model file.
152
- */
153
- "enabled": true
154
- /**
155
- * The output path for the doc model file. The file extension should be ".api.json".
156
- *
157
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
158
- * prepend a folder token such as "<projectFolder>".
159
- *
160
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
161
- * DEFAULT VALUE: "<projectFolder>/temp/<unscopedPackageName>.api.json"
162
- */
163
- // "apiJsonFilePath": "<projectFolder>/temp/<unscopedPackageName>.api.json"
164
- },
165
- /**
166
- * Configures how the .d.ts rollup file will be generated.
167
- */
168
- "dtsRollup": {
169
- /**
170
- * (REQUIRED) Whether to generate the .d.ts rollup file.
171
- */
172
- "enabled": true
173
- /**
174
- * Specifies the output path for a .d.ts rollup file to be generated without any trimming.
175
- * This file will include all declarations that are exported by the main entry point.
176
- *
177
- * If the path is an empty string, then this file will not be written.
178
- *
179
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
180
- * prepend a folder token such as "<projectFolder>".
181
- *
182
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
183
- * DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
184
- */
185
- // "untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",
186
- /**
187
- * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
188
- * This file will include only declarations that are marked as "@public" or "@beta".
189
- *
190
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
191
- * prepend a folder token such as "<projectFolder>".
192
- *
193
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
194
- * DEFAULT VALUE: ""
195
- */
196
- // "betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts",
197
- /**
198
- * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.
199
- * This file will include only declarations that are marked as "@public".
200
- *
201
- * If the path is an empty string, then this file will not be written.
202
- *
203
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
204
- * prepend a folder token such as "<projectFolder>".
205
- *
206
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
207
- * DEFAULT VALUE: ""
208
- */
209
- // "publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts",
210
- /**
211
- * When a declaration is trimmed, by default it will be replaced by a code comment such as
212
- * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the
213
- * declaration completely.
214
- *
215
- * DEFAULT VALUE: false
216
- */
217
- // "omitTrimmingComments": true
218
- },
219
- /**
220
- * Configures how the tsdoc-metadata.json file will be generated.
221
- */
222
- "tsdocMetadata": {
223
- /**
224
- * Whether to generate the tsdoc-metadata.json file.
225
- *
226
- * DEFAULT VALUE: true
227
- */
228
- // "enabled": true,
229
- /**
230
- * Specifies where the TSDoc metadata file should be written.
231
- *
232
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
233
- * prepend a folder token such as "<projectFolder>".
234
- *
235
- * The default value is "<lookup>", which causes the path to be automatically inferred from the "tsdocMetadata",
236
- * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup
237
- * falls back to "tsdoc-metadata.json" in the package folder.
238
- *
239
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
240
- * DEFAULT VALUE: "<lookup>"
241
- */
242
- // "tsdocMetadataFilePath": "<projectFolder>/dist/tsdoc-metadata.json"
243
- },
244
- /**
245
- * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files
246
- * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead.
247
- * To use the OS's default newline kind, specify "os".
248
- *
249
- * DEFAULT VALUE: "crlf"
250
- */
251
- // "newlineKind": "crlf",
252
- /**
253
- * Configures how API Extractor reports error and warning messages produced during analysis.
254
- *
255
- * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages.
256
- */
257
- "messages": {
258
- /**
259
- * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing
260
- * the input .d.ts files.
261
- *
262
- * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551"
263
- *
264
- * DEFAULT VALUE: A single "default" entry with logLevel=warning.
265
- */
266
- "compilerMessageReporting": {
267
- /**
268
- * Configures the default routing for messages that don't match an explicit rule in this table.
269
- */
270
- "default": {
271
- /**
272
- * Specifies whether the message should be written to the the tool's output log. Note that
273
- * the "addToApiReportFile" property may supersede this option.
274
- *
275
- * Possible values: "error", "warning", "none"
276
- *
277
- * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail
278
- * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes
279
- * the "--local" option), the warning is displayed but the build will not fail.
280
- *
281
- * DEFAULT VALUE: "warning"
282
- */
283
- "logLevel": "warning"
284
- /**
285
- * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),
286
- * then the message will be written inside that file; otherwise, the message is instead logged according to
287
- * the "logLevel" option.
288
- *
289
- * DEFAULT VALUE: false
290
- */
291
- // "addToApiReportFile": false
292
- }
293
- // "TS2551": {
294
- // "logLevel": "warning",
295
- // "addToApiReportFile": true
296
- // },
297
- //
298
- // . . .
299
- },
300
- /**
301
- * Configures handling of messages reported by API Extractor during its analysis.
302
- *
303
- * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag"
304
- *
305
- * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings
306
- */
307
- "extractorMessageReporting": {
308
- "default": {
309
- "logLevel": "warning"
310
- // "addToApiReportFile": false
311
- },
312
- "ae-unresolved-link": {
313
- "logLevel": "none",
314
- "addToApiReportFile": true
315
- }
316
- // "ae-extra-release-tag": {
317
- // "logLevel": "warning",
318
- // "addToApiReportFile": true
319
- // },
320
- //
321
- // . . .
322
- },
323
- /**
324
- * Configures handling of messages reported by the TSDoc parser when analyzing code comments.
325
- *
326
- * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text"
327
- *
328
- * DEFAULT VALUE: A single "default" entry with logLevel=warning.
329
- */
330
- "tsdocMessageReporting": {
331
- "default": {
332
- "logLevel": "warning"
333
- // "addToApiReportFile": false
334
- }
335
- // "tsdoc-link-tag-unescaped-text": {
336
- // "logLevel": "warning",
337
- // "addToApiReportFile": true
338
- // },
339
- //
340
- // . . .
341
- }
342
- }
343
- }
@@ -1,19 +0,0 @@
1
- {
2
- "extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json",
3
- "setupFilesAfterEnv": ["<rootDir>/lib/test/setupTests.js"],
4
- "testEnvironment": "jsdom",
5
- "coveragePathIgnorePatterns": ["index.js", "index.browser.js", "public.js", "internal.js"],
6
- "coverageThreshold": {
7
- "global": {
8
- "branches": 95,
9
- "functions": 100,
10
- "lines": 100,
11
- "statements": 100
12
- }
13
- },
14
- "collectCoverage": true,
15
- "coverageReporters": ["text", "lcov", "html"],
16
- "moduleNameMapper": {
17
- "^idb-keyval$": "<rootDir>/lib/test/mocks/idb-keyval.js"
18
- }
19
- }
package/config/rig.json DELETED
@@ -1,16 +0,0 @@
1
- // The "rig.json" file directs tools to look for their config files in an external package.
2
- // Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
3
- {
4
- "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
5
- /**
6
- * (Required) The name of the rig package to inherit from.
7
- * It should be an NPM package name with the "-rig" suffix.
8
- */
9
- "rigPackageName": "@fgv/heft-dual-rig"
10
- /**
11
- * (Optional) Selects a config profile from the rig package. The name must consist of
12
- * lowercase alphanumeric words separated by hyphens, for example "sample-profile".
13
- * If omitted, then the "default" profile will be used."
14
- */
15
- // "rigProfile": "your-profile-name"
16
- }
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "https://typedoc.org/schema.json",
3
- "extends": ["@fgv/heft-dual-rig/profiles/default/config/typedoc.base.json"],
4
- "entryPoints": ["../src/index.ts"],
5
- "out": "../docs"
6
- }
@@ -1,6 +0,0 @@
1
- export const createStore = jest.fn(() => ({}));
2
- export const get = jest.fn();
3
- export const set = jest.fn();
4
- export const del = jest.fn();
5
- export const keys = jest.fn();
6
- //# sourceMappingURL=idb-keyval.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"idb-keyval.js","sourceRoot":"","sources":["../../../src/test/mocks/idb-keyval.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/C,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC","sourcesContent":["export const createStore = jest.fn(() => ({}));\nexport const get = jest.fn();\nexport const set = jest.fn();\nexport const del = jest.fn();\nexport const keys = jest.fn();\n"]}
@@ -1,74 +0,0 @@
1
- /*
2
- * Copyright (c) 2025 Erik Fortune
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in all
12
- * copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
- import { webcrypto } from 'crypto';
23
- import { TextEncoder, TextDecoder } from 'util';
24
- // Setup Web Crypto API using Node.js webcrypto
25
- Object.defineProperty(global, 'crypto', {
26
- value: webcrypto,
27
- writable: true,
28
- configurable: true
29
- });
30
- // Setup TextEncoder/TextDecoder for Node environment
31
- Object.defineProperty(global, 'TextEncoder', {
32
- value: TextEncoder,
33
- writable: true,
34
- configurable: true
35
- });
36
- Object.defineProperty(global, 'TextDecoder', {
37
- value: TextDecoder,
38
- writable: true,
39
- configurable: true
40
- });
41
- // Mock DataTransfer for File API testing
42
- class MockDataTransfer {
43
- constructor() {
44
- const fileArray = [];
45
- this.items = {
46
- add: (file) => {
47
- fileArray.push(file);
48
- this.files = createFileList(fileArray);
49
- }
50
- };
51
- this.files = createFileList([]);
52
- }
53
- }
54
- function createFileList(files) {
55
- const fileList = {
56
- length: files.length,
57
- item: (index) => files[index] || null,
58
- [Symbol.iterator]: function* () {
59
- for (const file of files) {
60
- yield file;
61
- }
62
- }
63
- };
64
- for (let i = 0; i < files.length; i++) {
65
- fileList[i] = files[i];
66
- }
67
- return fileList;
68
- }
69
- Object.defineProperty(global, 'DataTransfer', {
70
- value: MockDataTransfer,
71
- writable: true,
72
- configurable: true
73
- });
74
- //# sourceMappingURL=setupTests.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupTests.js","sourceRoot":"","sources":["../../src/test/setupTests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEhD,+CAA+C;AAC/C,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE;IACtC,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,IAAI;CACnB,CAAC,CAAC;AAEH,qDAAqD;AACrD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE;IAC3C,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,IAAI;CACnB,CAAC,CAAC;AAEH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE;IAC3C,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,IAAI;CACnB,CAAC,CAAC;AAEH,yCAAyC;AACzC,MAAM,gBAAgB;IAIpB;QACE,MAAM,SAAS,GAAW,EAAE,CAAC;QAE7B,IAAI,CAAC,KAAK,GAAG;YACX,GAAG,EAAE,CAAC,IAAU,EAAE,EAAE;gBAClB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACrB,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;YACzC,CAAC;SACF,CAAC;QAEF,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;CACF;AAED,SAAS,cAAc,CAAC,KAAa;IACnC,MAAM,QAAQ,GAAG;QACf,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI;QAC7C,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;YAC1B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,MAAM,IAAI,CAAC;YACb,CAAC;QACH,CAAC;KACF,CAAC;IAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,QAA4C,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,QAA+B,CAAC;AACzC,CAAC;AAED,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE;IAC5C,KAAK,EAAE,gBAAgB;IACvB,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,IAAI;CACnB,CAAC,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { webcrypto } from 'crypto';\nimport { TextEncoder, TextDecoder } from 'util';\n\n// Setup Web Crypto API using Node.js webcrypto\nObject.defineProperty(global, 'crypto', {\n value: webcrypto,\n writable: true,\n configurable: true\n});\n\n// Setup TextEncoder/TextDecoder for Node environment\nObject.defineProperty(global, 'TextEncoder', {\n value: TextEncoder,\n writable: true,\n configurable: true\n});\n\nObject.defineProperty(global, 'TextDecoder', {\n value: TextDecoder,\n writable: true,\n configurable: true\n});\n\n// Mock DataTransfer for File API testing\nclass MockDataTransfer {\n items: { add: (file: File) => void };\n files: FileList;\n\n constructor() {\n const fileArray: File[] = [];\n\n this.items = {\n add: (file: File) => {\n fileArray.push(file);\n this.files = createFileList(fileArray);\n }\n };\n\n this.files = createFileList([]);\n }\n}\n\nfunction createFileList(files: File[]): FileList {\n const fileList = {\n length: files.length,\n item: (index: number) => files[index] || null,\n [Symbol.iterator]: function* () {\n for (const file of files) {\n yield file;\n }\n }\n };\n\n for (let i = 0; i < files.length; i++) {\n (fileList as unknown as Record<number, File>)[i] = files[i];\n }\n\n return fileList as unknown as FileList;\n}\n\nObject.defineProperty(global, 'DataTransfer', {\n value: MockDataTransfer,\n writable: true,\n configurable: true\n});\n"]}
@@ -1,140 +0,0 @@
1
- /*
2
- * Copyright (c) 2025 Erik Fortune
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in all
12
- * copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
- import '@fgv/ts-utils-jest';
23
- import { BrowserHashProvider } from '../../packlets/crypto-utils';
24
- describe('BrowserHashProvider', () => {
25
- describe('hashString', () => {
26
- test('successfully hashes a string with SHA-256', async () => {
27
- const result = await BrowserHashProvider.hashString('test data', 'SHA-256');
28
- expect(result).toSucceedAndSatisfy((hash) => {
29
- expect(typeof hash).toBe('string');
30
- expect(hash).toMatch(/^[a-f0-9]{64}$/); // SHA-256 produces 64 hex characters
31
- });
32
- });
33
- test('successfully hashes a string with SHA-1', async () => {
34
- const result = await BrowserHashProvider.hashString('test data', 'SHA-1');
35
- expect(result).toSucceedAndSatisfy((hash) => {
36
- expect(typeof hash).toBe('string');
37
- expect(hash).toMatch(/^[a-f0-9]{40}$/); // SHA-1 produces 40 hex characters
38
- });
39
- });
40
- test('successfully hashes a string with SHA-512', async () => {
41
- const result = await BrowserHashProvider.hashString('test data', 'SHA-512');
42
- expect(result).toSucceedAndSatisfy((hash) => {
43
- expect(typeof hash).toBe('string');
44
- expect(hash).toMatch(/^[a-f0-9]{128}$/); // SHA-512 produces 128 hex characters
45
- });
46
- });
47
- test('uses SHA-256 as default algorithm', async () => {
48
- const result = await BrowserHashProvider.hashString('test data');
49
- expect(result).toSucceedAndSatisfy((hash) => {
50
- expect(hash).toMatch(/^[a-f0-9]{64}$/); // SHA-256 produces 64 hex characters
51
- });
52
- });
53
- test('produces consistent hash for same input', async () => {
54
- const input = 'consistent input';
55
- const result1 = await BrowserHashProvider.hashString(input);
56
- const result2 = await BrowserHashProvider.hashString(input);
57
- expect(result1).toSucceed();
58
- expect(result2).toSucceed();
59
- if (result1.isSuccess() && result2.isSuccess()) {
60
- expect(result1.value).toBe(result2.value);
61
- }
62
- });
63
- test('produces different hashes for different inputs', async () => {
64
- const result1 = await BrowserHashProvider.hashString('input1');
65
- const result2 = await BrowserHashProvider.hashString('input2');
66
- expect(result1).toSucceed();
67
- expect(result2).toSucceed();
68
- if (result1.isSuccess() && result2.isSuccess()) {
69
- expect(result1.value).not.toBe(result2.value);
70
- }
71
- });
72
- test('handles empty string input', async () => {
73
- const result = await BrowserHashProvider.hashString('');
74
- expect(result).toSucceed();
75
- });
76
- test('handles unicode input', async () => {
77
- const result = await BrowserHashProvider.hashString('🚀 Unicode test 测试');
78
- expect(result).toSucceedAndSatisfy((hash) => {
79
- expect(hash).toMatch(/^[a-f0-9]{64}$/);
80
- });
81
- });
82
- test('fails when crypto.subtle is unavailable', async () => {
83
- const originalCrypto = global.crypto;
84
- // @ts-ignore - Intentionally removing crypto for test
85
- delete global.crypto;
86
- const result = await BrowserHashProvider.hashString('test');
87
- expect(result).toFailWith(/Hash computation failed/);
88
- global.crypto = originalCrypto;
89
- });
90
- test('handles invalid algorithm gracefully', async () => {
91
- const result = await BrowserHashProvider.hashString('test', 'INVALID-ALG');
92
- expect(result).toFailWith(/Hash computation failed/);
93
- });
94
- });
95
- describe('hashParts', () => {
96
- test('hashes multiple parts with default separator', async () => {
97
- const parts = ['part1', 'part2', 'part3'];
98
- const result = await BrowserHashProvider.hashParts(parts);
99
- expect(result).toSucceedAndSatisfy((hash) => {
100
- expect(hash).toMatch(/^[a-f0-9]{64}$/);
101
- });
102
- });
103
- test('hashes multiple parts with custom separator', async () => {
104
- const parts = ['part1', 'part2', 'part3'];
105
- const result1 = await BrowserHashProvider.hashParts(parts, 'SHA-256', '|');
106
- const result2 = await BrowserHashProvider.hashParts(parts, 'SHA-256', ',');
107
- expect(result1).toSucceed();
108
- expect(result2).toSucceed();
109
- if (result1.isSuccess() && result2.isSuccess()) {
110
- expect(result1.value).not.toBe(result2.value);
111
- }
112
- });
113
- test('produces same hash as hashString for joined parts', async () => {
114
- const parts = ['a', 'b', 'c'];
115
- const separator = '-';
116
- const joined = parts.join(separator);
117
- const partsResult = await BrowserHashProvider.hashParts(parts, 'SHA-256', separator);
118
- const stringResult = await BrowserHashProvider.hashString(joined);
119
- expect(partsResult).toSucceed();
120
- expect(stringResult).toSucceed();
121
- if (partsResult.isSuccess() && stringResult.isSuccess()) {
122
- expect(partsResult.value).toBe(stringResult.value);
123
- }
124
- });
125
- test('handles empty array', async () => {
126
- const result = await BrowserHashProvider.hashParts([]);
127
- expect(result).toSucceed();
128
- });
129
- test('handles single part', async () => {
130
- const result = await BrowserHashProvider.hashParts(['single']);
131
- const stringResult = await BrowserHashProvider.hashString('single');
132
- expect(result).toSucceed();
133
- expect(stringResult).toSucceed();
134
- if (result.isSuccess() && stringResult.isSuccess()) {
135
- expect(result.value).toBe(stringResult.value);
136
- }
137
- });
138
- });
139
- });
140
- //# sourceMappingURL=browserHashProvider.test.js.map