@fgv/ts-web-extras 5.0.2 → 5.1.0-1

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 (383) hide show
  1. package/.rush/temp/chunked-rush-logs/ts-web-extras.build.chunks.jsonl +58 -25
  2. package/.rush/temp/chunked-rush-logs/ts-web-extras.test.chunks.jsonl +70 -0
  3. package/.rush/temp/operation/build/all.log +58 -25
  4. package/.rush/temp/operation/build/error.log +18 -0
  5. package/.rush/temp/operation/build/log-chunks.jsonl +58 -25
  6. package/.rush/temp/operation/build/state.json +1 -1
  7. package/.rush/temp/operation/test/all.log +70 -0
  8. package/.rush/temp/operation/test/error.log +16 -0
  9. package/.rush/temp/operation/test/log-chunks.jsonl +70 -0
  10. package/.rush/temp/operation/test/state.json +3 -0
  11. package/.rush/temp/shrinkwrap-deps.json +175 -163
  12. package/config/jest.config.json +4 -1
  13. package/config/typedoc.json +6 -0
  14. package/dist/index.js +2 -2
  15. package/dist/index.js.map +1 -1
  16. package/dist/packlets/crypto-utils/browserCryptoProvider.js +254 -0
  17. package/dist/packlets/crypto-utils/browserCryptoProvider.js.map +1 -0
  18. package/dist/packlets/crypto-utils/browserHashProvider.js.map +1 -0
  19. package/dist/packlets/{crypto → crypto-utils}/index.js +1 -0
  20. package/dist/packlets/crypto-utils/index.js.map +1 -0
  21. package/dist/packlets/file-api-types/index.js +27 -3
  22. package/dist/packlets/file-api-types/index.js.map +1 -1
  23. package/dist/packlets/file-tree/directoryHandleStore.js +124 -0
  24. package/dist/packlets/file-tree/directoryHandleStore.js.map +1 -0
  25. package/dist/packlets/file-tree/fileApiTreeAccessors.js +91 -0
  26. package/dist/packlets/file-tree/fileApiTreeAccessors.js.map +1 -1
  27. package/dist/packlets/file-tree/fileSystemAccessTreeAccessors.js +414 -0
  28. package/dist/packlets/file-tree/fileSystemAccessTreeAccessors.js.map +1 -0
  29. package/dist/packlets/file-tree/httpTreeAccessors.js +279 -0
  30. package/dist/packlets/file-tree/httpTreeAccessors.js.map +1 -0
  31. package/dist/packlets/file-tree/index.js +4 -0
  32. package/dist/packlets/file-tree/index.js.map +1 -1
  33. package/dist/packlets/file-tree/localStorageTreeAccessors.js +359 -0
  34. package/dist/packlets/file-tree/localStorageTreeAccessors.js.map +1 -0
  35. package/dist/test/mocks/idb-keyval.js +6 -0
  36. package/dist/test/mocks/idb-keyval.js.map +1 -0
  37. package/dist/test/unit/browserHashProvider.test.js +1 -1
  38. package/dist/test/unit/browserHashProvider.test.js.map +1 -1
  39. package/dist/test/unit/directoryHandleStore.test.js +190 -0
  40. package/dist/test/unit/directoryHandleStore.test.js.map +1 -0
  41. package/dist/test/unit/fileApiTreeAccessors.test.js +51 -0
  42. package/dist/test/unit/fileApiTreeAccessors.test.js.map +1 -1
  43. package/dist/test/unit/fileApiTypes.test.js +30 -0
  44. package/dist/test/unit/fileApiTypes.test.js.map +1 -1
  45. package/dist/test/unit/fileSystemAccessTreeAccessors.test.js +622 -0
  46. package/dist/test/unit/fileSystemAccessTreeAccessors.test.js.map +1 -0
  47. package/dist/test/unit/httpTreeAccessors.test.js +1000 -0
  48. package/dist/test/unit/httpTreeAccessors.test.js.map +1 -0
  49. package/dist/test/unit/localStorageTreeAccessors.test.js +812 -0
  50. package/dist/test/unit/localStorageTreeAccessors.test.js.map +1 -0
  51. package/dist/test/utils/fileSystemAccessMocks.js +271 -0
  52. package/dist/test/utils/fileSystemAccessMocks.js.map +1 -0
  53. package/dist/ts-web-extras.d.ts +584 -1
  54. package/dist/tsdoc-metadata.json +1 -1
  55. package/docs/@fgv/namespaces/CryptoUtils/README.md +18 -0
  56. package/docs/@fgv/namespaces/CryptoUtils/classes/BrowserCryptoProvider.md +203 -0
  57. package/docs/@fgv/namespaces/CryptoUtils/classes/BrowserHashProvider.md +63 -0
  58. package/docs/@fgv/namespaces/CryptoUtils/functions/createBrowserCryptoProvider.md +18 -0
  59. package/docs/@fgv/namespaces/FileTreeHelpers/README.md +19 -0
  60. package/docs/@fgv/namespaces/FileTreeHelpers/functions/extractFileListMetadata.md +23 -0
  61. package/docs/@fgv/namespaces/FileTreeHelpers/functions/extractFileMetadata.md +23 -0
  62. package/docs/@fgv/namespaces/FileTreeHelpers/functions/fromDirectoryUpload.md +33 -0
  63. package/docs/@fgv/namespaces/FileTreeHelpers/functions/fromFileList.md +33 -0
  64. package/docs/@fgv/namespaces/FileTreeHelpers/functions/getOriginalFile.md +25 -0
  65. package/docs/@fgv/namespaces/FileTreeHelpers/variables/defaultFileApiTreeInitParams.md +11 -0
  66. package/docs/README.md +78 -0
  67. package/docs/classes/DirectoryHandleStore.md +116 -0
  68. package/docs/classes/FileApiTreeAccessors.md +286 -0
  69. package/docs/classes/FileSystemAccessTreeAccessors.md +557 -0
  70. package/docs/classes/HttpTreeAccessors.md +508 -0
  71. package/docs/classes/LocalStorageTreeAccessors.md +520 -0
  72. package/docs/functions/exportAsJson.md +23 -0
  73. package/docs/functions/exportUsingFileSystemAPI.md +26 -0
  74. package/docs/functions/extractDirectoryPath.md +23 -0
  75. package/docs/functions/isDirectoryHandle.md +23 -0
  76. package/docs/functions/isFileHandle.md +23 -0
  77. package/docs/functions/isFilePath.md +21 -0
  78. package/docs/functions/parseContextFilter.md +22 -0
  79. package/docs/functions/parseQualifierDefaults.md +22 -0
  80. package/docs/functions/parseResourceTypes.md +22 -0
  81. package/docs/functions/parseUrlParameters.md +15 -0
  82. package/docs/functions/safeShowDirectoryPicker.md +24 -0
  83. package/docs/functions/safeShowOpenFilePicker.md +24 -0
  84. package/docs/functions/safeShowSaveFilePicker.md +24 -0
  85. package/docs/functions/supportsFileSystemAccess.md +23 -0
  86. package/docs/interfaces/FilePickerAcceptType.md +16 -0
  87. package/docs/interfaces/FileSystemCreateWritableOptions.md +15 -0
  88. package/docs/interfaces/FileSystemDirectoryHandle.md +187 -0
  89. package/docs/interfaces/FileSystemFileHandle.md +106 -0
  90. package/docs/interfaces/FileSystemGetDirectoryOptions.md +15 -0
  91. package/docs/interfaces/FileSystemGetFileOptions.md +15 -0
  92. package/docs/interfaces/FileSystemHandle.md +69 -0
  93. package/docs/interfaces/FileSystemHandlePermissionDescriptor.md +15 -0
  94. package/docs/interfaces/FileSystemRemoveOptions.md +15 -0
  95. package/docs/interfaces/FileSystemWritableFileStream.md +127 -0
  96. package/docs/interfaces/IDirectoryHandleTreeInitializer.md +17 -0
  97. package/docs/interfaces/IFileHandleTreeInitializer.md +16 -0
  98. package/docs/interfaces/IFileListTreeInitializer.md +15 -0
  99. package/docs/interfaces/IFileMetadata.md +19 -0
  100. package/docs/interfaces/IFileSystemAccessTreeParams.md +30 -0
  101. package/docs/interfaces/IFsAccessApis.md +57 -0
  102. package/docs/interfaces/IHttpTreeParams.md +32 -0
  103. package/docs/interfaces/ILocalStorageTreeParams.md +30 -0
  104. package/docs/interfaces/IUrlConfigOptions.md +27 -0
  105. package/docs/interfaces/ShowDirectoryPickerOptions.md +17 -0
  106. package/docs/interfaces/ShowOpenFilePickerOptions.md +19 -0
  107. package/docs/interfaces/ShowSaveFilePickerOptions.md +19 -0
  108. package/docs/type-aliases/TreeInitializer.md +11 -0
  109. package/docs/type-aliases/WellKnownDirectory.md +11 -0
  110. package/docs/type-aliases/WindowWithFsAccess.md +11 -0
  111. package/docs/variables/DEFAULT_DIRECTORY_HANDLE_DB.md +11 -0
  112. package/docs/variables/DEFAULT_DIRECTORY_HANDLE_STORE.md +11 -0
  113. package/etc/ts-web-extras.api.md +124 -1
  114. package/lib/index.d.ts +2 -1
  115. package/lib/index.d.ts.map +1 -1
  116. package/lib/index.js +25 -2
  117. package/lib/index.js.map +1 -1
  118. package/lib/packlets/crypto-utils/browserCryptoProvider.d.ts +77 -0
  119. package/lib/packlets/crypto-utils/browserCryptoProvider.d.ts.map +1 -0
  120. package/lib/packlets/crypto-utils/browserCryptoProvider.js +259 -0
  121. package/lib/packlets/crypto-utils/browserCryptoProvider.js.map +1 -0
  122. package/lib/packlets/crypto-utils/browserHashProvider.d.ts.map +1 -0
  123. package/lib/packlets/crypto-utils/browserHashProvider.js.map +1 -0
  124. package/lib/packlets/{crypto → crypto-utils}/index.d.ts +1 -0
  125. package/lib/packlets/crypto-utils/index.d.ts.map +1 -0
  126. package/lib/packlets/{crypto → crypto-utils}/index.js +1 -0
  127. package/lib/packlets/crypto-utils/index.js.map +1 -0
  128. package/lib/packlets/file-api-types/index.d.ts.map +1 -1
  129. package/lib/packlets/file-api-types/index.js +27 -3
  130. package/lib/packlets/file-api-types/index.js.map +1 -1
  131. package/lib/packlets/file-tree/directoryHandleStore.d.ts +59 -0
  132. package/lib/packlets/file-tree/directoryHandleStore.d.ts.map +1 -0
  133. package/lib/packlets/file-tree/directoryHandleStore.js +128 -0
  134. package/lib/packlets/file-tree/directoryHandleStore.js.map +1 -0
  135. package/lib/packlets/file-tree/fileApiTreeAccessors.d.ts +66 -0
  136. package/lib/packlets/file-tree/fileApiTreeAccessors.d.ts.map +1 -1
  137. package/lib/packlets/file-tree/fileApiTreeAccessors.js +91 -0
  138. package/lib/packlets/file-tree/fileApiTreeAccessors.js.map +1 -1
  139. package/lib/packlets/file-tree/fileSystemAccessTreeAccessors.d.ts +152 -0
  140. package/lib/packlets/file-tree/fileSystemAccessTreeAccessors.d.ts.map +1 -0
  141. package/lib/packlets/file-tree/fileSystemAccessTreeAccessors.js +418 -0
  142. package/lib/packlets/file-tree/fileSystemAccessTreeAccessors.js.map +1 -0
  143. package/lib/packlets/file-tree/httpTreeAccessors.d.ts +88 -0
  144. package/lib/packlets/file-tree/httpTreeAccessors.d.ts.map +1 -0
  145. package/lib/packlets/file-tree/httpTreeAccessors.js +283 -0
  146. package/lib/packlets/file-tree/httpTreeAccessors.js.map +1 -0
  147. package/lib/packlets/file-tree/index.d.ts +4 -0
  148. package/lib/packlets/file-tree/index.d.ts.map +1 -1
  149. package/lib/packlets/file-tree/index.js +4 -0
  150. package/lib/packlets/file-tree/index.js.map +1 -1
  151. package/lib/packlets/file-tree/localStorageTreeAccessors.d.ts +141 -0
  152. package/lib/packlets/file-tree/localStorageTreeAccessors.d.ts.map +1 -0
  153. package/lib/packlets/file-tree/localStorageTreeAccessors.js +363 -0
  154. package/lib/packlets/file-tree/localStorageTreeAccessors.js.map +1 -0
  155. package/lib/test/mocks/idb-keyval.d.ts +6 -0
  156. package/lib/test/mocks/idb-keyval.d.ts.map +1 -0
  157. package/lib/test/mocks/idb-keyval.js +9 -0
  158. package/lib/test/mocks/idb-keyval.js.map +1 -0
  159. package/lib/test/unit/browserHashProvider.test.js +21 -21
  160. package/lib/test/unit/browserHashProvider.test.js.map +1 -1
  161. package/lib/test/unit/directoryHandleStore.test.d.ts +2 -0
  162. package/lib/test/unit/directoryHandleStore.test.d.ts.map +1 -0
  163. package/lib/test/unit/directoryHandleStore.test.js +192 -0
  164. package/lib/test/unit/directoryHandleStore.test.js.map +1 -0
  165. package/lib/test/unit/fileApiTreeAccessors.test.js +51 -0
  166. package/lib/test/unit/fileApiTreeAccessors.test.js.map +1 -1
  167. package/lib/test/unit/fileApiTypes.test.js +30 -0
  168. package/lib/test/unit/fileApiTypes.test.js.map +1 -1
  169. package/lib/test/unit/fileSystemAccessTreeAccessors.test.d.ts +2 -0
  170. package/lib/test/unit/fileSystemAccessTreeAccessors.test.d.ts.map +1 -0
  171. package/lib/test/unit/fileSystemAccessTreeAccessors.test.js +624 -0
  172. package/lib/test/unit/fileSystemAccessTreeAccessors.test.js.map +1 -0
  173. package/lib/test/unit/httpTreeAccessors.test.d.ts +2 -0
  174. package/lib/test/unit/httpTreeAccessors.test.d.ts.map +1 -0
  175. package/lib/test/unit/httpTreeAccessors.test.js +1002 -0
  176. package/lib/test/unit/httpTreeAccessors.test.js.map +1 -0
  177. package/lib/test/unit/localStorageTreeAccessors.test.d.ts +2 -0
  178. package/lib/test/unit/localStorageTreeAccessors.test.d.ts.map +1 -0
  179. package/lib/test/unit/localStorageTreeAccessors.test.js +814 -0
  180. package/lib/test/unit/localStorageTreeAccessors.test.js.map +1 -0
  181. package/lib/test/utils/fileSystemAccessMocks.d.ts +53 -0
  182. package/lib/test/utils/fileSystemAccessMocks.d.ts.map +1 -0
  183. package/lib/test/utils/fileSystemAccessMocks.js +277 -0
  184. package/lib/test/utils/fileSystemAccessMocks.js.map +1 -0
  185. package/package.json +41 -34
  186. package/rush-logs/ts-web-extras.build.cache.log +0 -1
  187. package/rush-logs/ts-web-extras.build.error.log +18 -0
  188. package/rush-logs/ts-web-extras.build.log +58 -25
  189. package/rush-logs/ts-web-extras.test.cache.log +1 -0
  190. package/rush-logs/ts-web-extras.test.error.log +16 -0
  191. package/rush-logs/ts-web-extras.test.log +70 -0
  192. package/src/index.ts +2 -2
  193. package/src/packlets/crypto-utils/browserCryptoProvider.ts +311 -0
  194. package/src/packlets/{crypto → crypto-utils}/index.ts +1 -0
  195. package/src/packlets/file-api-types/index.ts +24 -3
  196. package/src/packlets/file-tree/directoryHandleStore.ts +136 -0
  197. package/src/packlets/file-tree/fileApiTreeAccessors.ts +108 -0
  198. package/src/packlets/file-tree/fileSystemAccessTreeAccessors.ts +519 -0
  199. package/src/packlets/file-tree/httpTreeAccessors.ts +381 -0
  200. package/src/packlets/file-tree/index.ts +4 -0
  201. package/src/packlets/file-tree/localStorageTreeAccessors.ts +430 -0
  202. package/src/test/mocks/idb-keyval.ts +5 -0
  203. package/src/test/unit/browserHashProvider.test.ts +1 -1
  204. package/src/test/unit/directoryHandleStore.test.ts +251 -0
  205. package/src/test/unit/fileApiTreeAccessors.test.ts +69 -0
  206. package/src/test/unit/fileApiTypes.test.ts +36 -0
  207. package/src/test/unit/fileSystemAccessTreeAccessors.test.ts +885 -0
  208. package/src/test/unit/httpTreeAccessors.test.ts +1278 -0
  209. package/src/test/unit/localStorageTreeAccessors.test.ts +1014 -0
  210. package/src/test/utils/fileSystemAccessMocks.ts +353 -0
  211. package/temp/build/typescript/ts_8nwakTlr.json +1 -0
  212. package/temp/coverage/crypto/browserHashProvider.ts.html +1 -1
  213. package/temp/coverage/crypto/index.html +1 -1
  214. package/temp/coverage/crypto-utils/browserCryptoProvider.ts.html +1018 -0
  215. package/temp/coverage/crypto-utils/browserHashProvider.ts.html +304 -0
  216. package/temp/coverage/crypto-utils/index.html +131 -0
  217. package/temp/coverage/file-tree/directoryHandleStore.ts.html +493 -0
  218. package/temp/coverage/file-tree/fileApiTreeAccessors.ts.html +330 -6
  219. package/temp/coverage/file-tree/fileSystemAccessTreeAccessors.ts.html +1642 -0
  220. package/temp/coverage/file-tree/httpTreeAccessors.ts.html +1228 -0
  221. package/temp/coverage/file-tree/index.html +69 -9
  222. package/temp/coverage/file-tree/localStorageTreeAccessors.ts.html +1375 -0
  223. package/temp/coverage/helpers/fileTreeHelpers.ts.html +1 -1
  224. package/temp/coverage/helpers/index.html +1 -1
  225. package/temp/coverage/index.html +13 -13
  226. package/temp/coverage/lcov-report/crypto/browserHashProvider.ts.html +1 -1
  227. package/temp/coverage/lcov-report/crypto/index.html +1 -1
  228. package/temp/coverage/lcov-report/crypto-utils/browserCryptoProvider.ts.html +1018 -0
  229. package/temp/coverage/lcov-report/crypto-utils/browserHashProvider.ts.html +304 -0
  230. package/temp/coverage/lcov-report/crypto-utils/index.html +131 -0
  231. package/temp/coverage/lcov-report/file-tree/directoryHandleStore.ts.html +493 -0
  232. package/temp/coverage/lcov-report/file-tree/fileApiTreeAccessors.ts.html +330 -6
  233. package/temp/coverage/lcov-report/file-tree/fileSystemAccessTreeAccessors.ts.html +1642 -0
  234. package/temp/coverage/lcov-report/file-tree/httpTreeAccessors.ts.html +1228 -0
  235. package/temp/coverage/lcov-report/file-tree/index.html +69 -9
  236. package/temp/coverage/lcov-report/file-tree/localStorageTreeAccessors.ts.html +1375 -0
  237. package/temp/coverage/lcov-report/helpers/fileTreeHelpers.ts.html +1 -1
  238. package/temp/coverage/lcov-report/helpers/index.html +1 -1
  239. package/temp/coverage/lcov-report/index.html +13 -13
  240. package/temp/coverage/lcov-report/url-utils/index.html +1 -1
  241. package/temp/coverage/lcov-report/url-utils/urlParams.ts.html +1 -1
  242. package/temp/coverage/lcov.info +2829 -428
  243. package/temp/coverage/url-utils/index.html +1 -1
  244. package/temp/coverage/url-utils/urlParams.ts.html +1 -1
  245. package/temp/test/jest/haste-map-b931e4e63102f86c5bd4949f7dced44f-9d713eb41149188b4e5c0ae3d86d0a57-2ad8e16b24e391b8cdbe50b55c137169 +0 -0
  246. package/temp/test/jest/perf-cache-b931e4e63102f86c5bd4949f7dced44f-da39a3ee5e6b4b0d3255bfef95601890 +1 -0
  247. package/temp/ts-web-extras.api.json +5282 -1472
  248. package/temp/ts-web-extras.api.md +124 -1
  249. package/dist/packlets/crypto/browserHashProvider.js.map +0 -1
  250. package/dist/packlets/crypto/index.js.map +0 -1
  251. package/docs/index.md +0 -34
  252. package/docs/ts-web-extras.browserhashprovider.hashparts.md +0 -88
  253. package/docs/ts-web-extras.browserhashprovider.hashstring.md +0 -72
  254. package/docs/ts-web-extras.browserhashprovider.md +0 -66
  255. package/docs/ts-web-extras.exportasjson.md +0 -70
  256. package/docs/ts-web-extras.exportusingfilesystemapi.md +0 -104
  257. package/docs/ts-web-extras.extractdirectorypath.md +0 -52
  258. package/docs/ts-web-extras.fileapitreeaccessors.create.md +0 -72
  259. package/docs/ts-web-extras.fileapitreeaccessors.extractfilemetadata.md +0 -54
  260. package/docs/ts-web-extras.fileapitreeaccessors.fromdirectoryupload.md +0 -72
  261. package/docs/ts-web-extras.fileapitreeaccessors.fromfilelist.md +0 -72
  262. package/docs/ts-web-extras.fileapitreeaccessors.getoriginalfile.md +0 -72
  263. package/docs/ts-web-extras.fileapitreeaccessors.md +0 -114
  264. package/docs/ts-web-extras.filepickeraccepttype.accept.md +0 -11
  265. package/docs/ts-web-extras.filepickeraccepttype.description.md +0 -11
  266. package/docs/ts-web-extras.filepickeraccepttype.md +0 -75
  267. package/docs/ts-web-extras.filesystemcreatewritableoptions_2.keepexistingdata.md +0 -11
  268. package/docs/ts-web-extras.filesystemcreatewritableoptions_2.md +0 -58
  269. package/docs/ts-web-extras.filesystemdirectoryhandle_2._symbol.asynciterator_.md +0 -15
  270. package/docs/ts-web-extras.filesystemdirectoryhandle_2.entries.md +0 -15
  271. package/docs/ts-web-extras.filesystemdirectoryhandle_2.getdirectoryhandle.md +0 -66
  272. package/docs/ts-web-extras.filesystemdirectoryhandle_2.getfilehandle.md +0 -66
  273. package/docs/ts-web-extras.filesystemdirectoryhandle_2.keys.md +0 -15
  274. package/docs/ts-web-extras.filesystemdirectoryhandle_2.kind.md +0 -11
  275. package/docs/ts-web-extras.filesystemdirectoryhandle_2.md +0 -146
  276. package/docs/ts-web-extras.filesystemdirectoryhandle_2.removeentry.md +0 -66
  277. package/docs/ts-web-extras.filesystemdirectoryhandle_2.resolve.md +0 -50
  278. package/docs/ts-web-extras.filesystemdirectoryhandle_2.values.md +0 -15
  279. package/docs/ts-web-extras.filesystemfilehandle_2.createwritable.md +0 -52
  280. package/docs/ts-web-extras.filesystemfilehandle_2.getfile.md +0 -15
  281. package/docs/ts-web-extras.filesystemfilehandle_2.kind.md +0 -11
  282. package/docs/ts-web-extras.filesystemfilehandle_2.md +0 -92
  283. package/docs/ts-web-extras.filesystemgetdirectoryoptions_2.create.md +0 -11
  284. package/docs/ts-web-extras.filesystemgetdirectoryoptions_2.md +0 -58
  285. package/docs/ts-web-extras.filesystemgetfileoptions_2.create.md +0 -11
  286. package/docs/ts-web-extras.filesystemgetfileoptions_2.md +0 -58
  287. package/docs/ts-web-extras.filesystemhandle_2.issameentry.md +0 -50
  288. package/docs/ts-web-extras.filesystemhandle_2.kind.md +0 -11
  289. package/docs/ts-web-extras.filesystemhandle_2.md +0 -119
  290. package/docs/ts-web-extras.filesystemhandle_2.name.md +0 -11
  291. package/docs/ts-web-extras.filesystemhandle_2.querypermission.md +0 -52
  292. package/docs/ts-web-extras.filesystemhandle_2.requestpermission.md +0 -52
  293. package/docs/ts-web-extras.filesystemhandlepermissiondescriptor.md +0 -58
  294. package/docs/ts-web-extras.filesystemhandlepermissiondescriptor.mode.md +0 -11
  295. package/docs/ts-web-extras.filesystemremoveoptions_2.md +0 -58
  296. package/docs/ts-web-extras.filesystemremoveoptions_2.recursive.md +0 -11
  297. package/docs/ts-web-extras.filesystemwritablefilestream_2.md +0 -57
  298. package/docs/ts-web-extras.filesystemwritablefilestream_2.seek.md +0 -50
  299. package/docs/ts-web-extras.filesystemwritablefilestream_2.truncate.md +0 -50
  300. package/docs/ts-web-extras.filesystemwritablefilestream_2.write.md +0 -50
  301. package/docs/ts-web-extras.filetreehelpers.defaultfileapitreeinitparams.md +0 -13
  302. package/docs/ts-web-extras.filetreehelpers.extractfilelistmetadata.md +0 -56
  303. package/docs/ts-web-extras.filetreehelpers.extractfilemetadata.md +0 -56
  304. package/docs/ts-web-extras.filetreehelpers.fromdirectoryupload.md +0 -76
  305. package/docs/ts-web-extras.filetreehelpers.fromfilelist.md +0 -76
  306. package/docs/ts-web-extras.filetreehelpers.getoriginalfile.md +0 -72
  307. package/docs/ts-web-extras.filetreehelpers.md +0 -102
  308. package/docs/ts-web-extras.idirectoryhandletreeinitializer.dirhandles.md +0 -11
  309. package/docs/ts-web-extras.idirectoryhandletreeinitializer.md +0 -100
  310. package/docs/ts-web-extras.idirectoryhandletreeinitializer.nonrecursive.md +0 -11
  311. package/docs/ts-web-extras.idirectoryhandletreeinitializer.prefix.md +0 -11
  312. package/docs/ts-web-extras.ifilehandletreeinitializer.filehandles.md +0 -11
  313. package/docs/ts-web-extras.ifilehandletreeinitializer.md +0 -79
  314. package/docs/ts-web-extras.ifilehandletreeinitializer.prefix.md +0 -11
  315. package/docs/ts-web-extras.ifilelisttreeinitializer.filelist.md +0 -11
  316. package/docs/ts-web-extras.ifilelisttreeinitializer.md +0 -58
  317. package/docs/ts-web-extras.ifilemetadata.lastmodified.md +0 -11
  318. package/docs/ts-web-extras.ifilemetadata.md +0 -124
  319. package/docs/ts-web-extras.ifilemetadata.name.md +0 -11
  320. package/docs/ts-web-extras.ifilemetadata.path.md +0 -11
  321. package/docs/ts-web-extras.ifilemetadata.size.md +0 -11
  322. package/docs/ts-web-extras.ifilemetadata.type.md +0 -11
  323. package/docs/ts-web-extras.ifsaccessapis.md +0 -56
  324. package/docs/ts-web-extras.ifsaccessapis.showdirectorypicker.md +0 -52
  325. package/docs/ts-web-extras.ifsaccessapis.showopenfilepicker.md +0 -52
  326. package/docs/ts-web-extras.ifsaccessapis.showsavefilepicker.md +0 -52
  327. package/docs/ts-web-extras.isdirectoryhandle.md +0 -56
  328. package/docs/ts-web-extras.isfilehandle.md +0 -56
  329. package/docs/ts-web-extras.isfilepath.md +0 -52
  330. package/docs/ts-web-extras.iurlconfigoptions.config.md +0 -13
  331. package/docs/ts-web-extras.iurlconfigoptions.configstartdir.md +0 -13
  332. package/docs/ts-web-extras.iurlconfigoptions.contextfilter.md +0 -13
  333. package/docs/ts-web-extras.iurlconfigoptions.input.md +0 -13
  334. package/docs/ts-web-extras.iurlconfigoptions.inputstartdir.md +0 -13
  335. package/docs/ts-web-extras.iurlconfigoptions.interactive.md +0 -13
  336. package/docs/ts-web-extras.iurlconfigoptions.loadzip.md +0 -13
  337. package/docs/ts-web-extras.iurlconfigoptions.maxdistance.md +0 -13
  338. package/docs/ts-web-extras.iurlconfigoptions.md +0 -286
  339. package/docs/ts-web-extras.iurlconfigoptions.qualifierdefaults.md +0 -13
  340. package/docs/ts-web-extras.iurlconfigoptions.reducequalifiers.md +0 -13
  341. package/docs/ts-web-extras.iurlconfigoptions.resourcetypes.md +0 -13
  342. package/docs/ts-web-extras.iurlconfigoptions.zipfile.md +0 -13
  343. package/docs/ts-web-extras.iurlconfigoptions.zippath.md +0 -13
  344. package/docs/ts-web-extras.md +0 -512
  345. package/docs/ts-web-extras.parsecontextfilter.md +0 -52
  346. package/docs/ts-web-extras.parsequalifierdefaults.md +0 -52
  347. package/docs/ts-web-extras.parseresourcetypes.md +0 -52
  348. package/docs/ts-web-extras.parseurlparameters.md +0 -17
  349. package/docs/ts-web-extras.safeshowdirectorypicker.md +0 -72
  350. package/docs/ts-web-extras.safeshowopenfilepicker.md +0 -72
  351. package/docs/ts-web-extras.safeshowsavefilepicker.md +0 -72
  352. package/docs/ts-web-extras.showdirectorypickeroptions.id.md +0 -11
  353. package/docs/ts-web-extras.showdirectorypickeroptions.md +0 -96
  354. package/docs/ts-web-extras.showdirectorypickeroptions.mode.md +0 -11
  355. package/docs/ts-web-extras.showdirectorypickeroptions.startin.md +0 -11
  356. package/docs/ts-web-extras.showopenfilepickeroptions.excludeacceptalloption.md +0 -11
  357. package/docs/ts-web-extras.showopenfilepickeroptions.id.md +0 -11
  358. package/docs/ts-web-extras.showopenfilepickeroptions.md +0 -134
  359. package/docs/ts-web-extras.showopenfilepickeroptions.multiple.md +0 -11
  360. package/docs/ts-web-extras.showopenfilepickeroptions.startin.md +0 -11
  361. package/docs/ts-web-extras.showopenfilepickeroptions.types.md +0 -11
  362. package/docs/ts-web-extras.showsavefilepickeroptions.excludeacceptalloption.md +0 -11
  363. package/docs/ts-web-extras.showsavefilepickeroptions.id.md +0 -11
  364. package/docs/ts-web-extras.showsavefilepickeroptions.md +0 -134
  365. package/docs/ts-web-extras.showsavefilepickeroptions.startin.md +0 -11
  366. package/docs/ts-web-extras.showsavefilepickeroptions.suggestedname.md +0 -11
  367. package/docs/ts-web-extras.showsavefilepickeroptions.types.md +0 -11
  368. package/docs/ts-web-extras.supportsfilesystemaccess.md +0 -56
  369. package/docs/ts-web-extras.treeinitializer.md +0 -15
  370. package/docs/ts-web-extras.wellknowndirectory.md +0 -13
  371. package/docs/ts-web-extras.windowwithfsaccess.md +0 -15
  372. package/lib/packlets/crypto/browserHashProvider.d.ts.map +0 -1
  373. package/lib/packlets/crypto/browserHashProvider.js.map +0 -1
  374. package/lib/packlets/crypto/index.d.ts.map +0 -1
  375. package/lib/packlets/crypto/index.js.map +0 -1
  376. package/temp/build/typescript/ts_vnCx6LlY.json +0 -1
  377. package/temp/test/jest/haste-map-7492f1b44480e0cdd1f220078fb3afd8-c8dd6c3430605adeb2f1cadf4f75e791-8c9336785555d572065b28c111982ba4 +0 -0
  378. package/temp/test/jest/perf-cache-7492f1b44480e0cdd1f220078fb3afd8-da39a3ee5e6b4b0d3255bfef95601890 +0 -1
  379. /package/dist/packlets/{crypto → crypto-utils}/browserHashProvider.js +0 -0
  380. /package/lib/packlets/{crypto → crypto-utils}/browserHashProvider.d.ts +0 -0
  381. /package/lib/packlets/{crypto → crypto-utils}/browserHashProvider.js +0 -0
  382. /package/src/packlets/{crypto → crypto-utils}/browserHashProvider.ts +0 -0
  383. /package/temp/test/jest/{jest-transform-cache-7492f1b44480e0cdd1f220078fb3afd8-79ef2876fae7ca75eedb2aa53dc48338/0e/package_0eb6535f5987849d93ea51ef33a14cf6 → jest-transform-cache-b931e4e63102f86c5bd4949f7dced44f-79ef2876fae7ca75eedb2aa53dc48338/b5/package_b5f57afc9ec2c011239b1608ee5bdfa5} +0 -0
