@hamak/ui-remote-fs 0.5.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 (94) hide show
  1. package/dist/api/contracts/i-remote-fs-service.d.ts +85 -0
  2. package/dist/api/contracts/i-remote-fs-service.d.ts.map +1 -0
  3. package/dist/api/contracts/i-remote-fs-service.js +6 -0
  4. package/dist/api/contracts/index.d.ts +5 -0
  5. package/dist/api/contracts/index.d.ts.map +1 -0
  6. package/dist/api/contracts/index.js +4 -0
  7. package/dist/api/index.d.ts +8 -0
  8. package/dist/api/index.d.ts.map +1 -0
  9. package/dist/api/index.js +7 -0
  10. package/dist/api/tokens/index.d.ts +5 -0
  11. package/dist/api/tokens/index.d.ts.map +1 -0
  12. package/dist/api/tokens/index.js +4 -0
  13. package/dist/api/tokens/remote-fs.tokens.d.ts +29 -0
  14. package/dist/api/tokens/remote-fs.tokens.d.ts.map +1 -0
  15. package/dist/api/tokens/remote-fs.tokens.js +28 -0
  16. package/dist/api/types/index.d.ts +7 -0
  17. package/dist/api/types/index.d.ts.map +1 -0
  18. package/dist/api/types/index.js +6 -0
  19. package/dist/api/types/remote-fs-action.types.d.ts +34 -0
  20. package/dist/api/types/remote-fs-action.types.d.ts.map +1 -0
  21. package/dist/api/types/remote-fs-action.types.js +42 -0
  22. package/dist/api/types/remote-fs-config.types.d.ts +40 -0
  23. package/dist/api/types/remote-fs-config.types.d.ts.map +1 -0
  24. package/dist/api/types/remote-fs-config.types.js +12 -0
  25. package/dist/api/types/remote-fs-error.types.d.ts +28 -0
  26. package/dist/api/types/remote-fs-error.types.d.ts.map +1 -0
  27. package/dist/api/types/remote-fs-error.types.js +15 -0
  28. package/dist/impl/actions/index.d.ts +5 -0
  29. package/dist/impl/actions/index.d.ts.map +1 -0
  30. package/dist/impl/actions/index.js +4 -0
  31. package/dist/impl/actions/remote-fs-actions.d.ts +196 -0
  32. package/dist/impl/actions/remote-fs-actions.d.ts.map +1 -0
  33. package/dist/impl/actions/remote-fs-actions.js +151 -0
  34. package/dist/impl/autosave/index.d.ts +5 -0
  35. package/dist/impl/autosave/index.d.ts.map +1 -0
  36. package/dist/impl/autosave/index.js +4 -0
  37. package/dist/impl/autosave/remote-fs-autosave-provider.d.ts +46 -0
  38. package/dist/impl/autosave/remote-fs-autosave-provider.d.ts.map +1 -0
  39. package/dist/impl/autosave/remote-fs-autosave-provider.js +80 -0
  40. package/dist/impl/index.d.ts +14 -0
  41. package/dist/impl/index.d.ts.map +1 -0
  42. package/dist/impl/index.js +13 -0
  43. package/dist/impl/middleware/index.d.ts +6 -0
  44. package/dist/impl/middleware/index.d.ts.map +1 -0
  45. package/dist/impl/middleware/index.js +5 -0
  46. package/dist/impl/middleware/remote-fs-middleware.d.ts +38 -0
  47. package/dist/impl/middleware/remote-fs-middleware.d.ts.map +1 -0
  48. package/dist/impl/middleware/remote-fs-middleware.js +192 -0
  49. package/dist/impl/middleware/store-sync-middleware.d.ts +35 -0
  50. package/dist/impl/middleware/store-sync-middleware.d.ts.map +1 -0
  51. package/dist/impl/middleware/store-sync-middleware.js +135 -0
  52. package/dist/impl/plugin/index.d.ts +5 -0
  53. package/dist/impl/plugin/index.d.ts.map +1 -0
  54. package/dist/impl/plugin/index.js +4 -0
  55. package/dist/impl/plugin/remote-fs-plugin-factory.d.ts +84 -0
  56. package/dist/impl/plugin/remote-fs-plugin-factory.d.ts.map +1 -0
  57. package/dist/impl/plugin/remote-fs-plugin-factory.js +150 -0
  58. package/dist/impl/providers/http-workspace-client.d.ts +103 -0
  59. package/dist/impl/providers/http-workspace-client.d.ts.map +1 -0
  60. package/dist/impl/providers/http-workspace-client.js +215 -0
  61. package/dist/impl/providers/index.d.ts +5 -0
  62. package/dist/impl/providers/index.d.ts.map +1 -0
  63. package/dist/impl/providers/index.js +4 -0
  64. package/dist/impl/services/index.d.ts +5 -0
  65. package/dist/impl/services/index.d.ts.map +1 -0
  66. package/dist/impl/services/index.js +4 -0
  67. package/dist/impl/services/remote-fs-service.d.ts +10 -0
  68. package/dist/impl/services/remote-fs-service.d.ts.map +1 -0
  69. package/dist/impl/services/remote-fs-service.js +12 -0
  70. package/dist/index.d.ts +6 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +5 -0
  73. package/dist/spi/index.d.ts +8 -0
  74. package/dist/spi/index.d.ts.map +1 -0
  75. package/dist/spi/index.js +7 -0
  76. package/dist/spi/middleware/index.d.ts +5 -0
  77. package/dist/spi/middleware/index.d.ts.map +1 -0
  78. package/dist/spi/middleware/index.js +4 -0
  79. package/dist/spi/middleware/remote-fs-middleware.types.d.ts +61 -0
  80. package/dist/spi/middleware/remote-fs-middleware.types.d.ts.map +1 -0
  81. package/dist/spi/middleware/remote-fs-middleware.types.js +6 -0
  82. package/dist/spi/providers/i-path-translator.d.ts +74 -0
  83. package/dist/spi/providers/i-path-translator.d.ts.map +1 -0
  84. package/dist/spi/providers/i-path-translator.js +61 -0
  85. package/dist/spi/providers/i-remote-fs-provider.d.ts +78 -0
  86. package/dist/spi/providers/i-remote-fs-provider.d.ts.map +1 -0
  87. package/dist/spi/providers/i-remote-fs-provider.js +6 -0
  88. package/dist/spi/providers/i-workspace-client.d.ts +97 -0
  89. package/dist/spi/providers/i-workspace-client.d.ts.map +1 -0
  90. package/dist/spi/providers/i-workspace-client.js +7 -0
  91. package/dist/spi/providers/index.d.ts +7 -0
  92. package/dist/spi/providers/index.d.ts.map +1 -0
  93. package/dist/spi/providers/index.js +6 -0
  94. package/package.json +69 -0
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Workspace Client Interface
3
+ *
4
+ * Abstraction for remote filesystem communication.
5
+ * Implementations can use HTTP, WebSocket, or any other protocol.
6
+ */
7
+ import { FileInfo } from '@hamak/shared-utils';
8
+ /**
9
+ * Request options for workspace client operations.
10
+ * Allows extensions to add query parameters to requests.
11
+ */
12
+ export interface RequestOptions {
13
+ /**
14
+ * Query parameters to append to the request URL.
15
+ * Extensions can use this to request additional data (e.g., git info).
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * { extensions: ['git'], gitBranch: 'main' }
20
+ * ```
21
+ */
22
+ queryParams?: Record<string, string | string[] | boolean | number | undefined>;
23
+ }
24
+ /**
25
+ * Interface for workspace client implementations
26
+ *
27
+ * This interface abstracts the communication layer for remote filesystem operations.
28
+ * Different implementations can use different protocols (HTTP REST, WebSocket, gRPC, etc.)
29
+ * or even mock implementations for testing.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * // HTTP implementation
34
+ * class HttpWorkspaceClient implements IWorkspaceClient {
35
+ * constructor(private baseUrl: string, private workspaceId: string) {}
36
+ * // ... implement methods using axios or fetch
37
+ * }
38
+ *
39
+ * // Mock implementation for testing
40
+ * class MockWorkspaceClient implements IWorkspaceClient {
41
+ * // ... implement methods with in-memory storage
42
+ * }
43
+ * ```
44
+ */
45
+ export interface IWorkspaceClient {
46
+ /**
47
+ * List files and directories at the specified path
48
+ *
49
+ * @param path - Array of path segments (e.g., ['folder', 'subfolder'])
50
+ * @param options - Optional request options (query params, etc.)
51
+ * @returns Promise resolving to array of FileInfo objects
52
+ * @throws Error if the operation fails
53
+ */
54
+ listFiles(path: string[], options?: RequestOptions): Promise<FileInfo[]>;
55
+ /**
56
+ * Create a directory at the specified path
57
+ *
58
+ * @param path - Array of path segments for the new directory
59
+ * @param options - Optional request options (query params, etc.)
60
+ * @returns Promise resolving to FileInfo of the created directory
61
+ * @throws Error if the directory already exists or operation fails
62
+ */
63
+ createDirectory(path: string[], options?: RequestOptions): Promise<FileInfo>;
64
+ /**
65
+ * Read a file's metadata and content
66
+ *
67
+ * @param path - Array of path segments to the file
68
+ * @param options - Optional request options (query params, etc.)
69
+ * @returns Promise resolving to FileInfo with content populated
70
+ * @throws Error if the file doesn't exist or operation fails
71
+ */
72
+ readFile(path: string[], options?: RequestOptions): Promise<FileInfo>;
73
+ /**
74
+ * Write or update a file's content (uses PUT method)
75
+ *
76
+ * @param path - Array of path segments to the file
77
+ * @param content - Content to write (will be JSON.stringify'd if not a string)
78
+ * @param options - Optional request options (query params, etc.)
79
+ * @returns Promise resolving to FileInfo of the written file
80
+ * @throws Error if the operation fails
81
+ */
82
+ putFile(path: string[], content: any, options?: RequestOptions): Promise<FileInfo>;
83
+ /**
84
+ * Delete a file or directory
85
+ *
86
+ * @param path - Array of path segments to delete
87
+ * @param options - Optional request options (query params, etc.)
88
+ * @returns Promise resolving to FileInfo of the deleted item
89
+ * @throws Error if the item doesn't exist or operation fails
90
+ */
91
+ deleteFile(path: string[], options?: RequestOptions): Promise<FileInfo>;
92
+ }
93
+ /**
94
+ * Factory function type for creating workspace clients
95
+ */
96
+ export type WorkspaceClientFactory = (workspaceId: string, config?: any) => IWorkspaceClient;
97
+ //# sourceMappingURL=i-workspace-client.d.ts.map
@@ -0,0 +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,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;CAChF;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;;;;;;;;OAQG;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"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Workspace Client Interface
3
+ *
4
+ * Abstraction for remote filesystem communication.
5
+ * Implementations can use HTTP, WebSocket, or any other protocol.
6
+ */
7
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Remote FS Provider Interfaces
3
+ */
4
+ export * from './i-workspace-client';
5
+ export * from './i-remote-fs-provider';
6
+ export * from './i-path-translator';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spi/providers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Remote FS Provider Interfaces
3
+ */
4
+ export * from './i-workspace-client';
5
+ export * from './i-remote-fs-provider';
6
+ export * from './i-path-translator';
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@hamak/ui-remote-fs",
3
+ "version": "0.5.1",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Remote filesystem synchronization for microkernel-based applications",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "sideEffects": false,
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/amah/app-framework.git",
16
+ "directory": "packages/ui-remote-fs"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "scripts": {
22
+ "build": "tsc -p tsconfig.lib.json",
23
+ "clean": "rm -rf dist",
24
+ "test": "vitest run",
25
+ "test:watch": "vitest"
26
+ },
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.js",
31
+ "default": "./dist/index.js"
32
+ },
33
+ "./api": {
34
+ "types": "./dist/api/index.d.ts",
35
+ "import": "./dist/api/index.js",
36
+ "default": "./dist/api/index.js"
37
+ },
38
+ "./spi": {
39
+ "types": "./dist/spi/index.d.ts",
40
+ "import": "./dist/spi/index.js",
41
+ "default": "./dist/spi/index.js"
42
+ }
43
+ },
44
+ "typesVersions": {
45
+ "*": {
46
+ "api": [
47
+ "./dist/api/index.d.ts"
48
+ ],
49
+ "spi": [
50
+ "./dist/spi/index.d.ts"
51
+ ]
52
+ }
53
+ },
54
+ "dependencies": {
55
+ "@hamak/shared-utils": "*",
56
+ "@hamak/ui-store-api": "*",
57
+ "@hamak/ui-store-impl": "*",
58
+ "@hamak/microkernel-api": "*",
59
+ "@hamak/microkernel-spi": "*",
60
+ "@reduxjs/toolkit": "^2.0.0",
61
+ "axios": "^1.6.0",
62
+ "redux": "^5.0.1"
63
+ },
64
+ "devDependencies": {
65
+ "typescript": "~5.4.0",
66
+ "vitest": "^2.0.0",
67
+ "@types/node": "^20.0.0"
68
+ }
69
+ }