@fleetbase/registry-bridge-engine 0.0.5 → 0.0.7

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/composer.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbase/registry-bridge",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Internal Bridge between Fleetbase API and Extensions Registry",
5
5
  "keywords": [
6
6
  "fleetbase-extension",
package/extension.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Registry Bridge",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Internal Bridge between Fleetbase API and Extensions Registry",
5
5
  "repository": "https://github.com/fleetbase/registry-bridge",
6
6
  "license": "AGPL-3.0-or-later",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/registry-bridge-engine",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Internal Bridge between Fleetbase API and Extensions Registry",
5
5
  "fleetbase": {
6
6
  "route": "extensions"
@@ -2,7 +2,7 @@
2
2
 
3
3
  namespace Fleetbase\RegistryBridge\Console\Commands;
4
4
 
5
- use Fleetbase\RegistryBridge\Providers\RegistryBridgeServiceProvider;
5
+ use Fleetbase\RegistryBridge\Support\Utils;
6
6
  use Illuminate\Console\Command;
7
7
 
8
8
  class Initialize extends Command
@@ -28,7 +28,7 @@ class Initialize extends Command
28
28
  */
29
29
  public function handle()
30
30
  {
31
- RegistryBridgeServiceProvider::bootRegistryAuth(true);
31
+ Utils::bootRegistryAuth(true);
32
32
 
33
33
  return 0;
34
34
  }
@@ -3,6 +3,7 @@
3
3
  namespace Fleetbase\RegistryBridge\Http\Controllers\Internal\v1;
4
4
 
5
5
  use Fleetbase\Exceptions\FleetbaseRequestValidationException;
6
+ use Fleetbase\Http\Requests\AdminRequest;
6
7
  use Fleetbase\Models\Setting;
7
8
  use Fleetbase\RegistryBridge\Http\Controllers\RegistryBridgeController;
8
9
  use Fleetbase\RegistryBridge\Http\Requests\CreateRegistryExtensionRequest;
@@ -262,9 +263,11 @@ class RegistryExtensionController extends RegistryBridgeController
262
263
  * This method fetches the current registry host and token from the configuration
263
264
  * settings or environment variables and returns them in a JSON response.
264
265
  *
266
+ * @param AdminRequest $request the incoming HTTP request containing the new host and token
267
+ *
265
268
  * @return \Illuminate\Http\JsonResponse a JSON response containing the registry host and token
266
269
  */
267
- public function getConfig()
270
+ public function getConfig(AdminRequest $request)
268
271
  {
269
272
  $registryHost = config('registry-bridge.registry.host', env('REGISTRY_HOST', 'https://registry.fleetbase.io'));
270
273
  $registryToken = config('registry-bridge.registry.token', env('REGISTRY_TOKEN'));
@@ -282,11 +285,11 @@ class RegistryExtensionController extends RegistryBridgeController
282
285
  * If no input is provided, it uses the current configuration values or environment variables.
283
286
  * The updated configuration is then saved in the settings and returned in a JSON response.
284
287
  *
285
- * @param Request $request the incoming HTTP request containing the new host and token
288
+ * @param AdminRequest $request the incoming HTTP request containing the new host and token
286
289
  *
287
290
  * @return \Illuminate\Http\JsonResponse a JSON response containing the updated registry host and token
288
291
  */
289
- public function saveConfig(Request $request)
292
+ public function saveConfig(AdminRequest $request)
290
293
  {
291
294
  $currentRegistryHost = config('registry-bridge.registry.host', env('REGISTRY_HOST', 'https://registry.fleetbase.io'));
292
295
  $currentRegistryToken = config('registry-bridge.registry.token', env('REGISTRY_TOKEN'));
@@ -27,7 +27,6 @@ class RegistryBridgeServiceProvider extends CoreServiceProvider
27
27
  * @var array
28
28
  */
29
29
  public $commands = [
30
- \Fleetbase\RegistryBridge\Console\Commands\PostInstallExtension::class,
31
30
  \Fleetbase\RegistryBridge\Console\Commands\Initialize::class,
32
31
  ];
33
32
 
@@ -1,84 +0,0 @@
1
- <?php
2
-
3
- namespace Fleetbase\RegistryBridge\Console\Commands;
4
-
5
- use Fleetbase\RegistryBridge\Models\RegistryExtension;
6
- use Illuminate\Console\Command;
7
- use Symfony\Component\Process\Exception\ProcessFailedException;
8
- use Symfony\Component\Process\Process;
9
-
10
- class PostInstallExtension extends Command
11
- {
12
- /**
13
- * The name and signature of the console command.
14
- *
15
- * @var string
16
- */
17
- protected $signature = 'registry:post-install {extensionId}';
18
-
19
- /**
20
- * The console command description.
21
- *
22
- * @var string
23
- */
24
- protected $description = 'Post install an extension by running necessary commands';
25
-
26
- /**
27
- * Execute the console command.
28
- *
29
- * @return int
30
- */
31
- public function handle()
32
- {
33
- $extensionId = $this->argument('extensionId');
34
- $extension = RegistryExtension::disableCache()->where('public_id', $extensionId)->first();
35
-
36
- if ($extension) {
37
- $this->postInstallExtension($extension);
38
- $this->info('Post install commands executed successfully.');
39
- } else {
40
- $this->error('Extension not found.');
41
- }
42
-
43
- return 0;
44
- }
45
-
46
- /**
47
- * Post install extension commands.
48
- */
49
- public function postInstallExtension(RegistryExtension $extension): void
50
- {
51
- if (isset($extension->currentBundle)) {
52
- $composerJson = $extension->currentBundle->meta['composer.json'];
53
- if ($composerJson) {
54
- $extensionPath = base_path('vendor/' . $composerJson['name']);
55
-
56
- $commands = [
57
- 'rm -rf /fleetbase/.pnpm-store',
58
- 'rm -rf node_modules',
59
- 'pnpm install',
60
- 'pnpm build',
61
- ];
62
-
63
- $this->info('Running post install for: ' . $extension->name);
64
- $this->info('Extension install path: ' . $extensionPath);
65
- foreach ($commands as $command) {
66
- $this->info('Running extension post install command: `' . $command . '`');
67
- $process = Process::fromShellCommandline($command, $extensionPath);
68
- $process->run(function ($type, $buffer) {
69
- if (Process::ERR === $type) {
70
- $this->error($buffer);
71
- } else {
72
- $this->info($buffer);
73
- }
74
- });
75
-
76
- // Check if the process was successful
77
- if (!$process->isSuccessful()) {
78
- throw new ProcessFailedException($process);
79
- }
80
- }
81
- }
82
- }
83
- }
84
- }