@@ -9,15 +9,83 @@
9
9
  * @packageDocumentation
10
10
  */
11
11
 
12
+ import { CryptoUtils as CryptoUtils_2 } from '@fgv/ts-extras';
13
+ import { DetailedResult } from '@fgv/ts-utils';
12
14
  import { FileTree } from '@fgv/ts-json-base';
15
+ import { Logging } from '@fgv/ts-utils';
13
16
  import { Result } from '@fgv/ts-utils';
14
17
 
18
+ /**
19
+ * Browser implementation of `ICryptoProvider` using the Web Crypto API.
20
+ * Uses AES-256-GCM for authenticated encryption.
21
+ *
22
+ * Note: This provider requires a browser environment with Web Crypto API support.
23
+ * In Node.js 15+, Web Crypto is available via globalThis.crypto or require('crypto').webcrypto.
24
+ *
25
+ * @public
26
+ */
27
+ declare class BrowserCryptoProvider implements ICryptoProvider {
28
+ private readonly _crypto;
29
+ /**
30
+ * Creates a new {@link CryptoUtils.BrowserCryptoProvider | BrowserCryptoProvider}.
31
+ * @param cryptoApi - Optional Crypto instance (defaults to globalThis.crypto)
32
+ */
33
+ constructor(cryptoApi?: Crypto);
34
+ /**
35
+ * Encrypts plaintext using AES-256-GCM.
36
+ * @param plaintext - UTF-8 string to encrypt
37
+ * @param key - 32-byte encryption key
38
+ * @returns `Success` with encryption result, or `Failure` with an error.
39
+ */
40
+ encrypt(plaintext: string, key: Uint8Array): Promise<Result<IEncryptionResult>>;
41
+ /**
42
+ * Decrypts ciphertext using AES-256-GCM.
43
+ * @param encryptedData - Encrypted bytes
44
+ * @param key - 32-byte decryption key
45
+ * @param iv - Initialization vector (12 bytes)
46
+ * @param authTag - GCM authentication tag (16 bytes)
47
+ * @returns `Success` with decrypted UTF-8 string, or `Failure` with an error.
48
+ */
49
+ decrypt(encryptedData: Uint8Array, key: Uint8Array, iv: Uint8Array, authTag: Uint8Array): Promise<Result<string>>;
50
+ /**
51
+ * Generates a random 32-byte key suitable for AES-256.
52
+ * @returns Success with generated key, or Failure with error
53
+ */
54
+ generateKey(): Promise<Result<Uint8Array>>;
55
+ /**
56
+ * Derives a key from a password using PBKDF2.
57
+ * @param password - Password string
58
+ * @param salt - Salt bytes (should be at least 16 bytes)
59
+ * @param iterations - Number of iterations (recommend 100000+)
60
+ * @returns Success with derived 32-byte key, or Failure with error
61
+ */
62
+ deriveKey(password: string, salt: Uint8Array, iterations: number): Promise<Result<Uint8Array>>;
63
+ /**
64
+ * Generates cryptographically secure random bytes.
65
+ * @param length - Number of bytes to generate
66
+ * @returns Success with random bytes, or Failure with error
67
+ */
68
+ generateRandomBytes(length: number): Result<Uint8Array>;
69
+ /**
70
+ * Encodes binary data to base64 string.
71
+ * @param data - Binary data to encode
72
+ * @returns Base64-encoded string
73
+ */
74
+ toBase64(data: Uint8Array): string;
75
+ /**
76
+ * Decodes base64 string to binary data.
77
+ * @param base64 - Base64-encoded string
78
+ * @returns Success with decoded bytes, or Failure if invalid base64
79
+ */
80
+ fromBase64(base64: string): Result<Uint8Array>;
81
+ }
82
+
15
83
  /**
16
84
  * Browser-compatible hash provider using the Web Crypto API.
17
85
  * Supports common hash algorithms available in browsers.
18
86
  * @public
19
87
  */
