@hamak/ui-remote-fs 0.9.2 → 0.9.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"store-sync-middleware.d.ts","sourceRoot":"","sources":["../../../src/impl/middleware/store-sync-middleware.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAa,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAYtD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,GAAG,EAC/C,MAAM,EAAE,yBAAyB,GAChC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CA2KnB;AAED,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"store-sync-middleware.d.ts","sourceRoot":"","sources":["../../../src/impl/middleware/store-sync-middleware.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAa,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAYtD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,GAAG,EAC/C,MAAM,EAAE,yBAAyB,GAChC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CAoLnB;AAED,eAAe,yBAAyB,CAAC"}
@@ -33,7 +33,7 @@ import { decodeFileContent } from './file-content-type.js';
33
33
  * ```
34
34
  */
35
35
  export function createStoreSyncMiddleware(config) {
36
- const { fileSystemAdapter, pathTranslator, autoReload = true, transformContent, scopeToMount = false, } = config;
36
+ const { fileSystemAdapter, pathTranslator, autoReload = true, transformContent, scopeToMount = false, onContentError, } = config;
37
37
  const storeFsActions = fileSystemAdapter.getActions();
38
38
  // Selects the fs slice out of root state for the existence probe below.
39
39
  // Defaults to the adapter's own slice key (`'fs'` in the canonical store) so a
@@ -110,7 +110,16 @@ export function createStoreSyncMiddleware(config) {
110
110
  const fileName = data?.name ?? localPath[localPath.length - 1] ?? '';
111
111
  const decoded = decodeFileContent(fileName, data?.content);
112
112
  if (decoded.error) {
113
- console.warn(`[ui-remote-fs] store-sync: ${fileName} claims to be JSON but failed to parse; storing raw text.`, decoded.error);
113
+ // Reporting only — the failure is already contained by
114
+ // decodeFileContent, which falls back to the raw text. A host that
115
+ // supplies onContentError takes over the reporting entirely, so it
116
+ // does not get its own message plus ours.
117
+ if (onContentError) {
118
+ onContentError(decoded.error, localPath, data?.content ?? '');
119
+ }
120
+ else {
121
+ console.warn(`[ui-remote-fs] store-sync: ${fileName} claims to be JSON but failed to parse; storing raw text.`, decoded.error);
122
+ }
114
123
  }
115
124
  let content = decoded.content;
116
125
  // Apply content transform if provided. Unchanged guard (#31/#44):
@@ -71,6 +71,23 @@ export interface StoreSyncMiddlewareConfig {
71
71
  * mounts multiple filesystems needs to opt in.
72
72
  */
73
73
  scopeToMount?: boolean;
74
+ /**
75
+ * Called when a file classified as JSON has a body that does not parse.
76
+ *
77
+ * The failure is always *contained*, never thrown: the raw text is stored
78
+ * regardless and the load of every other file continues (see
79
+ * amah/app-framework#44). This hook only decides how it is *reported* —
80
+ * supply it to raise the failure through a host's own logger or error
81
+ * channel instead of the default `console.warn`.
82
+ *
83
+ * Supplying it replaces the built-in warning rather than adding to it, so a
84
+ * host that reports the failure itself does not emit a duplicate.
85
+ *
86
+ * @param error The parse error.
87
+ * @param path The file's local path segments.
88
+ * @param raw The raw body that failed to parse, as received.
89
+ */
90
+ onContentError?: (error: Error, path: string[], raw: string) => void;
74
91
  }
75
92
  /**
76
93
  * Type for remote FS middleware factory
@@ -1 +1 @@
1
- {"version":3,"file":"remote-fs-middleware.types.d.ts","sourceRoot":"","sources":["../../../src/spi/middleware/remote-fs-middleware.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,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AE,CAAC,CAAC,CAAC;AAEvB;;GAEG;AACH,MAAM,MAAM,0BAA0B,CAAC,CAAC,GAAG,GAAG,IAAI,CAChD,MAAM,EAAE,yBAAyB,KAC9B,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hamak/ui-remote-fs",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Remote filesystem synchronization for microkernel-based applications",