@loopstack/remote-file-explorer-module 0.23.0 → 0.24.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.
@@ -1,12 +1,10 @@
1
- import { Repository } from 'typeorm';
2
- import { CurrentUserInterface, WorkspaceEntity } from '@loopstack/common';
3
- import { RemoteClient } from '@loopstack/remote-client';
1
+ import { CurrentUserInterface } from '@loopstack/common';
2
+ import { EnvironmentService, RemoteClient } from '@loopstack/remote-client';
4
3
  export declare class RemoteFileExplorerController {
5
- private readonly remoteAgentClient;
6
- private readonly workspaceRepository;
7
- constructor(remoteAgentClient: RemoteClient, workspaceRepository: Repository<WorkspaceEntity>);
8
- private getAgentUrl;
9
- getFileTree(workspaceId: string, basePath: string | undefined, user: CurrentUserInterface): Promise<unknown>;
10
- readFile(workspaceId: string, filePath: string, user: CurrentUserInterface): Promise<import("@loopstack/remote-client").FileReadResponse>;
4
+ private readonly remote;
5
+ private readonly env;
6
+ constructor(remote: RemoteClient, env: EnvironmentService);
7
+ getFileTree(workspaceId: string, basePath: string | undefined, _user: CurrentUserInterface): Promise<unknown>;
8
+ readFile(workspaceId: string, filePath: string, _user: CurrentUserInterface): Promise<import("@loopstack/remote-client").FileReadResponse>;
11
9
  }
12
10
  //# sourceMappingURL=remote-file-explorer.controller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remote-file-explorer.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/remote-file-explorer.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAe,oBAAoB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,qBAEa,4BAA4B;IAErC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAElC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAFnB,iBAAiB,EAAE,YAAY,EAE/B,mBAAmB,EAAE,UAAU,CAAC,eAAe,CAAC;YAGrD,WAAW;IAmBnB,WAAW,CACO,WAAW,EAAE,MAAM,EAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,IAAI,EAAE,oBAAoB,GACxC,OAAO,CAAC,OAAO,CAAC;IAMb,QAAQ,CACU,WAAW,EAAE,MAAM,EAC1B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,oBAAoB;CAK5C"}
1
+ {"version":3,"file":"remote-file-explorer.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/remote-file-explorer.controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE5E,qBAEa,4BAA4B;IAErC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBADH,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,kBAAkB;IAIpC,WAAW,CACO,WAAW,EAAE,MAAM,EAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,oBAAoB,GACzC,OAAO,CAAC,OAAO,CAAC;IAMb,QAAQ,CACU,WAAW,EAAE,MAAM,EAC1B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,oBAAoB;CAK7C"}
@@ -10,39 +10,23 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  var __param = (this && this.__param) || function (paramIndex, decorator) {
11
11
  return function (target, key) { decorator(target, key, paramIndex); }
12
12
  };