20
- export declare class BrowserHashProvider {
88
+ declare class BrowserHashProvider {
21
89
  /**
22
90
  * Hash a string using the specified algorithm.
23
91
  * @param data - The string to hash
@@ -35,12 +103,83 @@ export declare class BrowserHashProvider {
35
103
  static hashParts(parts: string[], algorithm?: string, separator?: string): Promise<Result<string>>;
36
104
  }
37
105
 
106
+ /**
107
+ * Creates a {@link CryptoUtils.BrowserCryptoProvider | BrowserCryptoProvider} if Web
108
+ * Crypto API is available.
109
+ * @returns `Success` with provider, or `Failure` if not available
110
+ * @public
111
+ */
112
+ declare function createBrowserCryptoProvider(): Result<BrowserCryptoProvider>;
113
+
114
+ declare namespace CryptoUtils {
115
+ export {
116
+ BrowserHashProvider,
117
+ createBrowserCryptoProvider,
118
+ BrowserCryptoProvider
119
+ }
120
+ }
121
+ export { CryptoUtils }
122
+
123
+ /**
124
+ * Default IndexedDB database name for directory handles.
125
+ * @public
126
+ */
127
+ export declare const DEFAULT_DIRECTORY_HANDLE_DB = "chocolate-lab-storage";
128
+
129
+ /**
130
+ * Default IndexedDB store name for directory handles.
131
+ * @public
132
+ */
133
+ export declare const DEFAULT_DIRECTORY_HANDLE_STORE = "directory-handles";
134
+
38
135
  /**
39
136
  * Default initialization parameters for a `FileTree` using {@link FileApiTreeAccessors}.
40
137
  * @public
41
138
  */
42
139
  declare const defaultFileApiTreeInitParams: FileTree.IFileTreeInitParams<string>;
43
140
 
141
+ /**
142
+ * Manages persistence of {@link FileSystemDirectoryHandle} objects in IndexedDB.
143
+ * Keyed by a label (typically the directory name).
144
+ * @public
145
+ */
146
+ export declare class DirectoryHandleStore {
147
+ private readonly _store;
148
+ constructor(dbName?: string, storeName?: string);
149
+ /**
150
+ * Saves a directory handle to IndexedDB under the given label.
151
+ * @param label - Key to store the handle under (typically dirHandle.name)
152
+ * @param handle - The FileSystemDirectoryHandle to persist
153
+ * @returns Success or Failure
154
+ */
155
+ save(label: string, handle: FileSystemDirectoryHandle_2): Promise<Result<void>>;
156
+ /**
157
+ * Retrieves a directory handle by label.
158
+ * @param label - Key to look up
159
+ * @returns Success with handle (or undefined if not found), or Failure on error
160
+ */
161
+ load(label: string): Promise<Result<FileSystemDirectoryHandle_2 | undefined>>;
162
+ /**
163
+ * Removes a directory handle from IndexedDB.
164
+ * @param label - Key to remove
165
+ * @returns Success or Failure
166
+ */
167
+ remove(label: string): Promise<Result<void>>;
168
+ /**
169
+ * Returns all stored labels (keys).
170
+ * @returns Success with array of labels, or Failure
171
+ */
172
+ getAllLabels(): Promise<Result<string[]>>;
173
+ /**
174
+ * Returns all stored handles as label/handle pairs.
175
+ * @returns Success with array of entries, or Failure
176
+ */
177
+ getAll(): Promise<Result<Array<{
178
+ label: string;
179
+ handle: FileSystemDirectoryHandle_2;
180
+ }>>>;
181
+ }
182
+
44
183
  /**
45
184
  * Export data as JSON file using legacy blob download method.
46
185
  * Creates a temporary download link and triggers file download.
@@ -91,6 +230,69 @@ declare function extractFileListMetadata(fileList: FileList): Array<IFileMetadat
91
230
  * @public
92
231
  */
93
232
  export declare class FileApiTreeAccessors<TCT extends string = string> {
233
+ /**
234
+ * Create a persistent FileTree from a File System Access API directory handle.
235
+ * Changes to files can be synced back to disk.
236
+ *
237
+ * @param dirHandle - FileSystemDirectoryHandle to load files from
238
+ * @param params - Optional parameters including autoSync and permission settings
239
+ * @returns Promise resolving to a FileTree with persistence capability
240
+ *
241
+ * @remarks
242
+ * - Only works in browsers supporting File System Access API (Chrome, Edge, Opera)
243
+ * - Requires 'readwrite' permission on the directory handle
244
+ * - Falls back to read-only mode if permissions unavailable (unless requireWritePermission is true)
245
+ *
246
+ * @public
247
+ */
248
+ static createPersistent<TCT extends string = string>(dirHandle: FileSystemDirectoryHandle_2, params?: IFileSystemAccessTreeParams<TCT>): Promise<Result<FileTree.FileTree<TCT>>>;
249
+ /**
250
+ * Create a persistent FileTree from an HTTP storage service.
251
+ *
252
+ * @param params - Configuration including API base URL, namespace, and optional autoSync
253
+ * @returns Promise resolving to a FileTree with persistence capability
254
+ * @public
255
+ */
256
+ static createFromHttp<TCT extends string = string>(params: IHttpTreeParams<TCT>): Promise<Result<FileTree.FileTree<TCT>>>;
257
+ /**
258
+ * Create a persistent FileTree from a single File System Access API file handle.
259
+ * The tree contains exactly one file at `/<filename>`.
260
+ * Changes can be synced back to the original file via `syncToDisk()`.
261
+ *
262
+ * @param fileHandle - FileSystemFileHandle to load
263
+ * @param params - Optional parameters including autoSync and permission settings
264
+ * @returns Promise resolving to a FileTree with persistence capability
265
+ * @public
266
+ */
267
+ static createPersistentFromFile<TCT extends string = string>(fileHandle: FileSystemFileHandle_2, params?: IFileSystemAccessTreeParams<TCT>): Promise<Result<FileTree.FileTree<TCT>>>;
268
+ /**
269
+ * Create a persistent FileTree from browser localStorage.
270
+ * Changes to files can be synced back to localStorage.
271
+ *
272
+ * @param params - Configuration including path-to-key mappings and optional autoSync
273
+ * @returns Result containing a FileTree with persistence capability
274
+ *
275
+ * @remarks
276
+ * - Works in all browsers with localStorage support
277
+ * - Maps directory paths to localStorage keys
278
+ * - Each key stores multiple collections as JSON
279
+ * - Files are automatically discovered from storage
280
+ *
281
+ * @example
282
+ * ```typescript
283
+ * const tree = FileApiTreeAccessors.createFromLocalStorage({
284
+ * pathToKeyMap: {
285
+ * '/data/ingredients': 'myapp:ingredients:v1',
286
+ * '/data/fillings': 'myapp:fillings:v1'
287
+ * },
288
+ * mutable: true,
289
+ * autoSync: false
290
+ * });
291
+ * ```
292
+ *
293
+ * @public
294
+ */
295
+ static createFromLocalStorage<TCT extends string = string>(params: ILocalStorageTreeParams<TCT>): Result<FileTree.FileTree<TCT>>;
94
296
  /**
95
297
  * Create FileTree from various file sources using TreeInitializer array.
96
298
  * @param initializers - Array of TreeInitializer objects specifying file sources
@@ -180,6 +382,128 @@ declare function extractFileListMetadata(fileList: FileList): Array<IFileMetadat
180
382
  accept: Record<string, string | string[]>;
181
383
  }
182
384
 
385
+ /**
386
+ * Implementation of `FileTree.IPersistentFileTreeAccessors` that uses the File System Access API
387
+ * to provide persistent file editing in browsers.
388
+ * @public
389
+ */
390
+ export declare class FileSystemAccessTreeAccessors<TCT extends string = string> extends FileTree.InMemoryTreeAccessors<TCT> implements FileTree.IPersistentFileTreeAccessors<TCT> {
391
+ private readonly _handles;
392
+ private readonly _rootDir;
393
+ private readonly _dirtyFiles;
394
+ private readonly _pendingDeletions;
395
+ private readonly _autoSync;
396
+ private readonly _hasWritePermission;
397
+ private readonly _logger;
398
+ /**
399
+ * Protected constructor for FileSystemAccessTreeAccessors.
400
+ * @param files - An array of in-memory files to include in the tree.
401
+ * @param rootDir - The root directory handle.
402
+ * @param handles - Map of file paths to their handles.
403
+ * @param params - Optional params for the tree.
404
+ * @param hasWritePermission - Whether write permission was granted.
405
+ */
406
+ protected constructor(files: FileTree.IInMemoryFile<TCT>[], rootDir: FileSystemDirectoryHandle_2, handles: Map<string, FileSystemFileHandle_2>, params: IFileSystemAccessTreeParams<TCT> | undefined, hasWritePermission: boolean);
407
+ private _runAutoSyncTask;
408
+ /**
409
+ * Creates a new FileSystemAccessTreeAccessors instance from a directory handle.
410
+ * @param dirHandle - The FileSystemDirectoryHandle to load files from.
411
+ * @param params - Optional parameters including autoSync and permission settings.
412
+ * @returns Promise resolving to a FileSystemAccessTreeAccessors instance.
413
+ * @public
414
+ */
415
+ static fromDirectoryHandle<TCT extends string = string>(dirHandle: FileSystemDirectoryHandle_2, params?: IFileSystemAccessTreeParams<TCT>): Promise<Result<FileSystemAccessTreeAccessors<TCT>>>;
416
+ /**
417
+ * Creates a new FileSystemAccessTreeAccessors instance from a single file handle.
418
+ *
419
+ * The resulting tree contains exactly one file at `/<filename>`.
420
+ * `syncToDisk()` writes changes back to the original file via the File System Access API.
421
+ * New file creation is not supported on this tree (no parent directory handle).
422
+ *
423
+ * @param fileHandle - The FileSystemFileHandle to load.
424
+ * @param params - Optional parameters including autoSync and permission settings.
425
+ * @returns Promise resolving to a FileSystemAccessTreeAccessors instance.
426
+ * @public
427
+ */
428
+ static fromFileHandle<TCT extends string = string>(fileHandle: FileSystemFileHandle_2, params?: IFileSystemAccessTreeParams<TCT>): Promise<Result<FileSystemAccessTreeAccessors<TCT>>>;
429
+ /**
430
+ * Check if the directory handle has write permission.
431
+ * @param handle - The directory handle to check.
432
+ * @returns Promise resolving to true if write permission is granted.
433
+ * @internal
434
+ */
435
+ private static _checkWritePermission;
436
+ /**
437
+ * Check if the file handle has write permission.
438
+ * @param handle - The file handle to check.
439
+ * @returns Promise resolving to true if write permission is granted.
440
+ * @internal
441
+ */
442
+ private static _checkFileWritePermission;
443
+ /**
444
+ * Load all files from a directory handle recursively.
445
+ * @param dirHandle - The directory handle to load from.
446
+ * @param basePath - The base path for files.
447
+ * @param params - Optional parameters.
448
+ * @returns Promise resolving to files and handles.
449
+ * @internal
450
+ */
451
+ private static _loadDirectory;
452
+ /**
453
+ * Join path segments.
454
+ * @param base - The base path.
455
+ * @param name - The name to append.
456
+ * @returns The joined path.
457
+ * @internal
458
+ */
459
+ private static _joinPath;
460
+ /**
461
+ * Implements `FileTree.IPersistentFileTreeAccessors.syncToDisk`
462
+ */
463
+ syncToDisk(): Promise<Result<void>>;
464
+ /**
465
+ * Implements `FileTree.IPersistentFileTreeAccessors.isDirty`
466
+ */
467
+ isDirty(): boolean;
468
+ /**
469
+ * Implements `FileTree.IPersistentFileTreeAccessors.getDirtyPaths`
470
+ */
471
+ getDirtyPaths(): string[];
472
+ /**
473
+ * Override deleteFile to track pending deletions for syncToDisk.
474
+ */
475
+ deleteFile(path: string): Result<boolean>;
476
+ /**
477
+ * Implements `FileTree.IMutableFileTreeAccessors.saveFileContents`
478
+ */
479
+ saveFileContents(path: string, contents: string): Result<string>;
480
+ /**
481
+ * Implements `FileTree.IMutableFileTreeAccessors.fileIsMutable`
482
+ */
483
+ fileIsMutable(path: string): DetailedResult<boolean, FileTree.SaveDetail>;
484
+ /**
485
+ * Sync a single file to disk.
486
+ * @param path - The path of the file to sync.
487
+ * @returns Promise resolving to success or failure.
488
+ * @internal
489
+ */
490
+ private _syncFile;
491
+ /**
492
+ * Delete a file from disk using the File System Access API.
493
+ * @param path - The path of the file to delete.
494
+ * @returns Promise resolving to success or failure.
495
+ * @internal
496
+ */
497
+ private _deleteFileFromDisk;
498
+ /**
499
+ * Create a new file and write its contents.
500
+ * @param path - The path of the file to create.
501
+ * @returns Promise resolving to success or failure.
502
+ * @internal
503
+ */
504
+ private _createAndWriteFile;
505
+ }
506
+
183
507
  /**
184
508
  * Options for creating writable file streams
185
509
  * @public
@@ -327,6 +651,82 @@ declare function extractFileListMetadata(fileList: FileList): Array<IFileMetadat
327
651
  */
328
652
  declare function getOriginalFile(fileList: FileList, path: string): Result<File>;
329
653
 
654
+ /**
655
+ * HTTP-backed file tree accessors that cache data in memory and persist via REST API.
656
+ * @public
657
+ */
658
+ export declare class HttpTreeAccessors<TCT extends string = string> extends FileTree.InMemoryTreeAccessors<TCT> implements FileTree.IPersistentFileTreeAccessors<TCT> {
659
+ private readonly _baseUrl;
660
+ private readonly _namespace;
661
+ private readonly _fetchImpl;
662
+ private readonly _dirtyFiles;
663
+ private readonly _pendingDeletions;
664
+ private readonly _autoSync;
665
+ private readonly _userId;
666
+ private readonly _logger;
667
+ private constructor();
668
+ private _runAutoSyncTask;
669
+ /**
670
+ * Creates a new HttpTreeAccessors instance from an HTTP backend.
671
+ * @param params - Configuration parameters for the HTTP tree accessors.
672
+ * @returns A promise that resolves to a result containing the new HttpTreeAccessors instance or an error message.
673
+ */
674
+ static fromHttp<TCT extends string = string>(params: IHttpTreeParams<TCT>): Promise<Result<HttpTreeAccessors<TCT>>>;
675
+ /**
676
+ * Synchronizes all dirty files to the HTTP backend.
677
+ * @returns A promise that resolves to a result indicating success or failure.
678
+ */
679
+ syncToDisk(): Promise<Result<void>>;
680
+ /**
681
+ * Checks if there are any dirty files that need synchronization.
682
+ * @returns True if there are dirty files, false otherwise.
683
+ */
684
+ isDirty(): boolean;
685
+ /**
686
+ * Gets the list of paths for all dirty files.
687
+ * @returns An array of file paths that have been modified but not yet synchronized.
688
+ */
689
+ getDirtyPaths(): string[];
690
+ deleteFile(path: string): Result<boolean>;
691
+ /**
692
+ * Saves file contents and marks the file as dirty for synchronization.
693
+ * @param path - The path to the file.
694
+ * @param contents - The new contents of the file.
695
+ * @returns A result indicating success or failure.
696
+ */
697
+ saveFileContents(path: string, contents: string): Result<string>;
698
+ /**
699
+ * Checks if a file is mutable (can be modified).
700
+ * @param path - The path to the file.
701
+ * @returns A detailed result indicating if the file is mutable and the reason.
702
+ */
703
+ fileIsMutable(path: string): DetailedResult<boolean, FileTree.SaveDetail>;
704
+ /**
705
+ * Makes an HTTP request to the specified resource path.
706
+ * @param resourcePath - The path to the resource.
707
+ * @param init - Optional request initialization options.
708
+ * @returns A promise that resolves to a result containing the response data or an error message.
709
+ */
710
+ private _request;
711
+ /**
712
+ * Loads files from the HTTP backend for the specified directory path.
713
+ * @param params - Configuration parameters for the HTTP tree accessors.
714
+ * @param directoryPath - The path to the directory to load files from.
715
+ * @returns A promise that resolves to a result containing the loaded files or an error message.
716
+ */
717
+ private static _loadFiles;
718
+ /**
719
+ * Makes an HTTP request with query parameters to the specified resource path.
720
+ * @param params - Configuration parameters for the HTTP tree accessors.
721
+ * @param resourcePath - The path to the resource.
722
+ * @param query - Query parameters to include in the request.
723
+ * @returns A promise that resolves to a result containing the response data or an error message.
724
+ */
725
+ private static _requestWithParams;
726
+ }
727
+
728
+ declare type ICryptoProvider = CryptoUtils_2.ICryptoProvider;
729
+
330
730
  /**
331
731
  * Tree initializer for File System Access API directory handles.
332
732
  * @public
@@ -337,6 +737,8 @@ declare function extractFileListMetadata(fileList: FileList): Array<IFileMetadat
337
737
  readonly nonRecursive?: boolean;
338
738
  }
339
739
 
740
+ declare type IEncryptionResult = CryptoUtils_2.IEncryptionResult;
741
+
340
742
  /**
341
743
  * Tree initializer for File System Access API file handles.
342
744
  * @public
@@ -366,6 +768,34 @@ declare function extractFileListMetadata(fileList: FileList): Array<IFileMetadat
366
768
  lastModified: number;
367
769
  }
368
770
 
771
+ /**
772
+ * Options for creating persistent file trees.
773
+ * @public
774
+ */
775
+ export declare interface IFileSystemAccessTreeParams<TCT extends string = string> extends FileTree.IFileTreeInitParams<TCT> {
776
+ /**
777
+ * Automatically sync changes to disk immediately after each save.
778
+ * If false, changes are batched and written on explicit syncToDisk() call.
779
+ * @defaultValue false
780
+ */
781
+ autoSync?: boolean;
782
+ /**
783
+ * Require write permission on the directory handle.
784
+ * If true, fails if write permission cannot be obtained.
785
+ * If false, falls back to read-only mode.
786
+ * @defaultValue true
787
+ */
788
+ requireWritePermission?: boolean;
789
+ /**
790
+ * Override the path at which the file is stored in the tree (for fromFileHandle).
791
+ * Must be an absolute path (e.g., '/data/confections/common.yaml').
792
+ * If omitted, defaults to `/<filename>`.
793
+ */
794
+ filePath?: string;
795
+ /** Optional logger for auto-sync and persistence failures. */
796
+ logger?: Logging.LogReporter<unknown>;
797
+ }
798
+
369
799
  /**
370
800
  * File System Access API methods available on Window
371
801
  * @public
@@ -376,6 +806,42 @@ declare function extractFileListMetadata(fileList: FileList): Array<IFileMetadat
376
806
  showSaveFilePicker(options?: ShowSaveFilePickerOptions): Promise<FileSystemFileHandle_2>;
377
807
  }
378
808
 
809
+ /**
810
+ * Configuration for creating HTTP-backed tree accessors.
811
+ * @public
812
+ */
813
+ export declare interface IHttpTreeParams<TCT extends string = string> extends FileTree.IFileTreeInitParams<TCT> {
814
+ readonly baseUrl: string;
815
+ readonly namespace?: string;
816
+ readonly autoSync?: boolean;
817
+ readonly fetchImpl?: typeof fetch;
818
+ readonly userId?: string;
819
+ readonly logger?: Logging.LogReporter<unknown>;
820
+ }
821
+
822
+ /**
823
+ * Configuration for LocalStorageTreeAccessors.
824
+ * @public
825
+ */
826
+ export declare interface ILocalStorageTreeParams<TCT extends string = string> extends FileTree.IFileTreeInitParams<TCT> {
827
+ /**
828
+ * Map of directory path prefixes to localStorage keys.
829
+ * Files under each prefix are stored in the corresponding localStorage key.
830
+ * Example: \{ '/data/ingredients': 'myapp:ingredients:v1' \}
831
+ */
832
+ pathToKeyMap: Record<string, string>;
833
+ /**
834
+ * Storage instance to use. Defaults to window.localStorage.
835
+ * Can be overridden for testing with mock storage.
836
+ */
837
+ storage?: Storage;
838
+ /**
839
+ * If true, automatically sync changes to localStorage on every modification.
840
+ * If false (default), changes are only synced when syncToDisk() is called.
841
+ */
842
+ autoSync?: boolean;
843
+ }
844
+
379
845
  /**
380
846
  * Type guard to check if a FileSystemHandle is a directory handle
381
847
  * @param handle - The handle to check
@@ -457,6 +923,123 @@ declare function extractFileListMetadata(fileList: FileList): Array<IFileMetadat
457
923
  zipFile?: string;
458
924
  }
459
925
 
926
+ /**
927
+ * Browser localStorage-backed file tree accessors with persistence support.
928
+ *
929
+ * Maps filesystem-like directory paths to localStorage keys, where each key stores
930
+ * multiple collections as a JSON object. This provides a general-purpose implementation
931
+ * for browser-based file tree persistence without requiring File System Access API.
932
+ *
933
+ * Storage format per key: `{ "collection-id": "<raw file content>" }`
934
+ * File paths map as: `/data/ingredients/collection-id.yaml` → stored in key for `/data/ingredients`
935
+ *
936
+ * Legacy format (v1): `{ "collection-id": { ...parsedJsonObject } }` is auto-migrated on load.
937
+ *
938
+ * @public
939
+ */
940
+ export declare class LocalStorageTreeAccessors<TCT extends string = string> extends FileTree.InMemoryTreeAccessors<TCT> implements FileTree.IPersistentFileTreeAccessors<TCT> {
941
+ private readonly _storage;
942
+ private readonly _pathToKeyMap;
943
+ private readonly _keyToPathMap;
944
+ private readonly _dirtyFiles;
945
+ private readonly _autoSync;
946
+ /**
947
+ * Private constructor. Use fromStorage() factory method instead.
948
+ * @internal
949
+ */
950
+ private constructor();
951
+ /**
952
+ * Create LocalStorageTreeAccessors from browser localStorage.
953
+ * Loads all collections from the configured storage keys.
954
+ *
955
+ * @param params - Configuration including path-to-key mappings
956
+ * @returns Result containing the accessors or an error
957
+ * @public
958
+ */
959
+ static fromStorage<TCT extends string = string>(params: ILocalStorageTreeParams<TCT>): Result<LocalStorageTreeAccessors<TCT>>;
960
+ /**
961
+ * Load all files from localStorage based on path-to-key mappings.
962
+ * @internal
963
+ */
964
+ private static _loadFromStorage;
965
+ /**
966
+ * Heuristic check: does the content look like JSON?
967
+ * @internal
968
+ */
969
+ private static _looksLikeJson;
970
+ /**
971
+ * Join path components, handling leading/trailing slashes.
972
+ * @internal
973
+ */
974
+ private static _joinPath;
975
+ /**
976
+ * Get the storage key for a given file path.
977
+ * @internal
978
+ */
979
+ private _getStorageKeyForPath;
980
+ /**
981
+ * Get the data path prefix for a given file path.
982
+ * @internal
983
+ */
984
+ private _getDataPathForPath;
985
+ /**
986
+ * Extract collection ID from a file path.
987
+ * Example: '/data/ingredients/my-collection.yaml' → 'my-collection'
988
+ * @internal
989
+ */
990
+ private _getCollectionIdFromPath;
991
+ /**
992
+ * Remove a file's entry from its localStorage key.
993
+ * @internal
994
+ */
995
+ private _deleteFileFromStorage;
996
+ /**
997
+ * Sync a single dirty file to localStorage.
998
+ * @internal
999
+ */
1000
+ private _syncFile;
1001
+ /**
1002
+ * Sync all dirty files to localStorage.
1003
+ * @returns Result indicating success or failure
1004
+ * @public
1005
+ */
1006
+ syncToDisk(): Promise<Result<void>>;
1007
+ /**
1008
+ * Check if there are unsaved changes.
1009
+ * @returns True if there are dirty files
1010
+ * @public
1011
+ */
1012
+ isDirty(): boolean;
1013
+ /**
1014
+ * Get list of file paths with unsaved changes.
1015
+ * @returns Array of dirty file paths
1016
+ * @public
1017
+ */
1018
+ getDirtyPaths(): string[];
1019
+ /**
1020
+ * Delete a file and remove it from localStorage.
1021
+ * @param path - File path to delete
1022
+ * @returns Result with true if deleted, or error
1023
+ * @public
1024
+ */
1025
+ deleteFile(path: string): Result<boolean>;
1026
+ /**
1027
+ * Save file contents. Marks file as dirty and optionally auto-syncs.
1028
+ * @param path - File path
1029
+ * @param contents - New file contents
1030
+ * @returns Result with the saved contents or error
1031
+ * @public
1032
+ */
1033
+ saveFileContents(path: string, contents: string): Result<string>;
1034
+ /**
1035
+ * Check if a file is mutable and return persistence detail.
1036
+ * @param path - File path to check
1037
+ * @returns DetailedResult with mutability status and 'persistent' detail if mutable
1038
+ * @public
1039
+ */
1040
+ fileIsMutable(path: string): DetailedResult<boolean, FileTree.SaveDetail>;
1041
+ }
1042
+
460
1043
  /**
461
1044
  * Converts context filter token to context object
462
1045
  * Example: "language=en-US|territory=US" -\> \{ language: "en-US", territory: "US" \}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.54.0"
8
+ "packageVersion": "7.57.6"
9
9
  }
10
10
  ]
11
11
  }
@@ -0,0 +1,18 @@
1
+ [**@fgv/ts-web-extras**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@fgv/ts-web-extras](../../../README.md) / CryptoUtils
6
+
7
+ # CryptoUtils
8
+
9
+ Browser-compatible cryptographic utilities using the Web Crypto API.
10
+
11
+ ## Classes
12
+
13
+ - [BrowserCryptoProvider](classes/BrowserCryptoProvider.md)
14
+ - [BrowserHashProvider](classes/BrowserHashProvider.md)
15
+
16
+ ## Functions
17
+
18
+ - [createBrowserCryptoProvider](functions/createBrowserCryptoProvider.md)