@fgv/ts-res-ui-components 5.0.0-10

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 (231) hide show
  1. package/.rush/temp/03c8b056281d9db0a97d8a6e25eea798a160d393.tar.log +271 -0
  2. package/.rush/temp/chunked-rush-logs/ts-res-ui-components.build.chunks.jsonl +9 -0
  3. package/.rush/temp/operation/build/all.log +9 -0
  4. package/.rush/temp/operation/build/log-chunks.jsonl +9 -0
  5. package/.rush/temp/operation/build/state.json +3 -0
  6. package/.rush/temp/shrinkwrap-deps.json +1111 -0
  7. package/README.md +18 -0
  8. package/REFACTORING_PLAN.md +171 -0
  9. package/config/jest.config.json +16 -0
  10. package/config/jest.setup.js +64 -0
  11. package/config/rig.json +16 -0
  12. package/lib/components/common/QualifierContextControl.d.ts +14 -0
  13. package/lib/components/common/QualifierContextControl.d.ts.map +1 -0
  14. package/lib/components/common/QualifierContextControl.js +78 -0
  15. package/lib/components/common/QualifierContextControl.js.map +1 -0
  16. package/lib/components/common/ResourceListView.d.ts +11 -0
  17. package/lib/components/common/ResourceListView.d.ts.map +1 -0
  18. package/lib/components/common/ResourceListView.js +20 -0
  19. package/lib/components/common/ResourceListView.js.map +1 -0
  20. package/lib/components/common/ResourceTreeView.d.ts +12 -0
  21. package/lib/components/common/ResourceTreeView.d.ts.map +1 -0
  22. package/lib/components/common/ResourceTreeView.js +162 -0
  23. package/lib/components/common/ResourceTreeView.js.map +1 -0
  24. package/lib/components/forms/HierarchyEditor.d.ts +10 -0
  25. package/lib/components/forms/HierarchyEditor.d.ts.map +1 -0
  26. package/lib/components/forms/HierarchyEditor.js +106 -0
  27. package/lib/components/forms/HierarchyEditor.js.map +1 -0
  28. package/lib/components/forms/QualifierEditForm.d.ts +11 -0
  29. package/lib/components/forms/QualifierEditForm.d.ts.map +1 -0
  30. package/lib/components/forms/QualifierEditForm.js +181 -0
  31. package/lib/components/forms/QualifierEditForm.js.map +1 -0
  32. package/lib/components/forms/QualifierTypeEditForm.d.ts +10 -0
  33. package/lib/components/forms/QualifierTypeEditForm.d.ts.map +1 -0
  34. package/lib/components/forms/QualifierTypeEditForm.js +172 -0
  35. package/lib/components/forms/QualifierTypeEditForm.js.map +1 -0
  36. package/lib/components/forms/ResourceTypeEditForm.d.ts +10 -0
  37. package/lib/components/forms/ResourceTypeEditForm.d.ts.map +1 -0
  38. package/lib/components/forms/ResourceTypeEditForm.js +188 -0
  39. package/lib/components/forms/ResourceTypeEditForm.js.map +1 -0
  40. package/lib/components/forms/index.d.ts +9 -0
  41. package/lib/components/forms/index.d.ts.map +1 -0
  42. package/lib/components/forms/index.js +5 -0
  43. package/lib/components/forms/index.js.map +1 -0
  44. package/lib/components/orchestrator/ResourceOrchestrator.d.ts +14 -0
  45. package/lib/components/orchestrator/ResourceOrchestrator.d.ts.map +1 -0
  46. package/lib/components/orchestrator/ResourceOrchestrator.js +278 -0
  47. package/lib/components/orchestrator/ResourceOrchestrator.js.map +1 -0
  48. package/lib/components/views/CompiledView/index.d.ts +5 -0
  49. package/lib/components/views/CompiledView/index.d.ts.map +1 -0
  50. package/lib/components/views/CompiledView/index.js +595 -0
  51. package/lib/components/views/CompiledView/index.js.map +1 -0
  52. package/lib/components/views/ConfigurationView/index.d.ts +5 -0
  53. package/lib/components/views/ConfigurationView/index.d.ts.map +1 -0
  54. package/lib/components/views/ConfigurationView/index.js +363 -0
  55. package/lib/components/views/ConfigurationView/index.js.map +1 -0
  56. package/lib/components/views/FilterView/index.d.ts +5 -0
  57. package/lib/components/views/FilterView/index.d.ts.map +1 -0
  58. package/lib/components/views/FilterView/index.js +463 -0
  59. package/lib/components/views/FilterView/index.js.map +1 -0
  60. package/lib/components/views/ImportView/index.d.ts +5 -0
  61. package/lib/components/views/ImportView/index.d.ts.map +1 -0
  62. package/lib/components/views/ImportView/index.js +514 -0
  63. package/lib/components/views/ImportView/index.js.map +1 -0
  64. package/lib/components/views/ResolutionView/EditableJsonView.d.ts +21 -0
  65. package/lib/components/views/ResolutionView/EditableJsonView.d.ts.map +1 -0
  66. package/lib/components/views/ResolutionView/EditableJsonView.js +109 -0
  67. package/lib/components/views/ResolutionView/EditableJsonView.js.map +1 -0
  68. package/lib/components/views/ResolutionView/ResolutionEditControls.d.ts +19 -0
  69. package/lib/components/views/ResolutionView/ResolutionEditControls.d.ts.map +1 -0
  70. package/lib/components/views/ResolutionView/ResolutionEditControls.js +82 -0
  71. package/lib/components/views/ResolutionView/ResolutionEditControls.js.map +1 -0
  72. package/lib/components/views/ResolutionView/index.d.ts +5 -0
  73. package/lib/components/views/ResolutionView/index.d.ts.map +1 -0
  74. package/lib/components/views/ResolutionView/index.js +255 -0
  75. package/lib/components/views/ResolutionView/index.js.map +1 -0
  76. package/lib/components/views/SourceView/index.d.ts +5 -0
  77. package/lib/components/views/SourceView/index.d.ts.map +1 -0
  78. package/lib/components/views/SourceView/index.js +316 -0
  79. package/lib/components/views/SourceView/index.js.map +1 -0
  80. package/lib/components/views/ZipLoaderView/index.d.ts +5 -0
  81. package/lib/components/views/ZipLoaderView/index.d.ts.map +1 -0
  82. package/lib/components/views/ZipLoaderView/index.js +313 -0
  83. package/lib/components/views/ZipLoaderView/index.js.map +1 -0
  84. package/lib/hooks/useConfigurationState.d.ts +46 -0
  85. package/lib/hooks/useConfigurationState.d.ts.map +1 -0
  86. package/lib/hooks/useConfigurationState.js +239 -0
  87. package/lib/hooks/useConfigurationState.js.map +1 -0
  88. package/lib/hooks/useFilterState.d.ts +7 -0
  89. package/lib/hooks/useFilterState.d.ts.map +1 -0
  90. package/lib/hooks/useFilterState.js +80 -0
  91. package/lib/hooks/useFilterState.js.map +1 -0
  92. package/lib/hooks/useResolutionState.d.ts +8 -0
  93. package/lib/hooks/useResolutionState.d.ts.map +1 -0
  94. package/lib/hooks/useResolutionState.js +253 -0
  95. package/lib/hooks/useResolutionState.js.map +1 -0
  96. package/lib/hooks/useResourceData.d.ts +19 -0
  97. package/lib/hooks/useResourceData.d.ts.map +1 -0
  98. package/lib/hooks/useResourceData.js +368 -0
  99. package/lib/hooks/useResourceData.js.map +1 -0
  100. package/lib/hooks/useViewState.d.ts +10 -0
  101. package/lib/hooks/useViewState.d.ts.map +1 -0
  102. package/lib/hooks/useViewState.js +29 -0
  103. package/lib/hooks/useViewState.js.map +1 -0
  104. package/lib/index.d.ts +27 -0
  105. package/lib/index.d.ts.map +1 -0
  106. package/lib/index.js +34 -0
  107. package/lib/index.js.map +1 -0
  108. package/lib/test/helpers/testDataLoader.d.ts +37 -0
  109. package/lib/test/helpers/testDataLoader.d.ts.map +1 -0
  110. package/lib/test/helpers/testDataLoader.js +171 -0
  111. package/lib/test/helpers/testDataLoader.js.map +1 -0
  112. package/lib/test/unit/utils/configurationUtils.test.d.ts +2 -0
  113. package/lib/test/unit/utils/configurationUtils.test.d.ts.map +1 -0
  114. package/lib/test/unit/utils/configurationUtils.test.js +497 -0
  115. package/lib/test/unit/utils/configurationUtils.test.js.map +1 -0
  116. package/lib/test/unit/utils/fileProcessing.test.d.ts +2 -0
  117. package/lib/test/unit/utils/fileProcessing.test.d.ts.map +1 -0
  118. package/lib/test/unit/utils/fileProcessing.test.js +321 -0
  119. package/lib/test/unit/utils/fileProcessing.test.js.map +1 -0
  120. package/lib/test/unit/utils/filterResources.test.d.ts +2 -0
  121. package/lib/test/unit/utils/filterResources.test.d.ts.map +1 -0
  122. package/lib/test/unit/utils/filterResources.test.js +403 -0
  123. package/lib/test/unit/utils/filterResources.test.js.map +1 -0
  124. package/lib/test/unit/utils/resolutionEditing.test.d.ts +2 -0
  125. package/lib/test/unit/utils/resolutionEditing.test.d.ts.map +1 -0
  126. package/lib/test/unit/utils/resolutionEditing.test.js +439 -0
  127. package/lib/test/unit/utils/resolutionEditing.test.js.map +1 -0
  128. package/lib/test/unit/utils/resolutionUtils.test.d.ts +2 -0
  129. package/lib/test/unit/utils/resolutionUtils.test.d.ts.map +1 -0
  130. package/lib/test/unit/utils/resolutionUtils.test.js +397 -0
  131. package/lib/test/unit/utils/resolutionUtils.test.js.map +1 -0
  132. package/lib/test/unit/utils/tsResIntegration.test.d.ts +2 -0
  133. package/lib/test/unit/utils/tsResIntegration.test.d.ts.map +1 -0
  134. package/lib/test/unit/utils/tsResIntegration.test.js +376 -0
  135. package/lib/test/unit/utils/tsResIntegration.test.js.map +1 -0
  136. package/lib/types/index.d.ts +251 -0
  137. package/lib/types/index.d.ts.map +1 -0
  138. package/lib/types/index.js +2 -0
  139. package/lib/types/index.js.map +1 -0
  140. package/lib/utils/configurationUtils.d.ts +74 -0
  141. package/lib/utils/configurationUtils.d.ts.map +1 -0
  142. package/lib/utils/configurationUtils.js +359 -0
  143. package/lib/utils/configurationUtils.js.map +1 -0
  144. package/lib/utils/fileProcessing.d.ts +18 -0
  145. package/lib/utils/fileProcessing.d.ts.map +1 -0
  146. package/lib/utils/fileProcessing.js +142 -0
  147. package/lib/utils/fileProcessing.js.map +1 -0
  148. package/lib/utils/filterResources.d.ts +38 -0
  149. package/lib/utils/filterResources.d.ts.map +1 -0
  150. package/lib/utils/filterResources.js +153 -0
  151. package/lib/utils/filterResources.js.map +1 -0
  152. package/lib/utils/resolutionEditing.d.ts +58 -0
  153. package/lib/utils/resolutionEditing.d.ts.map +1 -0
  154. package/lib/utils/resolutionEditing.js +246 -0
  155. package/lib/utils/resolutionEditing.js.map +1 -0
  156. package/lib/utils/resolutionUtils.d.ts +28 -0
  157. package/lib/utils/resolutionUtils.d.ts.map +1 -0
  158. package/lib/utils/resolutionUtils.js +216 -0
  159. package/lib/utils/resolutionUtils.js.map +1 -0
  160. package/lib/utils/tsResIntegration.d.ts +71 -0
  161. package/lib/utils/tsResIntegration.d.ts.map +1 -0
  162. package/lib/utils/tsResIntegration.js +294 -0
  163. package/lib/utils/tsResIntegration.js.map +1 -0
  164. package/lib/utils/zipLoader/browserZipLoader.d.ts +48 -0
  165. package/lib/utils/zipLoader/browserZipLoader.d.ts.map +1 -0
  166. package/lib/utils/zipLoader/browserZipLoader.js +247 -0
  167. package/lib/utils/zipLoader/browserZipLoader.js.map +1 -0
  168. package/lib/utils/zipLoader/index.d.ts +8 -0
  169. package/lib/utils/zipLoader/index.d.ts.map +1 -0
  170. package/lib/utils/zipLoader/index.js +13 -0
  171. package/lib/utils/zipLoader/index.js.map +1 -0
  172. package/lib/utils/zipLoader/nodeZipBuilder.d.ts +55 -0
  173. package/lib/utils/zipLoader/nodeZipBuilder.d.ts.map +1 -0
  174. package/lib/utils/zipLoader/nodeZipBuilder.js +98 -0
  175. package/lib/utils/zipLoader/nodeZipBuilder.js.map +1 -0
  176. package/lib/utils/zipLoader/types.d.ts +139 -0
  177. package/lib/utils/zipLoader/types.d.ts.map +1 -0
  178. package/lib/utils/zipLoader/types.js +2 -0
  179. package/lib/utils/zipLoader/types.js.map +1 -0
  180. package/lib/utils/zipLoader/zipUtils.d.ts +53 -0
  181. package/lib/utils/zipLoader/zipUtils.d.ts.map +1 -0
  182. package/lib/utils/zipLoader/zipUtils.js +229 -0
  183. package/lib/utils/zipLoader/zipUtils.js.map +1 -0
  184. package/package.json +69 -0
  185. package/rush-logs/ts-res-ui-components.build.cache.log +3 -0
  186. package/rush-logs/ts-res-ui-components.build.log +9 -0
  187. package/src/components/common/QualifierContextControl.tsx +151 -0
  188. package/src/components/common/ResourceListView.tsx +63 -0
  189. package/src/components/common/ResourceTreeView.tsx +271 -0
  190. package/src/components/forms/HierarchyEditor.tsx +204 -0
  191. package/src/components/forms/QualifierEditForm.tsx +355 -0
  192. package/src/components/forms/QualifierTypeEditForm.tsx +347 -0
  193. package/src/components/forms/ResourceTypeEditForm.tsx +331 -0
  194. package/src/components/forms/index.ts +11 -0
  195. package/src/components/orchestrator/ResourceOrchestrator.tsx +372 -0
  196. package/src/components/views/CompiledView/index.tsx +922 -0
  197. package/src/components/views/ConfigurationView/index.tsx +800 -0
  198. package/src/components/views/FilterView/index.tsx +825 -0
  199. package/src/components/views/ImportView/index.tsx +717 -0
  200. package/src/components/views/ResolutionView/EditableJsonView.tsx +214 -0
  201. package/src/components/views/ResolutionView/ResolutionEditControls.tsx +170 -0
  202. package/src/components/views/ResolutionView/index.tsx +591 -0
  203. package/src/components/views/SourceView/index.tsx +536 -0
  204. package/src/components/views/ZipLoaderView/index.tsx +485 -0
  205. package/src/hooks/useConfigurationState.ts +374 -0
  206. package/src/hooks/useFilterState.ts +97 -0
  207. package/src/hooks/useResolutionState.ts +355 -0
  208. package/src/hooks/useResourceData.ts +467 -0
  209. package/src/hooks/useViewState.ts +44 -0
  210. package/src/index.ts +45 -0
  211. package/src/test/helpers/testDataLoader.ts +195 -0
  212. package/src/test/unit/utils/configurationUtils.test.ts +630 -0
  213. package/src/test/unit/utils/fileProcessing.test.ts +391 -0
  214. package/src/test/unit/utils/filterResources.test.ts +574 -0
  215. package/src/test/unit/utils/resolutionEditing.test.ts +556 -0
  216. package/src/test/unit/utils/resolutionUtils.test.ts +521 -0
  217. package/src/test/unit/utils/tsResIntegration.test.ts +433 -0
  218. package/src/types/index.ts +322 -0
  219. package/src/utils/configurationUtils.ts +424 -0
  220. package/src/utils/fileProcessing.ts +160 -0
  221. package/src/utils/filterResources.ts +206 -0
  222. package/src/utils/resolutionEditing.ts +319 -0
  223. package/src/utils/resolutionUtils.ts +289 -0
  224. package/src/utils/tsResIntegration.ts +440 -0
  225. package/src/utils/zipLoader/browserZipLoader.ts +319 -0
  226. package/src/utils/zipLoader/index.ts +26 -0
  227. package/src/utils/zipLoader/nodeZipBuilder.ts +153 -0
  228. package/src/utils/zipLoader/types.ts +175 -0
  229. package/src/utils/zipLoader/zipUtils.ts +266 -0
  230. package/temp/build/typescript/ts_gZid87Hu.json +1 -0
  231. package/tsconfig.json +15 -0
