@hamak/ui-remote-fs 0.10.1 → 0.12.0

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 (29) hide show
  1. package/dist/api/types/remote-fs-error.types.d.ts +28 -0
  2. package/dist/api/types/remote-fs-error.types.d.ts.map +1 -1
  3. package/dist/api/types/remote-fs-error.types.js +18 -0
  4. package/dist/impl/actions/remote-fs-actions.d.ts +22 -2
  5. package/dist/impl/actions/remote-fs-actions.d.ts.map +1 -1
  6. package/dist/impl/actions/remote-fs-actions.js +11 -3
  7. package/dist/impl/middleware/file-content-type.d.ts +4 -52
  8. package/dist/impl/middleware/file-content-type.d.ts.map +1 -1
  9. package/dist/impl/middleware/file-content-type.js +4 -91
  10. package/dist/impl/middleware/remote-fs-middleware.d.ts +22 -0
  11. package/dist/impl/middleware/remote-fs-middleware.d.ts.map +1 -1
  12. package/dist/impl/middleware/remote-fs-middleware.js +293 -22
  13. package/dist/impl/middleware/same-content.d.ts +23 -0
  14. package/dist/impl/middleware/same-content.d.ts.map +1 -0
  15. package/dist/impl/middleware/same-content.js +62 -0
  16. package/dist/impl/middleware/store-sync-middleware.d.ts +5 -4
  17. package/dist/impl/middleware/store-sync-middleware.d.ts.map +1 -1
  18. package/dist/impl/middleware/store-sync-middleware.js +269 -57
  19. package/dist/impl/plugin/remote-fs-plugin-factory.d.ts +5 -4
  20. package/dist/impl/plugin/remote-fs-plugin-factory.d.ts.map +1 -1
  21. package/dist/impl/plugin/remote-fs-plugin-factory.js +1 -2
  22. package/dist/impl/providers/http-workspace-client.d.ts +5 -1
  23. package/dist/impl/providers/http-workspace-client.d.ts.map +1 -1
  24. package/dist/impl/providers/http-workspace-client.js +170 -5
  25. package/dist/spi/middleware/remote-fs-middleware.types.d.ts +21 -2
  26. package/dist/spi/middleware/remote-fs-middleware.types.d.ts.map +1 -1
  27. package/dist/spi/providers/i-workspace-client.d.ts +21 -3
  28. package/dist/spi/providers/i-workspace-client.d.ts.map +1 -1
  29. package/package.json +9 -8
@@ -41,8 +41,27 @@ export interface StoreSyncMiddlewareConfig {
41
41
  */
42
42
  pathTranslator: IPathTranslator;
43
43
  /**
44
- * Whether to automatically reload file content after PUT/POST
45
- * Default: true
44
+ * Re-GET a file after a PUT/POST completes.
45
+ *
46
+ * **Left unset it follows the response** — changed in
47
+ * amah/app-framework#71, where it was unconditionally `true`.
48
+ * `PUT_COMPLETED` now writes the completion payload's own body into the node
49
+ * synchronously, so a write that answers with `content` needs no round-trip;
50
+ * with the old behaviour every surface showed the pre-save bytes for as long
51
+ * as the reload was in flight. A write that answers with metadata only —
52
+ * which is what `@hamak/filesystem-server` does — still gets the re-GET it
53
+ * has always had, so the dirty memo clears, a POST creates its node, and
54
+ * extension state synced on GET keeps refreshing.
55
+ *
56
+ * - `true` — always re-GET, even when the body was already written. Costs a
57
+ * request; use it when the server rewrites what it stores and the host
58
+ * wants that canonical copy. Never reintroduces the stale window, because
59
+ * the synchronous write still lands first.
60
+ * - `false` — never re-GET. Only safe when the write response carries
61
+ * `content`.
62
+ *
63
+ * Either way, a node edited while the write was in flight is left alone:
64
+ * those keystrokes are newer than anything the completion can report.
46
65
  */
47
66
  autoReload?: boolean;
48
67
  /**
@@ -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;IAEzC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAEpC;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;;;;;;;;;;;OAeG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACtE;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,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,CAAC,CAAC,CAAC"}
@@ -20,6 +20,20 @@ export interface RequestOptions {
20
20
  * ```
21
21
  */
22
22
  queryParams?: Record<string, string | string[] | boolean | number | undefined>;
23
+ /**
24
+ * Write precondition (amah/app-framework#70): the `FileInfo.version` the
25
+ * caller last read for this file. `putFile` sends it as `If-Match`; the
26
+ * server refuses the write with a `version-mismatch` error when the file has
27
+ * changed since, and nothing is written.
28
+ *
29
+ * - `undefined`: no precondition from the caller. The remote-fs middleware
30
+ * then fills in the version it last saw for that path, if any.
31
+ * - `false`: write unconditionally, even if a version is known (the "overwrite
32
+ * anyway" gesture after a refused write).
33
+ *
34
+ * Only `putFile` reads it. A client whose backend has no versions ignores it.
35
+ */
36
+ ifMatch?: string | false;
23
37
  }
