@hamak/ui-remote-fs-impl 0.4.16 → 0.5.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.
- package/dist/actions/remote-fs-actions.d.ts +13 -6
- package/dist/actions/remote-fs-actions.d.ts.map +1 -1
- package/dist/actions/remote-fs-actions.js +12 -12
- package/dist/autosave/index.d.ts +5 -0
- package/dist/autosave/index.d.ts.map +1 -0
- package/dist/autosave/index.js +4 -0
- package/dist/autosave/remote-fs-autosave-provider.d.ts +46 -0
- package/dist/autosave/remote-fs-autosave-provider.d.ts.map +1 -0
- package/dist/autosave/remote-fs-autosave-provider.js +64 -0
- package/dist/es2015/actions/remote-fs-actions.js +12 -12
- package/dist/es2015/autosave/index.js +20 -0
- package/dist/es2015/autosave/remote-fs-autosave-provider.js +80 -0
- package/dist/es2015/index.js +1 -0
- package/dist/es2015/middleware/remote-fs-middleware.js +6 -6
- package/dist/es2015/middleware/store-sync-middleware.js +3 -2
- package/dist/es2015/providers/http-workspace-client.js +36 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/middleware/remote-fs-middleware.d.ts.map +1 -1
- package/dist/middleware/remote-fs-middleware.js +6 -6
- package/dist/middleware/store-sync-middleware.d.ts.map +1 -1
- package/dist/middleware/store-sync-middleware.js +3 -2
- package/dist/providers/http-workspace-client.d.ts +10 -6
- package/dist/providers/http-workspace-client.d.ts.map +1 -1
- package/dist/providers/http-workspace-client.js +36 -10
- package/package.json +1 -1
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { RemoteFsActionTypes, ErrorObject } from '@hamak/ui-remote-fs-api';
|
|
8
8
|
import { FileInfo } from '@hamak/shared-utils';
|
|
9
|
+
import { RequestOptions } from '@hamak/ui-remote-fs-spi';
|
|
9
10
|
export interface LsRequestAction {
|
|
10
11
|
type: RemoteFsActionTypes.LS_REQUEST;
|
|
11
12
|
payload: {
|
|
12
13
|
path: string | string[];
|
|
14
|
+
options?: RequestOptions;
|
|
13
15
|
};
|
|
14
16
|
[key: string]: any;
|
|
15
17
|
}
|
|
@@ -33,6 +35,7 @@ export interface MkdirRequestAction {
|
|
|
33
35
|
type: RemoteFsActionTypes.MKDIR_REQUEST;
|
|
34
36
|
payload: {
|
|
35
37
|
path: string | string[];
|
|
38
|
+
options?: RequestOptions;
|
|
36
39
|
};
|
|
37
40
|
[key: string]: any;
|
|
38
41
|
}
|
|
@@ -56,6 +59,7 @@ export interface GetRequestAction {
|
|
|
56
59
|
type: RemoteFsActionTypes.GET_REQUEST;
|
|
57
60
|
payload: {
|
|
58
61
|
path: string | string[];
|
|
62
|
+
options?: RequestOptions;
|
|
59
63
|
};
|
|
60
64
|
[key: string]: any;
|
|
61
65
|
}
|
|
@@ -80,6 +84,7 @@ export interface PostRequestAction {
|
|
|
80
84
|
payload: {
|
|
81
85
|
path: string | string[];
|
|
82
86
|
content: any;
|
|
87
|
+
options?: RequestOptions;
|
|
83
88
|
};
|
|
84
89
|
[key: string]: any;
|
|
85
90
|
}
|
|
@@ -104,6 +109,7 @@ export interface PutRequestAction {
|
|
|
104
109
|
payload: {
|
|
105
110
|
path: string | string[];
|
|
106
111
|
content: any;
|
|
112
|
+
options?: RequestOptions;
|
|
107
113
|
};
|
|
108
114
|
[key: string]: any;
|
|
109
115
|
}
|
|
@@ -127,6 +133,7 @@ export interface DeleteRequestAction {
|
|
|
127
133
|
type: RemoteFsActionTypes.DELETE_REQUEST;
|
|
128
134
|
payload: {
|
|
129
135
|
path: string | string[];
|
|
136
|
+
options?: RequestOptions;
|
|
130
137
|
};
|
|
131
138
|
[key: string]: any;
|
|
132
139
|
}
|
|
@@ -155,22 +162,22 @@ export type RemoteFsAction = LsRequestAction | LsCompletedAction | LsFailedActio
|
|
|
155
162
|
*/
|
|
156
163
|
export declare class RemoteFsActionFactory {
|
|
157
164
|
types: typeof RemoteFsActionTypes;
|
|
158
|
-
ofLsRequest(path: string | string[]): LsRequestAction;
|
|
165
|
+
ofLsRequest(path: string | string[], options?: RequestOptions): LsRequestAction;
|
|
159
166
|
ofLsCompleted(data: FileInfo[], request: LsRequestAction): LsCompletedAction;
|
|
160
167
|
ofLsFailed(error: ErrorObject, request: LsRequestAction): LsFailedAction;
|
|
161
|
-
ofMkdirRequest(path: string | string[]): MkdirRequestAction;
|
|
168
|
+
ofMkdirRequest(path: string | string[], options?: RequestOptions): MkdirRequestAction;
|
|
162
169
|
ofMkdirCompleted(data: FileInfo, request: MkdirRequestAction): MkdirCompletedAction;
|
|
163
170
|
ofMkdirFailed(error: ErrorObject, request: MkdirRequestAction): MkdirFailedAction;
|
|
164
|
-
ofGetRequest(path: string | string[]): GetRequestAction;
|
|
171
|
+
ofGetRequest(path: string | string[], options?: RequestOptions): GetRequestAction;
|
|
165
172
|
ofGetCompleted(data: FileInfo, request: GetRequestAction): GetCompletedAction;
|
|
166
173
|
ofGetFailed(error: ErrorObject, request: GetRequestAction): GetFailedAction;
|
|
167
|
-
ofPostRequest(path: string | string[], content: any): PostRequestAction;
|
|
174
|
+
ofPostRequest(path: string | string[], content: any, options?: RequestOptions): PostRequestAction;
|
|
168
175
|
ofPostCompleted(data: FileInfo, request: PostRequestAction): PostCompletedAction;
|
|
169
176
|
ofPostFailed(error: ErrorObject, request: PostRequestAction): PostFailedAction;
|
|
170
|
-
ofPutRequest(path: string | string[], content: any): PutRequestAction;
|
|
177
|
+
ofPutRequest(path: string | string[], content: any, options?: RequestOptions): PutRequestAction;
|
|
171
178
|
ofPutCompleted(data: FileInfo, request: PutRequestAction): PutCompletedAction;
|
|
172
179
|
ofPutFailed(error: ErrorObject, request: PutRequestAction): PutFailedAction;
|
|
173
|
-
ofDeleteRequest(path: string | string[]): DeleteRequestAction;
|
|
180
|
+
ofDeleteRequest(path: string | string[], options?: RequestOptions): DeleteRequestAction;
|
|
174
181
|
ofDeleteCompleted(data: FileInfo, request: DeleteRequestAction): DeleteCompletedAction;
|
|
175
182
|
ofDeleteFailed(error: ErrorObject, request: DeleteRequestAction): DeleteFailedAction;
|
|
176
183
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-fs-actions.d.ts","sourceRoot":"","sources":["../../src/actions/remote-fs-actions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"remote-fs-actions.d.ts","sourceRoot":"","sources":["../../src/actions/remote-fs-actions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,mBAAmB,CAAC,UAAU,CAAC;IACrC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,cAAc,CAAA;KAAE,CAAC;IAC/D,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,mBAAmB,CAAC,YAAY,CAAC;IACvC,OAAO,EAAE;QAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAAC,OAAO,EAAE,eAAe,CAAA;KAAE,CAAC;IACxD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC;IACpC,OAAO,EAAE;QAAE,KAAK,EAAE,WAAW,CAAC;QAAC,OAAO,EAAE,eAAe,CAAA;KAAE,CAAC;IAC1D,CA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AM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,gBAAgB;IAO/F,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,GAAG,kBAAkB;IAO7E,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,GAAG,eAAe;IAQ3E,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,mBAAmB;IAOvF,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB,GAAG,qBAAqB;IAOtF,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB,GAAG,kBAAkB;IAOpF;;OAEG;IACH,gBAAgB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,cAAc;CAQxD;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,uBAA8B,CAAC;AAEtD;;GAEG;AACH,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -13,10 +13,10 @@ export class RemoteFsActionFactory {
|
|
|
13
13
|
this.types = RemoteFsActionTypes;
|
|
14
14
|
}
|
|
15
15
|
// LS (List) operations
|
|
16
|
-
ofLsRequest(path) {
|
|
16
|
+
ofLsRequest(path, options) {
|
|
17
17
|
return {
|
|
18
18
|
type: this.types.LS_REQUEST,
|
|
19
|
-
payload: { path },
|
|
19
|
+
payload: { path, options },
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
ofLsCompleted(data, request) {
|
|
@@ -32,10 +32,10 @@ export class RemoteFsActionFactory {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
// MKDIR (Make Directory) operations
|
|
35
|
-
ofMkdirRequest(path) {
|
|
35
|
+
ofMkdirRequest(path, options) {
|
|
36
36
|
return {
|
|
37
37
|
type: this.types.MKDIR_REQUEST,
|
|
38
|
-
payload: { path },
|
|
38
|
+
payload: { path, options },
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
ofMkdirCompleted(data, request) {
|
|
@@ -51,10 +51,10 @@ export class RemoteFsActionFactory {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
// GET (Read File) operations
|
|
54
|
-
ofGetRequest(path) {
|
|
54
|
+
ofGetRequest(path, options) {
|
|
55
55
|
return {
|
|
56
56
|
type: this.types.GET_REQUEST,
|
|
57
|
-
payload: { path },
|
|
57
|
+
payload: { path, options },
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
ofGetCompleted(data, request) {
|
|
@@ -70,10 +70,10 @@ export class RemoteFsActionFactory {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
// POST (Create File) operations
|
|
73
|
-
ofPostRequest(path, content) {
|
|
73
|
+
ofPostRequest(path, content, options) {
|
|
74
74
|
return {
|
|
75
75
|
type: this.types.POST_REQUEST,
|
|
76
|
-
payload: { path, content },
|
|
76
|
+
payload: { path, content, options },
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
ofPostCompleted(data, request) {
|
|
@@ -89,10 +89,10 @@ export class RemoteFsActionFactory {
|
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
// PUT (Update File) operations
|
|
92
|
-
ofPutRequest(path, content) {
|
|
92
|
+
ofPutRequest(path, content, options) {
|
|
93
93
|
return {
|
|
94
94
|
type: this.types.PUT_REQUEST,
|
|
95
|
-
payload: { path, content },
|
|
95
|
+
payload: { path, content, options },
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
ofPutCompleted(data, request) {
|
|
@@ -108,10 +108,10 @@ export class RemoteFsActionFactory {
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
// DELETE operations
|
|
111
|
-
ofDeleteRequest(path) {
|
|
111
|
+
ofDeleteRequest(path, options) {
|
|
112
112
|
return {
|
|
113
113
|
type: this.types.DELETE_REQUEST,
|
|
114
|
-
payload: { path },
|
|
114
|
+
payload: { path, options },
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
ofDeleteCompleted(data, request) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/autosave/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remote FS Autosave Provider
|
|
3
|
+
*
|
|
4
|
+
* Implements autosave for files managed by the remote filesystem plugin.
|
|
5
|
+
* Uses PUT_REQUEST actions to save files to the remote server.
|
|
6
|
+
*/
|
|
7
|
+
import type { Dispatch, AnyAction } from 'redux';
|
|
8
|
+
import type { FileSystemNode } from '@hamak/shared-utils';
|
|
9
|
+
import type { IAutosaveProvider, AutosaveResult } from '@hamak/ui-store-spi';
|
|
10
|
+
import type { IPathTranslator } from '@hamak/ui-remote-fs-spi';
|
|
11
|
+
/**
|
|
12
|
+
* Configuration for RemoteFsAutosaveProvider
|
|
13
|
+
*/
|
|
14
|
+
export interface RemoteFsAutosaveProviderConfig {
|
|
15
|
+
/** Path translator to check if path is under remote mount point */
|
|
16
|
+
pathTranslator: IPathTranslator;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Autosave provider for remote filesystem
|
|
20
|
+
*
|
|
21
|
+
* This provider handles autosave for files that are mounted via the
|
|
22
|
+
* remote filesystem plugin. It checks if a file path falls under the
|
|
23
|
+
* configured mount point and uses PUT_REQUEST to save changes.
|
|
24
|
+
*/
|
|
25
|
+
export declare class RemoteFsAutosaveProvider implements IAutosaveProvider {
|
|
26
|
+
readonly id = "remote-fs";
|
|
27
|
+
readonly priority = 10;
|
|
28
|
+
private pathTranslator;
|
|
29
|
+
constructor(config: RemoteFsAutosaveProviderConfig);
|
|
30
|
+
/**
|
|
31
|
+
* Check if this provider supports a given path.
|
|
32
|
+
* Returns true if the path is under the remote mount point.
|
|
33
|
+
*/
|
|
34
|
+
supports(path: string[], node: FileSystemNode): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Save file content to remote server.
|
|
37
|
+
* Dispatches PUT_REQUEST action which will be handled by remote-fs middleware.
|
|
38
|
+
*/
|
|
39
|
+
save(path: string[], content: unknown, node: FileSystemNode, dispatch: Dispatch<AnyAction>): Promise<AutosaveResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Cancel is a no-op for remote-fs since we don't track in-flight requests here.
|
|
42
|
+
* The remote-fs middleware handles the actual HTTP requests.
|
|
43
|
+
*/
|
|
44
|
+
cancel(path: string[]): void;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=remote-fs-autosave-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-fs-autosave-provider.d.ts","sourceRoot":"","sources":["../../src/autosave/remote-fs-autosave-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,mEAAmE;IACnE,cAAc,EAAE,eAAe,CAAC;CACjC;AAED;;;;;;GAMG;AACH,qBAAa,wBAAyB,YAAW,iBAAiB;IAChE,QAAQ,CAAC,EAAE,eAAe;IAC1B,QAAQ,CAAC,QAAQ,MAAM;IAEvB,OAAO,CAAC,cAAc,CAAkB;gBAE5B,MAAM,EAAE,8BAA8B;IAIlD;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO;IAQvD;;;OAGG;IACG,IAAI,CACR,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC,GAC5B,OAAO,CAAC,cAAc,CAAC;IAwB1B;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;CAG7B"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remote FS Autosave Provider
|
|
3
|
+
*
|
|
4
|
+
* Implements autosave for files managed by the remote filesystem plugin.
|
|
5
|
+
* Uses PUT_REQUEST actions to save files to the remote server.
|
|
6
|
+
*/
|
|
7
|
+
import { rfsActions } from '../actions/remote-fs-actions';
|
|
8
|
+
/**
|
|
9
|
+
* Autosave provider for remote filesystem
|
|
10
|
+
*
|
|
11
|
+
* This provider handles autosave for files that are mounted via the
|
|
12
|
+
* remote filesystem plugin. It checks if a file path falls under the
|
|
13
|
+
* configured mount point and uses PUT_REQUEST to save changes.
|
|
14
|
+
*/
|
|
15
|
+
export class RemoteFsAutosaveProvider {
|
|
16
|
+
constructor(config) {
|
|
17
|
+
this.id = 'remote-fs';
|
|
18
|
+
this.priority = 10;
|
|
19
|
+
this.pathTranslator = config.pathTranslator;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Check if this provider supports a given path.
|
|
23
|
+
* Returns true if the path is under the remote mount point.
|
|
24
|
+
*/
|
|
25
|
+
supports(path, node) {
|
|
26
|
+
// Check if path translator can translate this path to a remote path
|
|
27
|
+
const remotePath = this.pathTranslator.toRemotePath({ getSegments: () => path });
|
|
28
|
+
return remotePath !== undefined;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Save file content to remote server.
|
|
32
|
+
* Dispatches PUT_REQUEST action which will be handled by remote-fs middleware.
|
|
33
|
+
*/
|
|
34
|
+
async save(path, content, node, dispatch) {
|
|
35
|
+
try {
|
|
36
|
+
// Dispatch PUT request to save content
|
|
37
|
+
dispatch(rfsActions.ofPutRequest(path, content));
|
|
38
|
+
// Note: The actual HTTP request is async and handled by remote-fs middleware.
|
|
39
|
+
// Success/failure will be tracked by the middleware dispatching
|
|
40
|
+
// PUT_COMPLETED or PUT_FAILED actions.
|
|
41
|
+
// For now, we return optimistic success.
|
|
42
|
+
return {
|
|
43
|
+
success: true,
|
|
44
|
+
timestamp: Date.now(),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
return {
|
|
49
|
+
success: false,
|
|
50
|
+
error: {
|
|
51
|
+
code: error.code ?? 'SAVE_ERROR',
|
|
52
|
+
message: error.message ?? 'Failed to dispatch save action',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Cancel is a no-op for remote-fs since we don't track in-flight requests here.
|
|
59
|
+
* The remote-fs middleware handles the actual HTTP requests.
|
|
60
|
+
*/
|
|
61
|
+
cancel(path) {
|
|
62
|
+
// No-op: remote-fs middleware handles request lifecycle
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -17,10 +17,10 @@ class RemoteFsActionFactory {
|
|
|
17
17
|
this.types = ui_remote_fs_api_1.RemoteFsActionTypes;
|
|
18
18
|
}
|
|
19
19
|
// LS (List) operations
|
|
20
|
-
ofLsRequest(path) {
|
|
20
|
+
ofLsRequest(path, options) {
|
|
21
21
|
return {
|
|
22
22
|
type: this.types.LS_REQUEST,
|
|
23
|
-
payload: { path },
|
|
23
|
+
payload: { path, options },
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
ofLsCompleted(data, request) {
|
|
@@ -36,10 +36,10 @@ class RemoteFsActionFactory {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
// MKDIR (Make Directory) operations
|
|
39
|
-
ofMkdirRequest(path) {
|
|
39
|
+
ofMkdirRequest(path, options) {
|
|
40
40
|
return {
|
|
41
41
|
type: this.types.MKDIR_REQUEST,
|
|
42
|
-
payload: { path },
|
|
42
|
+
payload: { path, options },
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
ofMkdirCompleted(data, request) {
|
|
@@ -55,10 +55,10 @@ class RemoteFsActionFactory {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
// GET (Read File) operations
|
|
58
|
-
ofGetRequest(path) {
|
|
58
|
+
ofGetRequest(path, options) {
|
|
59
59
|
return {
|
|
60
60
|
type: this.types.GET_REQUEST,
|
|
61
|
-
payload: { path },
|
|
61
|
+
payload: { path, options },
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
ofGetCompleted(data, request) {
|
|
@@ -74,10 +74,10 @@ class RemoteFsActionFactory {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
// POST (Create File) operations
|
|
77
|
-
ofPostRequest(path, content) {
|
|
77
|
+
ofPostRequest(path, content, options) {
|
|
78
78
|
return {
|
|
79
79
|
type: this.types.POST_REQUEST,
|
|
80
|
-
payload: { path, content },
|
|
80
|
+
payload: { path, content, options },
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
ofPostCompleted(data, request) {
|
|
@@ -93,10 +93,10 @@ class RemoteFsActionFactory {
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
// PUT (Update File) operations
|
|
96
|
-
ofPutRequest(path, content) {
|
|
96
|
+
ofPutRequest(path, content, options) {
|
|
97
97
|
return {
|
|
98
98
|
type: this.types.PUT_REQUEST,
|
|
99
|
-
payload: { path, content },
|
|
99
|
+
payload: { path, content, options },
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
ofPutCompleted(data, request) {
|
|
@@ -112,10 +112,10 @@ class RemoteFsActionFactory {
|
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
// DELETE operations
|
|
115
|
-
ofDeleteRequest(path) {
|
|
115
|
+
ofDeleteRequest(path, options) {
|
|
116
116
|
return {
|
|
117
117
|
type: this.types.DELETE_REQUEST,
|
|
118
|
-
payload: { path },
|
|
118
|
+
payload: { path, options },
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
ofDeleteCompleted(data, request) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Remote FS Autosave
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./remote-fs-autosave-provider"), exports);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Remote FS Autosave Provider
|
|
4
|
+
*
|
|
5
|
+
* Implements autosave for files managed by the remote filesystem plugin.
|
|
6
|
+
* Uses PUT_REQUEST actions to save files to the remote server.
|
|
7
|
+
*/
|
|
8
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.RemoteFsAutosaveProvider = void 0;
|
|
19
|
+
const remote_fs_actions_1 = require("../actions/remote-fs-actions");
|
|
20
|
+
/**
|
|
21
|
+
* Autosave provider for remote filesystem
|
|
22
|
+
*
|
|
23
|
+
* This provider handles autosave for files that are mounted via the
|
|
24
|
+
* remote filesystem plugin. It checks if a file path falls under the
|
|
25
|
+
* configured mount point and uses PUT_REQUEST to save changes.
|
|
26
|
+
*/
|
|
27
|
+
class RemoteFsAutosaveProvider {
|
|
28
|
+
constructor(config) {
|
|
29
|
+
this.id = 'remote-fs';
|
|
30
|
+
this.priority = 10;
|
|
31
|
+
this.pathTranslator = config.pathTranslator;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Check if this provider supports a given path.
|
|
35
|
+
* Returns true if the path is under the remote mount point.
|
|
36
|
+
*/
|
|
37
|
+
supports(path, node) {
|
|
38
|
+
// Check if path translator can translate this path to a remote path
|
|
39
|
+
const remotePath = this.pathTranslator.toRemotePath({ getSegments: () => path });
|
|
40
|
+
return remotePath !== undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Save file content to remote server.
|
|
44
|
+
* Dispatches PUT_REQUEST action which will be handled by remote-fs middleware.
|
|
45
|
+
*/
|
|
46
|
+
save(path, content, node, dispatch) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
try {
|
|
50
|
+
// Dispatch PUT request to save content
|
|
51
|
+
dispatch(remote_fs_actions_1.rfsActions.ofPutRequest(path, content));
|
|
52
|
+
// Note: The actual HTTP request is async and handled by remote-fs middleware.
|
|
53
|
+
// Success/failure will be tracked by the middleware dispatching
|
|
54
|
+
// PUT_COMPLETED or PUT_FAILED actions.
|
|
55
|
+
// For now, we return optimistic success.
|
|
56
|
+
return {
|
|
57
|
+
success: true,
|
|
58
|
+
timestamp: Date.now(),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return {
|
|
63
|
+
success: false,
|
|
64
|
+
error: {
|
|
65
|
+
code: (_a = error.code) !== null && _a !== void 0 ? _a : 'SAVE_ERROR',
|
|
66
|
+
message: (_b = error.message) !== null && _b !== void 0 ? _b : 'Failed to dispatch save action',
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Cancel is a no-op for remote-fs since we don't track in-flight requests here.
|
|
74
|
+
* The remote-fs middleware handles the actual HTTP requests.
|
|
75
|
+
*/
|
|
76
|
+
cancel(path) {
|
|
77
|
+
// No-op: remote-fs middleware handles request lifecycle
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.RemoteFsAutosaveProvider = RemoteFsAutosaveProvider;
|
package/dist/es2015/index.js
CHANGED
|
@@ -70,7 +70,7 @@ function createRemoteFsMiddleware(config) {
|
|
|
70
70
|
}
|
|
71
71
|
void (() => __awaiter(this, void 0, void 0, function* () {
|
|
72
72
|
try {
|
|
73
|
-
const data = yield client.listFiles(remotePath.getSegments());
|
|
73
|
+
const data = yield client.listFiles(remotePath.getSegments(), requestAction.payload.options);
|
|
74
74
|
const completedAction = remote_fs_actions_1.rfsActions.ofLsCompleted(data, requestAction);
|
|
75
75
|
dispatch(completedAction);
|
|
76
76
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data, completedAction);
|
|
@@ -92,7 +92,7 @@ function createRemoteFsMiddleware(config) {
|
|
|
92
92
|
}
|
|
93
93
|
void (() => __awaiter(this, void 0, void 0, function* () {
|
|
94
94
|
try {
|
|
95
|
-
const data = yield client.createDirectory(remotePath.getSegments());
|
|
95
|
+
const data = yield client.createDirectory(remotePath.getSegments(), requestAction.payload.options);
|
|
96
96
|
const completedAction = remote_fs_actions_1.rfsActions.ofMkdirCompleted(data, requestAction);
|
|
97
97
|
dispatch(completedAction);
|
|
98
98
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data, completedAction);
|
|
@@ -114,7 +114,7 @@ function createRemoteFsMiddleware(config) {
|
|
|
114
114
|
}
|
|
115
115
|
void (() => __awaiter(this, void 0, void 0, function* () {
|
|
116
116
|
try {
|
|
117
|
-
const data = yield client.readFile(remotePath.getSegments());
|
|
117
|
+
const data = yield client.readFile(remotePath.getSegments(), requestAction.payload.options);
|
|
118
118
|
const completedAction = remote_fs_actions_1.rfsActions.ofGetCompleted(data, requestAction);
|
|
119
119
|
dispatch(completedAction);
|
|
120
120
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data, completedAction);
|
|
@@ -136,7 +136,7 @@ function createRemoteFsMiddleware(config) {
|
|
|
136
136
|
}
|
|
137
137
|
void (() => __awaiter(this, void 0, void 0, function* () {
|
|
138
138
|
try {
|
|
139
|
-
const data = yield client.putFile(remotePath.getSegments(), requestAction.payload.content);
|
|
139
|
+
const data = yield client.putFile(remotePath.getSegments(), requestAction.payload.content, requestAction.payload.options);
|
|
140
140
|
const completedAction = remote_fs_actions_1.rfsActions.ofPostCompleted(data, requestAction);
|
|
141
141
|
dispatch(completedAction);
|
|
142
142
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data, completedAction);
|
|
@@ -158,7 +158,7 @@ function createRemoteFsMiddleware(config) {
|
|
|
158
158
|
}
|
|
159
159
|
void (() => __awaiter(this, void 0, void 0, function* () {
|
|
160
160
|
try {
|
|
161
|
-
const data = yield client.putFile(remotePath.getSegments(), requestAction.payload.content);
|
|
161
|
+
const data = yield client.putFile(remotePath.getSegments(), requestAction.payload.content, requestAction.payload.options);
|
|
162
162
|
const completedAction = remote_fs_actions_1.rfsActions.ofPutCompleted(data, requestAction);
|
|
163
163
|
dispatch(completedAction);
|
|
164
164
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data, completedAction);
|
|
@@ -180,7 +180,7 @@ function createRemoteFsMiddleware(config) {
|
|
|
180
180
|
}
|
|
181
181
|
void (() => __awaiter(this, void 0, void 0, function* () {
|
|
182
182
|
try {
|
|
183
|
-
const data = yield client.deleteFile(remotePath.getSegments());
|
|
183
|
+
const data = yield client.deleteFile(remotePath.getSegments(), requestAction.payload.options);
|
|
184
184
|
const completedAction = remote_fs_actions_1.rfsActions.ofDeleteCompleted(data, requestAction);
|
|
185
185
|
dispatch(completedAction);
|
|
186
186
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data, completedAction);
|
|
@@ -56,14 +56,15 @@ function createStoreSyncMiddleware(config) {
|
|
|
56
56
|
.resolve(fileInfo.name)
|
|
57
57
|
.getSegments();
|
|
58
58
|
if (fileInfo.isDirectory) {
|
|
59
|
-
// Create directory with parents flag
|
|
60
|
-
dispatch(storeFsActions.mkdir(localPath, true));
|
|
59
|
+
// Create directory with parents flag and extension states
|
|
60
|
+
dispatch(storeFsActions.mkdir(localPath, true, fileInfo.extensions));
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
63
|
// Create file entry without content (contentIsPresent: false)
|
|
64
64
|
dispatch(storeFsActions.setFile(localPath, undefined, 'xs:any', {
|
|
65
65
|
override: true,
|
|
66
66
|
contentIsPresent: false,
|
|
67
|
+
extensionStates: fileInfo.extensions,
|
|
67
68
|
}));
|
|
68
69
|
}
|
|
69
70
|
});
|
|
@@ -59,6 +59,27 @@ class HttpWorkspaceClient {
|
|
|
59
59
|
formatPath(path) {
|
|
60
60
|
return path.join('/');
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Build URL with optional query parameters
|
|
64
|
+
*/
|
|
65
|
+
buildUrl(basePath, options) {
|
|
66
|
+
if (!(options === null || options === void 0 ? void 0 : options.queryParams)) {
|
|
67
|
+
return basePath;
|
|
68
|
+
}
|
|
69
|
+
const params = new URLSearchParams();
|
|
70
|
+
for (const [key, value] of Object.entries(options.queryParams)) {
|
|
71
|
+
if (value === undefined)
|
|
72
|
+
continue;
|
|
73
|
+
if (Array.isArray(value)) {
|
|
74
|
+
value.forEach((v) => params.append(key, String(v)));
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
params.append(key, String(value));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const queryString = params.toString();
|
|
81
|
+
return queryString ? `${basePath}?${queryString}` : basePath;
|
|
82
|
+
}
|
|
62
83
|
/**
|
|
63
84
|
* Handle axios errors and convert to ErrorObject
|
|
64
85
|
*/
|
|
@@ -100,11 +121,12 @@ class HttpWorkspaceClient {
|
|
|
100
121
|
/**
|
|
101
122
|
* List files and directories at the specified path
|
|
102
123
|
*/
|
|
103
|
-
listFiles(path) {
|
|
124
|
+
listFiles(path, options) {
|
|
104
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
126
|
try {
|
|
106
127
|
const formattedPath = this.formatPath(path);
|
|
107
|
-
const
|
|
128
|
+
const url = this.buildUrl(`/${this.workspaceId}/files/${formattedPath}`, options);
|
|
129
|
+
const response = yield this.axios.get(url);
|
|
108
130
|
return response.data;
|
|
109
131
|
}
|
|
110
132
|
catch (error) {
|
|
@@ -115,11 +137,12 @@ class HttpWorkspaceClient {
|
|
|
115
137
|
/**
|
|
116
138
|
* Create a directory at the specified path
|
|
117
139
|
*/
|
|
118
|
-
createDirectory(path) {
|
|
140
|
+
createDirectory(path, options) {
|
|
119
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
142
|
try {
|
|
121
143
|
const formattedPath = this.formatPath(path);
|
|
122
|
-
const
|
|
144
|
+
const url = this.buildUrl(`/${this.workspaceId}/mkdir/${formattedPath}`, options);
|
|
145
|
+
const response = yield this.axios.post(url);
|
|
123
146
|
return response.data;
|
|
124
147
|
}
|
|
125
148
|
catch (error) {
|
|
@@ -130,11 +153,12 @@ class HttpWorkspaceClient {
|
|
|
130
153
|
/**
|
|
131
154
|
* Read a file's metadata and content
|
|
132
155
|
*/
|
|
133
|
-
readFile(path) {
|
|
156
|
+
readFile(path, options) {
|
|
134
157
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
158
|
try {
|
|
136
159
|
const formattedPath = this.formatPath(path);
|
|
137
|
-
const
|
|
160
|
+
const url = this.buildUrl(`/${this.workspaceId}/read/${formattedPath}`, options);
|
|
161
|
+
const response = yield this.axios.get(url);
|
|
138
162
|
return response.data;
|
|
139
163
|
}
|
|
140
164
|
catch (error) {
|
|
@@ -145,12 +169,13 @@ class HttpWorkspaceClient {
|
|
|
145
169
|
/**
|
|
146
170
|
* Write or update a file's content (uses PUT method)
|
|
147
171
|
*/
|
|
148
|
-
putFile(path, content) {
|
|
172
|
+
putFile(path, content, options) {
|
|
149
173
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
174
|
try {
|
|
151
175
|
const formattedPath = this.formatPath(path);
|
|
152
176
|
const serializedContent = this.serializeContent(content);
|
|
153
|
-
const
|
|
177
|
+
const url = this.buildUrl(`/${this.workspaceId}/put/${formattedPath}`, options);
|
|
178
|
+
const response = yield this.axios.put(url, { content: serializedContent });
|
|
154
179
|
return response.data;
|
|
155
180
|
}
|
|
156
181
|
catch (error) {
|
|
@@ -161,11 +186,12 @@ class HttpWorkspaceClient {
|
|
|
161
186
|
/**
|
|
162
187
|
* Delete a file or directory
|
|
163
188
|
*/
|
|
164
|
-
deleteFile(path) {
|
|
189
|
+
deleteFile(path, options) {
|
|
165
190
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
191
|
try {
|
|
167
192
|
const formattedPath = this.formatPath(path);
|
|
168
|
-
const
|
|
193
|
+
const url = this.buildUrl(`/${this.workspaceId}/delete/${formattedPath}`, options);
|
|
194
|
+
const response = yield this.axios.delete(url);
|
|
169
195
|
return response.data;
|
|
170
196
|
}
|
|
171
197
|
catch (error) {
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-fs-middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/remote-fs-middleware.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAuB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAW3E;;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,WAAW,EAAE,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IAE1D;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;CACtD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,GAAG,GAAG,EAC9C,MAAM,EAAE,wBAAwB,GAC/B,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"remote-fs-middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/remote-fs-middleware.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAuB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAW3E;;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,WAAW,EAAE,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IAE1D;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;CACtD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,GAAG,GAAG,EAC9C,MAAM,EAAE,wBAAwB,GAC/B,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CA8LnB;AAED,eAAe,wBAAwB,CAAC"}
|
|
@@ -58,7 +58,7 @@ export function createRemoteFsMiddleware(config) {
|
|
|
58
58
|
}
|
|
59
59
|
void (async () => {
|
|
60
60
|
try {
|
|
61
|
-
const data = await client.listFiles(remotePath.getSegments());
|
|
61
|
+
const data = await client.listFiles(remotePath.getSegments(), requestAction.payload.options);
|
|
62
62
|
const completedAction = rfsActions.ofLsCompleted(data, requestAction);
|
|
63
63
|
dispatch(completedAction);
|
|
64
64
|
onSuccess?.(data, completedAction);
|
|
@@ -80,7 +80,7 @@ export function createRemoteFsMiddleware(config) {
|
|
|
80
80
|
}
|
|
81
81
|
void (async () => {
|
|
82
82
|
try {
|
|
83
|
-
const data = await client.createDirectory(remotePath.getSegments());
|
|
83
|
+
const data = await client.createDirectory(remotePath.getSegments(), requestAction.payload.options);
|
|
84
84
|
const completedAction = rfsActions.ofMkdirCompleted(data, requestAction);
|
|
85
85
|
dispatch(completedAction);
|
|
86
86
|
onSuccess?.(data, completedAction);
|
|
@@ -102,7 +102,7 @@ export function createRemoteFsMiddleware(config) {
|
|
|
102
102
|
}
|
|
103
103
|
void (async () => {
|
|
104
104
|
try {
|
|
105
|
-
const data = await client.readFile(remotePath.getSegments());
|
|
105
|
+
const data = await client.readFile(remotePath.getSegments(), requestAction.payload.options);
|
|
106
106
|
const completedAction = rfsActions.ofGetCompleted(data, requestAction);
|
|
107
107
|
dispatch(completedAction);
|
|
108
108
|
onSuccess?.(data, completedAction);
|
|
@@ -124,7 +124,7 @@ export function createRemoteFsMiddleware(config) {
|
|
|
124
124
|
}
|
|
125
125
|
void (async () => {
|
|
126
126
|
try {
|
|
127
|
-
const data = await client.putFile(remotePath.getSegments(), requestAction.payload.content);
|
|
127
|
+
const data = await client.putFile(remotePath.getSegments(), requestAction.payload.content, requestAction.payload.options);
|
|
128
128
|
const completedAction = rfsActions.ofPostCompleted(data, requestAction);
|
|
129
129
|
dispatch(completedAction);
|
|
130
130
|
onSuccess?.(data, completedAction);
|
|
@@ -146,7 +146,7 @@ export function createRemoteFsMiddleware(config) {
|
|
|
146
146
|
}
|
|
147
147
|
void (async () => {
|
|
148
148
|
try {
|
|
149
|
-
const data = await client.putFile(remotePath.getSegments(), requestAction.payload.content);
|
|
149
|
+
const data = await client.putFile(remotePath.getSegments(), requestAction.payload.content, requestAction.payload.options);
|
|
150
150
|
const completedAction = rfsActions.ofPutCompleted(data, requestAction);
|
|
151
151
|
dispatch(completedAction);
|
|
152
152
|
onSuccess?.(data, completedAction);
|
|
@@ -168,7 +168,7 @@ export function createRemoteFsMiddleware(config) {
|
|
|
168
168
|
}
|
|
169
169
|
void (async () => {
|
|
170
170
|
try {
|
|
171
|
-
const data = await client.deleteFile(remotePath.getSegments());
|
|
171
|
+
const data = await client.deleteFile(remotePath.getSegments(), requestAction.payload.options);
|
|
172
172
|
const completedAction = rfsActions.ofDeleteCompleted(data, requestAction);
|
|
173
173
|
dispatch(completedAction);
|
|
174
174
|
onSuccess?.(data, completedAction);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-sync-middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/store-sync-middleware.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAa,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAWpE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,GAAG,EAC/C,MAAM,EAAE,yBAAyB,GAChC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"store-sync-middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/store-sync-middleware.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAa,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAWpE;;;;;;;;;;;;;;;;;;;;;;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"}
|
|
@@ -53,14 +53,15 @@ export function createStoreSyncMiddleware(config) {
|
|
|
53
53
|
.resolve(fileInfo.name)
|
|
54
54
|
.getSegments();
|
|
55
55
|
if (fileInfo.isDirectory) {
|
|
56
|
-
// Create directory with parents flag
|
|
57
|
-
dispatch(storeFsActions.mkdir(localPath, true));
|
|
56
|
+
// Create directory with parents flag and extension states
|
|
57
|
+
dispatch(storeFsActions.mkdir(localPath, true, fileInfo.extensions));
|
|
58
58
|
}
|
|
59
59
|
else {
|
|
60
60
|
// Create file entry without content (contentIsPresent: false)
|
|
61
61
|
dispatch(storeFsActions.setFile(localPath, undefined, 'xs:any', {
|
|
62
62
|
override: true,
|
|
63
63
|
contentIsPresent: false,
|
|
64
|
+
extensionStates: fileInfo.extensions,
|
|
64
65
|
}));
|
|
65
66
|
}
|
|
66
67
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Migrated from amk/libs/server/ws/ws-client/src/lib/server-ws-ws-client.ts
|
|
6
6
|
*/
|
|
7
7
|
import { AxiosInstance } from 'axios';
|
|
8
|
-
import { IWorkspaceClient } from '@hamak/ui-remote-fs-spi';
|
|
8
|
+
import { IWorkspaceClient, RequestOptions } from '@hamak/ui-remote-fs-spi';
|
|
9
9
|
import { FileInfo } from '@hamak/shared-utils';
|
|
10
10
|
/**
|
|
11
11
|
* Configuration for HTTP workspace client
|
|
@@ -55,6 +55,10 @@ export declare class HttpWorkspaceClient implements IWorkspaceClient {
|
|
|
55
55
|
* Format path segments to URL path string
|
|
56
56
|
*/
|
|
57
57
|
private formatPath;
|
|
58
|
+
/**
|
|
59
|
+
* Build URL with optional query parameters
|
|
60
|
+
*/
|
|
61
|
+
private buildUrl;
|
|
58
62
|
/**
|
|
59
63
|
* Handle axios errors and convert to ErrorObject
|
|
60
64
|
*/
|
|
@@ -66,23 +70,23 @@ export declare class HttpWorkspaceClient implements IWorkspaceClient {
|
|
|
66
70
|
/**
|
|
67
71
|
* List files and directories at the specified path
|
|
68
72
|
*/
|
|
69
|
-
listFiles(path: string[]): Promise<FileInfo[]>;
|
|
73
|
+
listFiles(path: string[], options?: RequestOptions): Promise<FileInfo[]>;
|
|
70
74
|
/**
|
|
71
75
|
* Create a directory at the specified path
|
|
72
76
|
*/
|
|
73
|
-
createDirectory(path: string[]): Promise<FileInfo>;
|
|
77
|
+
createDirectory(path: string[], options?: RequestOptions): Promise<FileInfo>;
|
|
74
78
|
/**
|
|
75
79
|
* Read a file's metadata and content
|
|
76
80
|
*/
|
|
77
|
-
readFile(path: string[]): Promise<FileInfo>;
|
|
81
|
+
readFile(path: string[], options?: RequestOptions): Promise<FileInfo>;
|
|
78
82
|
/**
|
|
79
83
|
* Write or update a file's content (uses PUT method)
|
|
80
84
|
*/
|
|
81
|
-
putFile(path: string[], content: any): Promise<FileInfo>;
|
|
85
|
+
putFile(path: string[], content: any, options?: RequestOptions): Promise<FileInfo>;
|
|
82
86
|
/**
|
|
83
87
|
* Delete a file or directory
|
|
84
88
|
*/
|
|
85
|
-
deleteFile(path: string[]): Promise<FileInfo>;
|
|
89
|
+
deleteFile(path: string[], options?: RequestOptions): Promise<FileInfo>;
|
|
86
90
|
/**
|
|
87
91
|
* Get the workspace ID
|
|
88
92
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-workspace-client.d.ts","sourceRoot":"","sources":["../../src/providers/http-workspace-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"http-workspace-client.d.ts","sourceRoot":"","sources":["../../src/providers/http-workspace-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,OAAO,CAAC,EAAE,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GrB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,GACf,mBAAmB,CAKrB"}
|
|
@@ -44,6 +44,27 @@ export class HttpWorkspaceClient {
|
|
|
44
44
|
formatPath(path) {
|
|
45
45
|
return path.join('/');
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Build URL with optional query parameters
|
|
49
|
+
*/
|
|
50
|
+
buildUrl(basePath, options) {
|
|
51
|
+
if (!options?.queryParams) {
|
|
52
|
+
return basePath;
|
|
53
|
+
}
|
|
54
|
+
const params = new URLSearchParams();
|
|
55
|
+
for (const [key, value] of Object.entries(options.queryParams)) {
|
|
56
|
+
if (value === undefined)
|
|
57
|
+
continue;
|
|
58
|
+
if (Array.isArray(value)) {
|
|
59
|
+
value.forEach((v) => params.append(key, String(v)));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
params.append(key, String(value));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const queryString = params.toString();
|
|
66
|
+
return queryString ? `${basePath}?${queryString}` : basePath;
|
|
67
|
+
}
|
|
47
68
|
/**
|
|
48
69
|
* Handle axios errors and convert to ErrorObject
|
|
49
70
|
*/
|
|
@@ -84,10 +105,11 @@ export class HttpWorkspaceClient {
|
|
|
84
105
|
/**
|
|
85
106
|
* List files and directories at the specified path
|
|
86
107
|
*/
|
|
87
|
-
async listFiles(path) {
|
|
108
|
+
async listFiles(path, options) {
|
|
88
109
|
try {
|
|
89
110
|
const formattedPath = this.formatPath(path);
|
|
90
|
-
const
|
|
111
|
+
const url = this.buildUrl(`/${this.workspaceId}/files/${formattedPath}`, options);
|
|
112
|
+
const response = await this.axios.get(url);
|
|
91
113
|
return response.data;
|
|
92
114
|
}
|
|
93
115
|
catch (error) {
|
|
@@ -97,10 +119,11 @@ export class HttpWorkspaceClient {
|
|
|
97
119
|
/**
|
|
98
120
|
* Create a directory at the specified path
|
|
99
121
|
*/
|
|
100
|
-
async createDirectory(path) {
|
|
122
|
+
async createDirectory(path, options) {
|
|
101
123
|
try {
|
|
102
124
|
const formattedPath = this.formatPath(path);
|
|
103
|
-
const
|
|
125
|
+
const url = this.buildUrl(`/${this.workspaceId}/mkdir/${formattedPath}`, options);
|
|
126
|
+
const response = await this.axios.post(url);
|
|
104
127
|
return response.data;
|
|
105
128
|
}
|
|
106
129
|
catch (error) {
|
|
@@ -110,10 +133,11 @@ export class HttpWorkspaceClient {
|
|
|
110
133
|
/**
|
|
111
134
|
* Read a file's metadata and content
|
|
112
135
|
*/
|
|
113
|
-
async readFile(path) {
|
|
136
|
+
async readFile(path, options) {
|
|
114
137
|
try {
|
|
115
138
|
const formattedPath = this.formatPath(path);
|
|
116
|
-
const
|
|
139
|
+
const url = this.buildUrl(`/${this.workspaceId}/read/${formattedPath}`, options);
|
|
140
|
+
const response = await this.axios.get(url);
|
|
117
141
|
return response.data;
|
|
118
142
|
}
|
|
119
143
|
catch (error) {
|
|
@@ -123,11 +147,12 @@ export class HttpWorkspaceClient {
|
|
|
123
147
|
/**
|
|
124
148
|
* Write or update a file's content (uses PUT method)
|
|
125
149
|
*/
|
|
126
|
-
async putFile(path, content) {
|
|
150
|
+
async putFile(path, content, options) {
|
|
127
151
|
try {
|
|
128
152
|
const formattedPath = this.formatPath(path);
|
|
129
153
|
const serializedContent = this.serializeContent(content);
|
|
130
|
-
const
|
|
154
|
+
const url = this.buildUrl(`/${this.workspaceId}/put/${formattedPath}`, options);
|
|
155
|
+
const response = await this.axios.put(url, { content: serializedContent });
|
|
131
156
|
return response.data;
|
|
132
157
|
}
|
|
133
158
|
catch (error) {
|
|
@@ -137,10 +162,11 @@ export class HttpWorkspaceClient {
|
|
|
137
162
|
/**
|
|
138
163
|
* Delete a file or directory
|
|
139
164
|
*/
|
|
140
|
-
async deleteFile(path) {
|
|
165
|
+
async deleteFile(path, options) {
|
|
141
166
|
try {
|
|
142
167
|
const formattedPath = this.formatPath(path);
|
|
143
|
-
const
|
|
168
|
+
const url = this.buildUrl(`/${this.workspaceId}/delete/${formattedPath}`, options);
|
|
169
|
+
const response = await this.axios.delete(url);
|
|
144
170
|
return response.data;
|
|
145
171
|
}
|
|
146
172
|
catch (error) {
|