@@ -0,0 +1,321 @@
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 { readFilesFromInput, filesToDirectory, exportAsJson, exportUsingFileSystemAPI } from '../../../utils/fileProcessing';
24
+ describe('fileProcessing utilities', () => {
25
+ describe('readFilesFromInput', () => {
26
+ test('reads single file from FileList', async () => {
27
+ const mockFile = new File(['test content'], 'test.json', { type: 'application/json' });
28
+ const fileList = {
29
+ length: 1,
30
+ 0: mockFile,
31
+ item: (index) => (index === 0 ? mockFile : null)
32
+ };
33
+ const result = await readFilesFromInput(fileList);
34
+ expect(result).toHaveLength(1);
35
+ expect(result[0]).toEqual({
36
+ name: 'test.json',
37
+ path: 'test.json',
38
+ content: 'test content',
39
+ type: 'application/json'
40
+ });
41
+ });
42
+ test('reads multiple files from FileList', async () => {
43
+ const mockFile1 = new File(['content 1'], 'file1.json', { type: 'application/json' });
44
+ const mockFile2 = new File(['content 2'], 'file2.json', { type: 'application/json' });
45
+ const fileList = {
46
+ length: 2,
47
+ 0: mockFile1,
48
+ 1: mockFile2,
49
+ item: (index) => (index === 0 ? mockFile1 : index === 1 ? mockFile2 : null)
50
+ };
51
+ const result = await readFilesFromInput(fileList);
52
+ expect(result).toHaveLength(2);
53
+ expect(result[0]).toEqual({
54
+ name: 'file1.json',
55
+ path: 'file1.json',
56
+ content: 'content 1',
57
+ type: 'application/json'
58
+ });
59
+ expect(result[1]).toEqual({
60
+ name: 'file2.json',
61
+ path: 'file2.json',
62
+ content: 'content 2',
63
+ type: 'application/json'
64
+ });
65
+ });
66
+ test('handles file with webkitRelativePath', async () => {
67
+ const mockFile = new File(['test content'], 'test.json', {
68
+ type: 'application/json',
69
+ webkitRelativePath: 'folder/test.json'
70
+ });
71
+ const fileList = {
72
+ length: 1,
73
+ 0: mockFile,
74
+ item: (index) => (index === 0 ? mockFile : null)
75
+ };
76
+ const result = await readFilesFromInput(fileList);
77
+ expect(result).toHaveLength(1);
78
+ expect(result[0]).toEqual({
79
+ name: 'test.json',
80
+ path: 'folder/test.json',
81
+ content: 'test content',
82
+ type: 'application/json'
83
+ });
84
+ });
85
+ test('handles empty FileList', async () => {
86
+ const fileList = {
87
+ length: 0,
88
+ item: () => null
89
+ };
90
+ const result = await readFilesFromInput(fileList);
91
+ expect(result).toEqual([]);
92
+ });
93
+ test('handles FileReader error', async () => {
94
+ const mockFile = new File(['test content'], 'test.json', { type: 'application/json' });
95
+ // Override the global FileReader for this test
96
+ const originalFileReader = global.FileReader;
97
+ global.FileReader = class MockErrorFileReader {
98
+ constructor() {
99
+ this.onload = null;
100
+ this.onerror = null;
101
+ }
102
+ readAsText() {
103
+ setTimeout(() => {
104
+ if (this.onerror) {
105
+ this.onerror(new Error('Read error'));
106
+ }
107
+ }, 0);
108
+ }
109
+ };
110
+ const fileList = {
111
+ length: 1,
112
+ 0: mockFile,
113
+ item: (index) => (index === 0 ? mockFile : null)
114
+ };
115
+ await expect(readFilesFromInput(fileList)).rejects.toThrow('Failed to read file test.json');
116
+ // Restore original FileReader
117
+ global.FileReader = originalFileReader;
118
+ });
119
+ });
120
+ describe('filesToDirectory', () => {
121
+ test('creates root directory from files without paths', () => {
122
+ const files = [
123
+ { name: 'file1.json', content: 'content1' },
124
+ { name: 'file2.json', content: 'content2' }
125
+ ];
126
+ const result = filesToDirectory(files);
127
+ expect(result).toEqual({
128
+ name: 'root',
129
+ path: '',
130
+ files: [
131
+ { name: 'file1.json', content: 'content1' },
132
+ { name: 'file2.json', content: 'content2' }
133
+ ],
134
+ subdirectories: []
135
+ });
136
+ });
137
+ test('creates directory structure from files with paths', () => {
138
+ const files = [
139
+ { name: 'root.json', path: 'root.json', content: 'root content' },
140
+ { name: 'sub1.json', path: 'folder1/sub1.json', content: 'sub1 content' },
141
+ { name: 'sub2.json', path: 'folder1/sub2.json', content: 'sub2 content' },
142
+ { name: 'nested.json', path: 'folder1/subfolder/nested.json', content: 'nested content' }
143
+ ];
144
+ const result = filesToDirectory(files);
145
+ expect(result.name).toBe('root');
146
+ expect(result.path).toBe('');
147
+ expect(result.files).toHaveLength(1);
148
+ expect(result.files[0]).toEqual({ name: 'root.json', path: 'root.json', content: 'root content' });
149
+ expect(result.subdirectories).toHaveLength(1);
150
+ const folder1 = result.subdirectories[0];
151
+ expect(folder1.name).toBe('folder1');
152
+ expect(folder1.path).toBe('folder1');
153
+ expect(folder1.files).toHaveLength(2);
154
+ expect(folder1.files[0]).toEqual({
155
+ name: 'sub1.json',
156
+ path: 'folder1/sub1.json',
157
+ content: 'sub1 content'
158
+ });
159
+ expect(folder1.files[1]).toEqual({
160
+ name: 'sub2.json',
161
+ path: 'folder1/sub2.json',
162
+ content: 'sub2 content'
163
+ });
164
+ expect(folder1.subdirectories).toHaveLength(1);
165
+ const subfolder = folder1.subdirectories[0];
166
+ expect(subfolder.name).toBe('subfolder');
167
+ expect(subfolder.path).toBe('folder1/subfolder');
168
+ expect(subfolder.files).toHaveLength(1);
169
+ expect(subfolder.files[0]).toEqual({
170
+ name: 'nested.json',
171
+ path: 'folder1/subfolder/nested.json',
172
+ content: 'nested content'
173
+ });
174
+ });
175
+ test('handles complex nested directory structure', () => {
176
+ const files = [
177
+ { name: 'a.json', path: 'dir1/dir2/a.json', content: 'a' },
178
+ { name: 'b.json', path: 'dir1/b.json', content: 'b' },
179
+ { name: 'c.json', path: 'dir3/c.json', content: 'c' }
180
+ ];
181
+ const result = filesToDirectory(files);
182
+ expect(result.subdirectories).toHaveLength(2);
183
+ const dir1 = result.subdirectories.find((d) => d.name === 'dir1');
184
+ const dir3 = result.subdirectories.find((d) => d.name === 'dir3');
185
+ expect(dir1).toBeDefined();
186
+ expect(dir1.files).toHaveLength(1);
187
+ expect(dir1.files[0].name).toBe('b.json');
188
+ expect(dir1.subdirectories).toHaveLength(1);
189
+ expect(dir1.subdirectories[0].name).toBe('dir2');
190
+ expect(dir3).toBeDefined();
191
+ expect(dir3.files).toHaveLength(1);
192
+ expect(dir3.files[0].name).toBe('c.json');
193
+ expect(dir3.subdirectories).toHaveLength(0);
194
+ });
195
+ test('handles empty file list', () => {
196
+ const result = filesToDirectory([]);
197
+ expect(result).toEqual({
198
+ name: 'root',
199
+ path: '',
200
+ files: [],
201
+ subdirectories: []
202
+ });
203
+ });
204
+ test('handles files with mixed path and no-path entries', () => {
205
+ const files = [
206
+ { name: 'root.json', content: 'root' },
207
+ { name: 'sub.json', path: 'folder/sub.json', content: 'sub' }
208
+ ];
209
+ const result = filesToDirectory(files);
210
+ expect(result.files).toHaveLength(1);
211
+ expect(result.files[0].name).toBe('root.json');
212
+ expect(result.subdirectories).toHaveLength(1);
213
+ expect(result.subdirectories[0].name).toBe('folder');
214
+ });
215
+ });
216
+ describe('exportAsJson', () => {
217
+ beforeEach(() => {
218
+ // Reset mocks before each test
219
+ jest.clearAllMocks();
220
+ });
221
+ test('creates blob and triggers download', () => {
222
+ const testData = { test: 'data' };
223
+ const filename = 'test.json';
224
+ // Test completes without errors
225
+ expect(() => exportAsJson(testData, filename)).not.toThrow();
226
+ // Verify that URL methods were called (functional behavior)
227
+ expect(URL.createObjectURL).toHaveBeenCalled();
228
+ expect(URL.revokeObjectURL).toHaveBeenCalled();
229
+ // Verify blob was created with correct type
230
+ const blobArg = URL.createObjectURL.mock.calls[0][0];
231
+ expect(blobArg).toBeInstanceOf(Blob);
232
+ expect(blobArg.type).toBe('application/json');
233
+ });
234
+ test('handles complex data structures', () => {
235
+ const complexData = {
236
+ array: [1, 2, 3],
237
+ nested: { inner: 'value' },
238
+ nullValue: null,
239
+ boolValue: true
240
+ };
241
+ exportAsJson(complexData, 'complex.json');
242
+ expect(URL.createObjectURL).toHaveBeenCalled();
243
+ const blobArg = URL.createObjectURL.mock.calls[0][0];
244
+ expect(blobArg).toBeInstanceOf(Blob);
245
+ });
246
+ });
247
+ describe('exportUsingFileSystemAPI', () => {
248
+ test('returns false when File System Access API is not available', async () => {
249
+ const originalShowSaveFilePicker = window.showSaveFilePicker;
250
+ delete window.showSaveFilePicker;
251
+ const result = await exportUsingFileSystemAPI({ test: 'data' }, 'test.json');
252
+ expect(result).toBe(false);
253
+ window.showSaveFilePicker = originalShowSaveFilePicker;
254
+ });
255
+ test('successfully exports when File System Access API is available', async () => {
256
+ const mockWritable = {
257
+ write: jest.fn().mockResolvedValue(undefined),
258
+ close: jest.fn().mockResolvedValue(undefined)
259
+ };
260
+ const mockFileHandle = {
261
+ createWritable: jest.fn().mockResolvedValue(mockWritable)
262
+ };
263
+ const mockShowSaveFilePicker = jest.fn().mockResolvedValue(mockFileHandle);
264
+ window.showSaveFilePicker = mockShowSaveFilePicker;
265
+ const testData = { test: 'data' };
266
+ const result = await exportUsingFileSystemAPI(testData, 'test.json', 'Test files');
267
+ expect(result).toBe(true);
268
+ expect(mockShowSaveFilePicker).toHaveBeenCalledWith({
269
+ suggestedName: 'test.json',
270
+ types: [
271
+ {
272
+ description: 'Test files',
273
+ accept: {
274
+ 'application/json': ['.json']
275
+ }
276
+ }
277
+ ]
278
+ });
279
+ expect(mockFileHandle.createWritable).toHaveBeenCalledTimes(1);
280
+ expect(mockWritable.write).toHaveBeenCalledWith(JSON.stringify(testData, null, 2));
281
+ expect(mockWritable.close).toHaveBeenCalledTimes(1);
282
+ });
283
+ test('returns false when user cancels (AbortError)', async () => {
284
+ const mockShowSaveFilePicker = jest
285
+ .fn()
286
+ .mockRejectedValue(Object.assign(new Error('User cancelled'), { name: 'AbortError' }));
287
+ window.showSaveFilePicker = mockShowSaveFilePicker;
288
+ const result = await exportUsingFileSystemAPI({ test: 'data' }, 'test.json');
289
+ expect(result).toBe(false);
290
+ });
291
+ test('throws error for non-AbortError exceptions', async () => {
292
+ const mockShowSaveFilePicker = jest.fn().mockRejectedValue(new Error('Permission denied'));
293
+ window.showSaveFilePicker = mockShowSaveFilePicker;
294
+ await expect(exportUsingFileSystemAPI({ test: 'data' }, 'test.json')).rejects.toThrow('Permission denied');
295
+ });
296
+ test('uses default description when none provided', async () => {
297
+ const mockWritable = {
298
+ write: jest.fn().mockResolvedValue(undefined),
299
+ close: jest.fn().mockResolvedValue(undefined)
300
+ };
301
+ const mockFileHandle = {
302
+ createWritable: jest.fn().mockResolvedValue(mockWritable)
303
+ };
304
+ const mockShowSaveFilePicker = jest.fn().mockResolvedValue(mockFileHandle);
305
+ window.showSaveFilePicker = mockShowSaveFilePicker;
306
+ await exportUsingFileSystemAPI({ test: 'data' }, 'test.json');
307
+ expect(mockShowSaveFilePicker).toHaveBeenCalledWith({
308
+ suggestedName: 'test.json',
309
+ types: [
310
+ {
311
+ description: 'JSON files',
312
+ accept: {
313
+ 'application/json': ['.json']
314
+ }
315
+ }
316
+ ]
317
+ });
318
+ });
319
+ });
320
+ });
321
+ //# sourceMappingURL=fileProcessing.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileProcessing.test.js","sourceRoot":"","sources":["../../../../src/test/unit/utils/fileProcessing.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AAGvC,QA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AC,iBAAiB,CAAC,SAAS,CAAC;gBAC7C,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;aAC9C,CAAC;YACF,MAAM,cAAc,GAAG;gBACrB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,YAAY,CAAC;aAC1D,CAAC;YACF,MAAM,sBAAsB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;YAE1E,MAAc,CAAC,kBAAkB,GAAG,sBAAsB,CAAC;YAE5D,MAAM,wBAAwB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,CAAC;YAE9D,MAAM,CAAC,sBAAsB,CAAC,CAAC,oBAAoB,CAAC;gBAClD,aAAa,EAAE,WAAW;gBAC1B,KAAK,EAAE;oBACL;wBACE,WAAW,EAAE,YAAY;wBACzB,MAAM,EAAE;4BACN,kBAAkB,EAAE,CAAC,OAAO,CAAC;yBAC9B;qBACF;iBACF;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,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 '@fgv/ts-utils-jest';\nimport {\n readFilesFromInput,\n filesToDirectory,\n exportAsJson,\n exportUsingFileSystemAPI\n} from '../../../utils/fileProcessing';\nimport { ImportedFile } from '../../../types';\n\ndescribe('fileProcessing utilities', () => {\n describe('readFilesFromInput', () => {\n test('reads single file from FileList', async () => {\n const mockFile = new File(['test content'], 'test.json', { type: 'application/json' });\n const fileList = {\n length: 1,\n 0: mockFile,\n item: (index: number) => (index === 0 ? mockFile : null)\n } as FileList;\n\n const result = await readFilesFromInput(fileList);\n\n expect(result).toHaveLength(1);\n expect(result[0]).toEqual({\n name: 'test.json',\n path: 'test.json',\n content: 'test content',\n type: 'application/json'\n });\n });\n\n test('reads multiple files from FileList', async () => {\n const mockFile1 = new File(['content 1'], 'file1.json', { type: 'application/json' });\n const mockFile2 = new File(['content 2'], 'file2.json', { type: 'application/json' });\n const fileList = {\n length: 2,\n 0: mockFile1,\n 1: mockFile2,\n item: (index: number) => (index === 0 ? mockFile1 : index === 1 ? mockFile2 : null)\n } as FileList;\n\n const result = await readFilesFromInput(fileList);\n\n expect(result).toHaveLength(2);\n expect(result[0]).toEqual({\n name: 'file1.json',\n path: 'file1.json',\n content: 'content 1',\n type: 'application/json'\n });\n expect(result[1]).toEqual({\n name: 'file2.json',\n path: 'file2.json',\n content: 'content 2',\n type: 'application/json'\n });\n });\n\n test('handles file with webkitRelativePath', async () => {\n const mockFile = new File(['test content'], 'test.json', {\n type: 'application/json',\n webkitRelativePath: 'folder/test.json'\n } as any);\n\n const fileList = {\n length: 1,\n 0: mockFile,\n item: (index: number) => (index === 0 ? mockFile : null)\n } as FileList;\n\n const result = await readFilesFromInput(fileList);\n\n expect(result).toHaveLength(1);\n expect(result[0]).toEqual({\n name: 'test.json',\n path: 'folder/test.json',\n content: 'test content',\n type: 'application/json'\n });\n });\n\n test('handles empty FileList', async () => {\n const fileList = {\n length: 0,\n item: () => null\n } as FileList;\n\n const result = await readFilesFromInput(fileList);\n\n expect(result).toEqual([]);\n });\n\n test('handles FileReader error', async () => {\n const mockFile = new File(['test content'], 'test.json', { type: 'application/json' });\n\n // Override the global FileReader for this test\n const originalFileReader = global.FileReader;\n global.FileReader = class MockErrorFileReader {\n onload: ((event: any) => void) | null = null;\n onerror: ((event: any) => void) | null = null;\n readAsText() {\n setTimeout(() => {\n if (this.onerror) {\n this.onerror(new Error('Read error'));\n }\n }, 0);\n }\n } as any;\n\n const fileList = {\n length: 1,\n 0: mockFile,\n item: (index: number) => (index === 0 ? mockFile : null)\n } as FileList;\n\n await expect(readFilesFromInput(fileList)).rejects.toThrow('Failed to read file test.json');\n\n // Restore original FileReader\n global.FileReader = originalFileReader;\n });\n });\n\n describe('filesToDirectory', () => {\n test('creates root directory from files without paths', () => {\n const files: ImportedFile[] = [\n { name: 'file1.json', content: 'content1' },\n { name: 'file2.json', content: 'content2' }\n ];\n\n const result = filesToDirectory(files);\n\n expect(result).toEqual({\n name: 'root',\n path: '',\n files: [\n { name: 'file1.json', content: 'content1' },\n { name: 'file2.json', content: 'content2' }\n ],\n subdirectories: []\n });\n });\n\n test('creates directory structure from files with paths', () => {\n const files: ImportedFile[] = [\n { name: 'root.json', path: 'root.json', content: 'root content' },\n { name: 'sub1.json', path: 'folder1/sub1.json', content: 'sub1 content' },\n { name: 'sub2.json', path: 'folder1/sub2.json', content: 'sub2 content' },\n { name: 'nested.json', path: 'folder1/subfolder/nested.json', content: 'nested content' }\n ];\n\n const result = filesToDirectory(files);\n\n expect(result.name).toBe('root');\n expect(result.path).toBe('');\n expect(result.files).toHaveLength(1);\n expect(result.files[0]).toEqual({ name: 'root.json', path: 'root.json', content: 'root content' });\n expect(result.subdirectories).toHaveLength(1);\n\n const folder1 = result.subdirectories![0];\n expect(folder1.name).toBe('folder1');\n expect(folder1.path).toBe('folder1');\n expect(folder1.files).toHaveLength(2);\n expect(folder1.files[0]).toEqual({\n name: 'sub1.json',\n path: 'folder1/sub1.json',\n content: 'sub1 content'\n });\n expect(folder1.files[1]).toEqual({\n name: 'sub2.json',\n path: 'folder1/sub2.json',\n content: 'sub2 content'\n });\n expect(folder1.subdirectories).toHaveLength(1);\n\n const subfolder = folder1.subdirectories![0];\n expect(subfolder.name).toBe('subfolder');\n expect(subfolder.path).toBe('folder1/subfolder');\n expect(subfolder.files).toHaveLength(1);\n expect(subfolder.files[0]).toEqual({\n name: 'nested.json',\n path: 'folder1/subfolder/nested.json',\n content: 'nested content'\n });\n });\n\n test('handles complex nested directory structure', () => {\n const files: ImportedFile[] = [\n { name: 'a.json', path: 'dir1/dir2/a.json', content: 'a' },\n { name: 'b.json', path: 'dir1/b.json', content: 'b' },\n { name: 'c.json', path: 'dir3/c.json', content: 'c' }\n ];\n\n const result = filesToDirectory(files);\n\n expect(result.subdirectories).toHaveLength(2);\n\n const dir1 = result.subdirectories!.find((d) => d.name === 'dir1');\n const dir3 = result.subdirectories!.find((d) => d.name === 'dir3');\n\n expect(dir1).toBeDefined();\n expect(dir1!.files).toHaveLength(1);\n expect(dir1!.files[0].name).toBe('b.json');\n expect(dir1!.subdirectories).toHaveLength(1);\n expect(dir1!.subdirectories![0].name).toBe('dir2');\n\n expect(dir3).toBeDefined();\n expect(dir3!.files).toHaveLength(1);\n expect(dir3!.files[0].name).toBe('c.json');\n expect(dir3!.subdirectories).toHaveLength(0);\n });\n\n test('handles empty file list', () => {\n const result = filesToDirectory([]);\n\n expect(result).toEqual({\n name: 'root',\n path: '',\n files: [],\n subdirectories: []\n });\n });\n\n test('handles files with mixed path and no-path entries', () => {\n const files: ImportedFile[] = [\n { name: 'root.json', content: 'root' },\n { name: 'sub.json', path: 'folder/sub.json', content: 'sub' }\n ];\n\n const result = filesToDirectory(files);\n\n expect(result.files).toHaveLength(1);\n expect(result.files[0].name).toBe('root.json');\n expect(result.subdirectories).toHaveLength(1);\n expect(result.subdirectories![0].name).toBe('folder');\n });\n });\n\n describe('exportAsJson', () => {\n beforeEach(() => {\n // Reset mocks before each test\n jest.clearAllMocks();\n });\n\n test('creates blob and triggers download', () => {\n const testData = { test: 'data' };\n const filename = 'test.json';\n\n // Test completes without errors\n expect(() => exportAsJson(testData, filename)).not.toThrow();\n\n // Verify that URL methods were called (functional behavior)\n expect(URL.createObjectURL).toHaveBeenCalled();\n expect(URL.revokeObjectURL).toHaveBeenCalled();\n\n // Verify blob was created with correct type\n const blobArg = (URL.createObjectURL as jest.Mock).mock.calls[0][0];\n expect(blobArg).toBeInstanceOf(Blob);\n expect(blobArg.type).toBe('application/json');\n });\n\n test('handles complex data structures', () => {\n const complexData = {\n array: [1, 2, 3],\n nested: { inner: 'value' },\n nullValue: null,\n boolValue: true\n };\n\n exportAsJson(complexData, 'complex.json');\n\n expect(URL.createObjectURL).toHaveBeenCalled();\n const blobArg = (URL.createObjectURL as jest.Mock).mock.calls[0][0];\n expect(blobArg).toBeInstanceOf(Blob);\n });\n });\n\n describe('exportUsingFileSystemAPI', () => {\n test('returns false when File System Access API is not available', async () => {\n const originalShowSaveFilePicker = (window as any).showSaveFilePicker;\n delete (window as any).showSaveFilePicker;\n\n const result = await exportUsingFileSystemAPI({ test: 'data' }, 'test.json');\n\n expect(result).toBe(false);\n\n (window as any).showSaveFilePicker = originalShowSaveFilePicker;\n });\n\n test('successfully exports when File System Access API is available', async () => {\n const mockWritable = {\n write: jest.fn().mockResolvedValue(undefined),\n close: jest.fn().mockResolvedValue(undefined)\n };\n const mockFileHandle = {\n createWritable: jest.fn().mockResolvedValue(mockWritable)\n };\n const mockShowSaveFilePicker = jest.fn().mockResolvedValue(mockFileHandle);\n\n (window as any).showSaveFilePicker = mockShowSaveFilePicker;\n\n const testData = { test: 'data' };\n const result = await exportUsingFileSystemAPI(testData, 'test.json', 'Test files');\n\n expect(result).toBe(true);\n expect(mockShowSaveFilePicker).toHaveBeenCalledWith({\n suggestedName: 'test.json',\n types: [\n {\n description: 'Test files',\n accept: {\n 'application/json': ['.json']\n }\n }\n ]\n });\n expect(mockFileHandle.createWritable).toHaveBeenCalledTimes(1);\n expect(mockWritable.write).toHaveBeenCalledWith(JSON.stringify(testData, null, 2));\n expect(mockWritable.close).toHaveBeenCalledTimes(1);\n });\n\n test('returns false when user cancels (AbortError)', async () => {\n const mockShowSaveFilePicker = jest\n .fn()\n .mockRejectedValue(Object.assign(new Error('User cancelled'), { name: 'AbortError' }));\n\n (window as any).showSaveFilePicker = mockShowSaveFilePicker;\n\n const result = await exportUsingFileSystemAPI({ test: 'data' }, 'test.json');\n\n expect(result).toBe(false);\n });\n\n test('throws error for non-AbortError exceptions', async () => {\n const mockShowSaveFilePicker = jest.fn().mockRejectedValue(new Error('Permission denied'));\n\n (window as any).showSaveFilePicker = mockShowSaveFilePicker;\n\n await expect(exportUsingFileSystemAPI({ test: 'data' }, 'test.json')).rejects.toThrow(\n 'Permission denied'\n );\n });\n\n test('uses default description when none provided', async () => {\n const mockWritable = {\n write: jest.fn().mockResolvedValue(undefined),\n close: jest.fn().mockResolvedValue(undefined)\n };\n const mockFileHandle = {\n createWritable: jest.fn().mockResolvedValue(mockWritable)\n };\n const mockShowSaveFilePicker = jest.fn().mockResolvedValue(mockFileHandle);\n\n (window as any).showSaveFilePicker = mockShowSaveFilePicker;\n\n await exportUsingFileSystemAPI({ test: 'data' }, 'test.json');\n\n expect(mockShowSaveFilePicker).toHaveBeenCalledWith({\n suggestedName: 'test.json',\n types: [\n {\n description: 'JSON files',\n accept: {\n 'application/json': ['.json']\n }\n }\n ]\n });\n });\n });\n});\n"]}
@@ -0,0 +1,2 @@
1
+ import '@fgv/ts-utils-jest';
2
+ //# sourceMappingURL=filterResources.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterResources.test.d.ts","sourceRoot":"","sources":["../../../../src/test/unit/utils/filterResources.test.ts"],"names":[],"mappings":"AAsBA,OAAO,oBAAoB,CAAC"}