24
38
  /**
25
39
  * Interface for workspace client implementations
@@ -77,9 +91,13 @@ export interface IWorkspaceClient {
77
91
  * @param content - Content to write. Strings are sent verbatim; anything else
78
92
  * is serialized to pretty-printed JSON, since the result is written to disk
79
93
  * as-is and read by humans.
80
- * @param options - Optional request options (query params, etc.)
81
- * @returns Promise resolving to FileInfo of the written file
82
- * @throws Error if the operation fails
94
+ * @param options - Optional request options. `ifMatch` makes the write
95
+ * conditional on the file's version (see {@link RequestOptions.ifMatch}).
96
+ * @returns Promise resolving to FileInfo of the written file, carrying its
97
+ * new `version` when the backend has versions
98
+ * @throws Error if the operation fails; a refused conditional write throws a
99
+ * `VersionMismatchError` (`code: 'version-mismatch'`, `params.current` the
100
+ * version now on the server) and has written nothing
83
101
  */
84
102
  putFile(path: string[], content: any, options?: RequestOptions): Promise<FileInfo>;
85
103
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"i-workspace-client.d.ts","sourceRoot":"","sources":["../../../src/spi/providers/i-workspace-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;OAQG;IACH,WA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AC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;IAE/E;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;OAOG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEzE;;;;;;;OAOG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE7E;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEtE;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEnF;;;;;;;OAOG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACzE;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,KAAK,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hamak/ui-remote-fs",
3
- "version": "0.10.1",
3
+ "version": "0.12.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Remote filesystem synchronization for microkernel-based applications",
@@ -52,18 +52,19 @@
52
52
  }
53
53
  },
54
54
  "dependencies": {
55
- "@hamak/shared-utils": "*",
56
- "@hamak/ui-store-api": "*",
57
- "@hamak/ui-store-impl": "*",
58
- "@hamak/microkernel-api": "*",
59
- "@hamak/microkernel-spi": "*",
55
+ "@hamak/shared-utils": "^0.12.0",
56
+ "@hamak/ui-store-api": "^0.12.0",
57
+ "@hamak/ui-store-impl": "^0.12.0",
58
+ "@hamak/microkernel-api": "^0.12.0",
59
+ "@hamak/microkernel-spi": "^0.12.0",
60
60
  "@reduxjs/toolkit": "^2.0.0",
61
61
  "axios": "^1.6.0",
62
62
  "redux": "^5.0.1"
63
63
  },
64
64
  "devDependencies": {
65
+ "@hamak/ui-store": "^0.12.0",
66
+ "@types/node": "^20.0.0",
65
67
  "typescript": "~5.4.0",
66
- "vitest": "^2.0.0",
67
- "@types/node": "^20.0.0"
68
+ "vitest": "^2.0.0"
68
69
  }
69
70
  }