@fleetbase/registry-bridge-engine 0.0.14 → 0.0.15
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.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "Internal Bridge between Fleetbase API and Extensions Registry",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fleetbase-extension",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"require": {
|
|
22
22
|
"php": "^8.0",
|
|
23
|
-
"fleetbase/core-api": "^1.5.
|
|
23
|
+
"fleetbase/core-api": "^1.5.10",
|
|
24
24
|
"laravel/cashier": "^15.2.1",
|
|
25
25
|
"php-http/guzzle7-adapter": "^1.0",
|
|
26
26
|
"psr/http-factory-implementation": "*",
|
package/config/environment.js
CHANGED
|
@@ -10,16 +10,9 @@ module.exports = function (environment) {
|
|
|
10
10
|
modulePrefix: name,
|
|
11
11
|
environment,
|
|
12
12
|
mountedEngineRoutePrefix: getMountedEngineRoutePrefix(),
|
|
13
|
-
|
|
14
13
|
stripe: {
|
|
15
14
|
publishableKey: getenv('STRIPE_KEY'),
|
|
16
15
|
},
|
|
17
|
-
|
|
18
|
-
'ember-leaflet': {
|
|
19
|
-
excludeCSS: true,
|
|
20
|
-
excludeJS: true,
|
|
21
|
-
excludeImages: true,
|
|
22
|
-
},
|
|
23
16
|
};
|
|
24
17
|
|
|
25
18
|
return ENV;
|
package/extension.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetbase/registry-bridge-engine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "Internal Bridge between Fleetbase API and Extensions Registry",
|
|
5
5
|
"fleetbase": {
|
|
6
6
|
"route": "extensions"
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@babel/core": "^7.23.2",
|
|
42
|
-
"@fleetbase/ember-core": "^0.2.
|
|
43
|
-
"@fleetbase/ember-ui": "^0.2.
|
|
42
|
+
"@fleetbase/ember-core": "^0.2.21",
|
|
43
|
+
"@fleetbase/ember-ui": "^0.2.34",
|
|
44
44
|
"@fortawesome/ember-fontawesome": "^2.0.0",
|
|
45
45
|
"@fortawesome/fontawesome-svg-core": "6.4.0",
|
|
46
46
|
"@fortawesome/free-solid-svg-icons": "6.4.0",
|
|
@@ -42,15 +42,55 @@ class RegistryController extends Controller
|
|
|
42
42
|
* @return \Illuminate\Http\JsonResponse
|
|
43
43
|
* A JSON response containing a list of installed engines with their metadata
|
|
44
44
|
*/
|
|
45
|
-
public function getInstalledEngines()
|
|
45
|
+
public function getInstalledEngines(Request $request)
|
|
46
46
|
{
|
|
47
|
-
$
|
|
48
|
-
$
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
if ($request->user() && $request->session()->has('company')) {
|
|
48
|
+
$installedExtensions = RegistryExtension::disableCache()->whereHas('installs', function ($query) {
|
|
49
|
+
$query->where('company_uuid', session('company'));
|
|
50
|
+
})->get()->map(function ($extension) {
|
|
51
|
+
return $extension->currentBundle->meta['package.json'] ?? [];
|
|
52
|
+
});
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
return response()->json($installedExtensions);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Determines if a specified engine is installed for the authenticated user's company.
|
|
62
|
+
*
|
|
63
|
+
* Retrieves the 'engine' input from the request and checks if the user is authenticated,
|
|
64
|
+
* the session has a 'company', and the 'engine' parameter is provided. It then queries
|
|
65
|
+
* the `RegistryExtension` model to determine if the engine is installed for the company.
|
|
66
|
+
*
|
|
67
|
+
* @param Request $request the incoming HTTP request containing the 'engine' parameter
|
|
68
|
+
*
|
|
69
|
+
* @return array An associative array with the installation status, e.g., ['installed' => true].
|
|
70
|
+
*/
|
|
71
|
+
public function getEngineInstallStatus(Request $request)
|
|
72
|
+
{
|
|
73
|
+
$engine = $request->input('engine');
|
|
74
|
+
|
|
75
|
+
if ($request->user() && $request->session()->has('company') && $engine) {
|
|
76
|
+
$installed = RegistryExtension::disableCache()
|
|
77
|
+
->whereHas(
|
|
78
|
+
'currentBundle',
|
|
79
|
+
function ($query) use ($engine) {
|
|
80
|
+
$query->where('meta->package.json->name', $engine);
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
->whereHas(
|
|
84
|
+
'installs',
|
|
85
|
+
function ($query) {
|
|
86
|
+
$query->where('company_uuid', session('company'));
|
|
87
|
+
}
|
|
88
|
+
)->exists();
|
|
89
|
+
|
|
90
|
+
return ['installed' => $installed];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return ['installed' => false];
|
|
54
94
|
}
|
|
55
95
|
|
|
56
96
|
/**
|
package/server/src/routes.php
CHANGED
|
@@ -14,6 +14,8 @@ use Illuminate\Support\Facades\Route;
|
|
|
14
14
|
*/
|
|
15
15
|
// Lookup package endpoint
|
|
16
16
|
Route::get(config('internals.api.routing.prefix', '~registry') . '/v1/lookup', 'Fleetbase\RegistryBridge\Http\Controllers\Internal\v1\RegistryController@lookupPackage');
|
|
17
|
+
Route::get(config('internals.api.routing.prefix', '~registry') . '/v1/engines', 'Fleetbase\RegistryBridge\Http\Controllers\Internal\v1\RegistryController@getInstalledEngines');
|
|
18
|
+
Route::get(config('internals.api.routing.prefix', '~registry') . '/v1/engine-install-status', 'Fleetbase\RegistryBridge\Http\Controllers\Internal\v1\RegistryController@getEngineInstallStatus');
|
|
17
19
|
Route::prefix(config('internals.api.routing.prefix', '~registry'))->middleware(['fleetbase.registry'])->namespace('Fleetbase\RegistryBridge\Http\Controllers')->group(
|
|
18
20
|
function ($router) {
|
|
19
21
|
/*
|
|
@@ -36,7 +38,6 @@ Route::prefix(config('internals.api.routing.prefix', '~registry'))->middleware([
|
|
|
36
38
|
|
|
37
39
|
$router->group(['middleware' => ['fleetbase.protected', 'throttle:60,1']], function ($router) {
|
|
38
40
|
$router->get('categories', 'RegistryController@categories');
|
|
39
|
-
$router->get('engines', 'RegistryController@getInstalledEngines');
|
|
40
41
|
|
|
41
42
|
$router->group(['prefix' => 'installer'], function ($router) {
|
|
42
43
|
$router->post('install', 'ExtensionInstallerController@install');
|