13
- import { Controller, Get, NotFoundException, Param, Query, UsePipes, ValidationPipe } from '@nestjs/common';
14
- import { InjectRepository } from '@nestjs/typeorm';
15
- import { Repository } from 'typeorm';
16
- import { CurrentUser, WorkspaceEntity } from '@loopstack/common';
17
- import { RemoteClient } from '@loopstack/remote-client';
13
+ import { Controller, Get, Param, Query, UsePipes, ValidationPipe } from '@nestjs/common';
14
+ import { CurrentUser } from '@loopstack/common';
15
+ import { EnvironmentService, RemoteClient } from '@loopstack/remote-client';
18
16
  let RemoteFileExplorerController = class RemoteFileExplorerController {
19
- remoteAgentClient;
20
- workspaceRepository;
21
- constructor(remoteAgentClient, workspaceRepository) {
22
- this.remoteAgentClient = remoteAgentClient;
23
- this.workspaceRepository = workspaceRepository;
17
+ remote;
18
+ env;
19
+ constructor(remote, env) {
20
+ this.remote = remote;
21
+ this.env = env;
24
22
  }
25
- async getAgentUrl(workspaceId, userId) {
26
- const workspace = await this.workspaceRepository.findOne({
27
- where: { id: workspaceId, createdBy: userId },
28
- relations: ['environments'],
29
- });
30
- if (!workspace) {
31
- throw new NotFoundException(`Workspace with ID ${workspaceId} not found`);
32
- }
33
- const environment = workspace.environments?.find((e) => !!e.agentUrl);
34
- if (!environment?.agentUrl) {
35
- throw new NotFoundException(`No remote environment configured for workspace ${workspaceId}`);
36
- }
37
- return environment.agentUrl;
23
+ async getFileTree(workspaceId, basePath, _user) {
24
+ const agentUrl = await this.env.getAgentUrlForWorkspace(workspaceId);
25
+ return this.remote.getFileTree(agentUrl, basePath ?? './src');
38
26
  }
39
- async getFileTree(workspaceId, basePath, user) {
40
- const agentUrl = await this.getAgentUrl(workspaceId, user.userId);
41
- return this.remoteAgentClient.getFileTree(agentUrl, basePath ?? './src');
42
- }
43
- async readFile(workspaceId, filePath, user) {
44
- const agentUrl = await this.getAgentUrl(workspaceId, user.userId);
45
- return this.remoteAgentClient.readFile(agentUrl, filePath);
27
+ async readFile(workspaceId, filePath, _user) {
28
+ const agentUrl = await this.env.getAgentUrlForWorkspace(workspaceId);
29
+ return this.remote.readFile(agentUrl, filePath);
46
30
  }
47
31
  };
48
32
  __decorate([
@@ -66,9 +50,8 @@ __decorate([
66
50
  RemoteFileExplorerController = __decorate([
67
51
  UsePipes(new ValidationPipe({ transform: true, whitelist: true, forbidNonWhitelisted: true })),
68
52
  Controller('api/v1/workspaces/:workspaceId/files'),
69
- __param(1, InjectRepository(WorkspaceEntity)),
70
53
  __metadata("design:paramtypes", [RemoteClient,
71
- Repository])
54
+ EnvironmentService])
72
55
  ], RemoteFileExplorerController);
73
56
  export { RemoteFileExplorerController };
74
57
  //# sourceMappingURL=remote-file-explorer.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remote-file-explorer.controller.js","sourceRoot":"","sources":["../../src/controllers/remote-file-explorer.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC5G,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,WAAW,EAAwB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIjD,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAEpB;IAEA;IAHnB,YACmB,iBAA+B,EAE/B,mBAAgD;QAFhD,sBAAiB,GAAjB,iBAAiB,CAAc;QAE/B,wBAAmB,GAAnB,mBAAmB,CAA6B;IAChE,CAAC;IAEI,KAAK,CAAC,WAAW,CAAC,WAAmB,EAAE,MAAc;QAC3D,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC;YACvD,KAAK,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE;YAC7C,SAAS,EAAE,CAAC,cAAc,CAAC;SAC5B,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,iBAAiB,CAAC,qBAAqB,WAAW,YAAY,CAAC,CAAC;QAC5E,CAAC;QAED,MAAM,WAAW,GAAG,SAAS,CAAC,YAAY,EAAE,I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AAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9F,UAAU,CAAC,sCAAsC,CAAC;IAI9C,WAAA,gBAAgB,CAAC,eAAe,CAAC,CAAA;qCADE,YAAY;QAEV,UAAU;GAJvC,4BAA4B,CA4CxC"}
1
+ {"version":3,"file":"remote-file-explorer.controller.js","sourceRoot":"","sources":["../../src/controllers/remote-file-explorer.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIrE,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAEpB;IACA;IAFnB,YACmB,MAAoB,EACpB,GAAuB;QADvB,WAAM,GAAN,MAAM,CAAc;QACpB,QAAG,GAAH,GAAG,CAAoB;IACvC,CAAC;IAGE,AAAN,KAAK,CAAC,WAAW,CACO,WAAmB,EAC1B,QAA4B,EAC5B,KAA2B;QAE1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,IAAI,OAAO,CAAC,CAAC;IAChE,CAAC;IAGK,AAAN,KAAK,CAAC,QAAQ,CACU,WAAmB,EAC1B,QAAgB,EAChB,KAA2B;QAE1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC;CACF,CAAA;AAlBO;IADL,GAAG,CAAC,MAAM,CAAC;IAET,WAAA,KAAK,CAAC,aAAa,CAAC,CAAA;IACpB,WAAA,KAAK,CAAC,MAAM,CAAC,CAAA;IACb,WAAA,WAAW,EAAE,CAAA;;;;+DAIf;AAGK;IADL,GAAG,CAAC,MAAM,CAAC;IAET,WAAA,KAAK,CAAC,aAAa,CAAC,CAAA;IACpB,WAAA,KAAK,CAAC,MAAM,CAAC,CAAA;IACb,WAAA,WAAW,EAAE,CAAA;;;;4DAIf;AAxBU,4BAA4B;IAFxC,QAAQ,CAAC,IAAI,cAAc,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9F,UAAU,CAAC,sCAAsC,CAAC;qCAGtB,YAAY;QACf,kBAAkB;GAH/B,4BAA4B,CAyBxC"}
@@ -1,3 +1,8 @@
1
+ import { type DynamicModule } from '@nestjs/common';
1
2
  export declare class RemoteFileExplorerModule {
3
+ static forFeature(config?: {
4
+ enabled?: boolean;
5
+ environments?: string[];
6
+ }): DynamicModule;
2
7
  }
3
8
  //# sourceMappingURL=remote-file-explorer.module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remote-file-explorer.module.d.ts","sourceRoot":"","sources":["../src/remote-file-explorer.module.ts"],"names":[],"mappings":"AAMA,qBAIa,wBAAwB;CAAG"}
1
+ {"version":3,"file":"remote-file-explorer.module.d.ts","sourceRoot":"","sources":["../src/remote-file-explorer.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAI5D,qBAGa,wBAAwB;IACnC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,aAAa;CAM1F"}
@@ -4,16 +4,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ var RemoteFileExplorerModule_1;
7
8
  import { Module } from '@nestjs/common';
8
- import { TypeOrmModule } from '@nestjs/typeorm';
9
- import { WorkspaceEntity } from '@loopstack/common';
10
- import { RemoteClientModule } from '@loopstack/remote-client';
9
+ import { registerFeature } from '@loopstack/common';
11
10
  import { RemoteFileExplorerController } from './controllers/index.js';
12
- let RemoteFileExplorerModule = class RemoteFileExplorerModule {
11
+ let RemoteFileExplorerModule = RemoteFileExplorerModule_1 = class RemoteFileExplorerModule {
12
+ static forFeature(config) {
13
+ return {
14
+ module: RemoteFileExplorerModule_1,
15
+ providers: [registerFeature('fileExplorer', config)],
16
+ };
17
+ }
13
18
  };
14
- RemoteFileExplorerModule = __decorate([
19
+ RemoteFileExplorerModule = RemoteFileExplorerModule_1 = __decorate([
15
20
  Module({
16
- imports: [RemoteClientModule, TypeOrmModule.forFeature([WorkspaceEntity])],
17
21
  controllers: [RemoteFileExplorerController],
18
22
  })
19
23
  ], RemoteFileExplorerModule);
@@ -1 +1 @@
1
- {"version":3,"file":"remote-file-explorer.module.js","sourceRoot":"","sources":["../src/remote-file-explorer.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAM/D,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAAG,CAAA;AAA3B,wBAAwB;IAJpC,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,kBAAkB,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;QAC1E,WAAW,EAAE,CAAC,4BAA4B,CAAC;KAC5C,CAAC;GACW,wBAAwB,CAAG"}
1
+ {"version":3,"file":"remote-file-explorer.module.js","sourceRoot":"","sources":["../src/remote-file-explorer.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAsB,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAK/D,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IACnC,MAAM,CAAC,UAAU,CAAC,MAAuD;QACvE,OAAO;YACL,MAAM,EAAE,0BAAwB;YAChC,SAAS,EAAE,CAAC,eAAe,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;SACrD,CAAC;IACJ,CAAC;CACF,CAAA;AAPY,wBAAwB;IAHpC,MAAM,CAAC;QACN,WAAW,EAAE,CAAC,4BAA4B,CAAC;KAC5C,CAAC;GACW,wBAAwB,CAOpC"}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "remote-agent",
9
9
  "workflow"
10
10
  ],
11
- "version": "0.23.0",
11
+ "version": "0.24.0",
12
12
  "license": "MIT",
13
13
  "author": {
14
14
  "name": "Jakob Klippel",
@@ -31,9 +31,8 @@
31
31
  "watch": "nest build --watch"
32
32
  },
33
33
  "dependencies": {
34
- "@loopstack/common": "^0.30.0",
35
- "@loopstack/core": "^0.30.0",
36
- "@loopstack/remote-client": "^0.24.0",
34
+ "@loopstack/common": "^0.32.0",
35
+ "@loopstack/remote-client": "^0.25.0",
37
36
  "@nestjs/common": "^11.1.19",
38
37
  "@nestjs/typeorm": "^11.0.1",
39
38
  "typeorm": "^0.3.28"