@hamak/ui-remote-fs 0.7.1 → 0.7.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;AAWtD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,GAAG,EAC/C,MAAM,EAAE,yBAAyB,GAChC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CA8HnB;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;AAWtD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,GAAG,EAC/C,MAAM,EAAE,yBAAyB,GAChC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CAsInB;AAED,eAAe,yBAAyB,CAAC"}
@@ -34,6 +34,12 @@ import { rfsActions, } from '../actions/remote-fs-actions.js';
34
34
  export function createStoreSyncMiddleware(config) {
35
35
  const { fileSystemAdapter, autoReload = true, transformContent } = config;
36
36
  const storeFsActions = fileSystemAdapter.getActions();
37
+ // Selects the fs slice out of root state for the existence probe below.
38
+ // Defaults to the adapter's own slice key (`'fs'` in the canonical store) so a
39
+ // host whose slice is named differently isn't silently missed. Overridable via
40
+ // config.sliceSelector. See amah/app-framework#31.
41
+ const sliceSelector = config.sliceSelector ??
42
+ ((state) => state?.[fileSystemAdapter.sliceName]);
37
43
  const storeSyncMiddleware = (store) => (next) => (action) => {
38
44
  const result = next(action);
39
45
  const anyAction = action;
@@ -90,7 +96,7 @@ export function createStoreSyncMiddleware(config) {
90
96
  content = transformContent(content);
91
97
  }
92
98
  // Check if file exists in Store FS
93
- const fileSystemNode = fileSystemAdapter.createSelector((state) => state.fileSystem, localPath)(store.getState());
99
+ const fileSystemNode = fileSystemAdapter.createSelector(sliceSelector, localPath)(store.getState());
94
100
  if (fileSystemNode === undefined) {
95
101
  // File doesn't exist, create it with content
96
102
  dispatch(storeFsActions.setFile(localPath, content, 'xs:any', {
@@ -1 +1 @@
1
- {"version":3,"file":"remote-fs-plugin-factory.d.ts","sourceRoot":"","sources":["../../../src/impl/plugin/remote-fs-plugin-factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAKnD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAkB,MAAM,WAAW,CAAC;AAU9E;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,GAAG,CAAC;IAEzC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAEhC;;OAEG;IACH,oBAAoB,CAAC,EAAE,eAAe,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,2BAA2B,GAAG,YAAY,CAkItF;AAED,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"remote-fs-plugin-factory.d.ts","sourceRoot":"","sources":["../../../src/impl/plugin/remote-fs-plugin-factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAKnD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAkB,MAAM,WAAW,CAAC;AAU9E;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,GAAG,CAAC;IAEzC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAEhC;;OAEG;IACH,oBAAoB,CAAC,EAAE,eAAe,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,2BAA2B,GAAG,YAAY,CAyItF;AAED,eAAe,oBAAoB,CAAC"}
@@ -74,10 +74,13 @@ export function createRemoteFsPlugin(config) {
74
74
  ctx.provide({ provide: PATH_TRANSLATOR_TOKEN, useValue: pathTranslator });
75
75
  // Note: IRemoteFsService implementation will be added in future phases
76
76
  // ctx.provide({ provide: REMOTE_FS_SERVICE_TOKEN, useValue: remoteFsService });
77
- log('Plugin initialized');
78
- },
79
- async activate(ctx) {
80
- log('Activating plugin...');
77
+ // Register the middleware during initialize() — NOT activate(). The store
78
+ // plugin drains the extensions collector and locks its middleware registry
79
+ // in its own activate(); since this plugin `dependsOn: ['store']`, its
80
+ // activate() runs after the store's, by which point the collector is gone.
81
+ // Registering here (store's initialize() has already provided the manager,
82
+ // init runs in topological order) ensures the middleware is collected
83
+ // regardless of activation order. See amah/app-framework#31.
81
84
  // Resolve store manager from DI
82
85
  try {
83
86
  storeManager = ctx.resolve(STORE_MANAGER_TOKEN);
@@ -133,6 +136,10 @@ export function createRemoteFsPlugin(config) {
133
136
  middleware: middlewareExtensions,
134
137
  });
135
138
  log('Middleware registered');
139
+ log('Plugin initialized');
140
+ },
141
+ async activate(ctx) {
142
+ log('Activating plugin...');
136
143
  // Emit ready event
137
144
  ctx.hooks.emit('ui-remote-fs:ready', {
138
145
  workspaceClient,
@@ -49,6 +49,14 @@ export interface StoreSyncMiddlewareConfig {
49
49
  * Optional transform function for file content before storing
50
50
  */
51
51
  transformContent?: (content: any) => any;
52
+ /**
53
+ * Selects the filesystem slice out of the root Redux state, used by the
54
+ * GET_COMPLETED existence probe. Defaults to `(state) => state[adapter.sliceName]`
55
+ * — i.e. the slice key the adapter was created with (`'fs'` in the canonical
56
+ * store). Provide this when the host mounts the fs slice under a different key
57
+ * (e.g. `filesystem`) or uses a facade adapter. See amah/app-framework#31.
58
+ */
59
+ sliceSelector?: (state: any) => any;
52
60
  }
53
61
  /**
54
62
  * 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,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IAEzB;;OAEG;IACH,cAAc,EAAE,eAAe,CAAC;IAEhC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAE9C;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,iBAAiB,EAAE,GAAG,CAAC;IAEvB;;OAEG;IACH,cAAc,EAAE,eAAe,CAAC;IAEhC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,GAAG,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,GAAG,GAAG,IAAI,CAC/C,MAAM,EAAE,wBAAwB,KAC7B,UAAU,CAAC,EAAE,EAAE,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"}
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,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IAEzB;;OAEG;IACH,cAAc,EAAE,eAAe,CAAC;IAEhC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAE9C;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,iBAAiB,EAAE,GAAG,CAAC;IAEvB;;OAEG;IACH,cAAc,EAAE,eAAe,CAAC;IAEhC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,GAAG,CAAC;IAEzC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,GAAG,GAAG,IAAI,CAC/C,MAAM,EAAE,wBAAwB,KAC7B,UAAU,CAAC,EAAE,EAAE,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.7.1",
3
+ "version": "0.7.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Remote filesystem synchronization for microkernel-based applications",