@fleetbase/registry-bridge-engine 0.0.11 → 0.0.13
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/addon/components/extension-card.hbs +5 -0
- package/addon/components/extension-card.js +54 -3
- package/addon/components/extension-form.hbs +20 -2
- package/addon/components/extension-form.js +57 -0
- package/addon/components/modals/extension-details.hbs +40 -18
- package/addon/components/modals/self-managed-install-instructions.hbs +40 -0
- package/addon/controllers/installed.js +2 -0
- package/addon/engine.js +1 -1
- package/addon/models/registry-extension.js +2 -0
- package/addon/routes/application.js +11 -0
- package/addon/routes/developers/analytics.js +11 -0
- package/addon/routes/developers/credentials.js +11 -0
- package/addon/routes/developers/extensions/edit.js +11 -0
- package/addon/routes/developers/extensions/index.js +11 -0
- package/addon/routes/developers/extensions/new.js +14 -1
- package/addon/routes/developers/extensions.js +14 -1
- package/addon/routes/developers/payments/index.js +11 -0
- package/addon/routes/developers/payments/onboard.js +8 -1
- package/addon/routes/developers/payments.js +14 -1
- package/addon/routes/explore/category.js +11 -0
- package/addon/routes/explore/index.js +11 -0
- package/addon/routes/installed.js +11 -0
- package/addon/routes/purchased.js +11 -0
- package/addon/styles/registry-bridge-engine.css +137 -0
- package/addon/templates/application.hbs +9 -15
- package/addon/templates/developers/analytics.hbs +2 -0
- package/addon/templates/developers/credentials.hbs +1 -1
- package/addon/templates/developers/extensions/edit.hbs +2 -1
- package/addon/templates/developers/extensions/index.hbs +1 -1
- package/addon/templates/developers/extensions/new.hbs +1 -1
- package/addon/templates/developers/payments/index.hbs +1 -1
- package/app/components/modals/self-managed-install-instructions.js +1 -0
- package/composer.json +2 -2
- package/extension.json +1 -1
- package/package.json +4 -3
- package/server/migrations/2024_08_02_072214_add_self_managed_column_to_registry_extensions_table.php +28 -0
- package/server/src/Auth/Schemas/RegistryBridge.php +215 -0
- package/server/src/Http/Controllers/Internal/v1/RegistryController.php +46 -0
- package/server/src/Models/RegistryExtension.php +45 -0
- package/server/src/Models/RegistryExtensionBundle.php +2 -2
- package/server/src/routes.php +2 -1
- package/translations/en-us.yaml +14 -1
|
@@ -15,6 +15,7 @@ use Fleetbase\Traits\HasMetaAttributes;
|
|
|
15
15
|
use Fleetbase\Traits\HasPublicId;
|
|
16
16
|
use Fleetbase\Traits\HasUuid;
|
|
17
17
|
use Fleetbase\Traits\Searchable;
|
|
18
|
+
use Illuminate\Support\Str;
|
|
18
19
|
use Spatie\Sluggable\HasSlug;
|
|
19
20
|
use Spatie\Sluggable\SlugOptions;
|
|
20
21
|
|
|
@@ -57,6 +58,7 @@ class RegistryExtension extends Model
|
|
|
57
58
|
'stripe_product_id',
|
|
58
59
|
'name',
|
|
59
60
|
'subtitle',
|
|
61
|
+
'self_managed',
|
|
60
62
|
'payment_required',
|
|
61
63
|
'price',
|
|
62
64
|
'sale_price',
|
|
@@ -90,6 +92,7 @@ class RegistryExtension extends Model
|
|
|
90
92
|
* The attributes that should be cast to native types.
|
|
91
93
|
*/
|
|
92
94
|
protected $casts = [
|
|
95
|
+
'self_managed' => 'boolean',
|
|
93
96
|
'payment_required' => 'boolean',
|
|
94
97
|
'on_sale' => 'boolean',
|
|
95
98
|
'subscription_required' => 'boolean',
|
|
@@ -121,6 +124,7 @@ class RegistryExtension extends Model
|
|
|
121
124
|
'publisher_name',
|
|
122
125
|
'is_purchased',
|
|
123
126
|
'is_installed',
|
|
127
|
+
'is_author',
|
|
124
128
|
];
|
|
125
129
|
|
|
126
130
|
/**
|
|
@@ -413,6 +417,14 @@ class RegistryExtension extends Model
|
|
|
413
417
|
return data_get($this, 'company.name');
|
|
414
418
|
}
|
|
415
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Determines if the current company session is the author of the extension.
|
|
422
|
+
*/
|
|
423
|
+
public function getIsAuthorAttribute(): bool
|
|
424
|
+
{
|
|
425
|
+
return $this->company_uuid === session('company');
|
|
426
|
+
}
|
|
427
|
+
|
|
416
428
|
/**
|
|
417
429
|
* Finds a RegistryExtension by package name in the associated currentBundle.
|
|
418
430
|
*
|
|
@@ -433,6 +445,39 @@ class RegistryExtension extends Model
|
|
|
433
445
|
})->first();
|
|
434
446
|
}
|
|
435
447
|
|
|
448
|
+
/**
|
|
449
|
+
* Lookup a registry extension based on the given package name.
|
|
450
|
+
*
|
|
451
|
+
* This method attempts to find a `RegistryExtension` that matches the provided package name. It checks multiple fields including
|
|
452
|
+
* `uuid`, `public_id`, and `slug`. If the package name starts with 'fleetbase/', it also attempts to match the slug extracted from the package name.
|
|
453
|
+
*
|
|
454
|
+
* Additionally, the method checks for the existence of a related `currentBundle` where the `package.json` or `composer.json` metadata
|
|
455
|
+
* matches the provided package name.
|
|
456
|
+
*
|
|
457
|
+
* @param string $packageName the name, UUID, public ID, or slug of the package to lookup
|
|
458
|
+
*
|
|
459
|
+
* @return RegistryExtension|null returns the found `RegistryExtension` instance or `null` if no match is found
|
|
460
|
+
*/
|
|
461
|
+
public static function lookup(string $packageName): ?RegistryExtension
|
|
462
|
+
{
|
|
463
|
+
return static::where('status', 'published')->where(function ($query) use ($packageName) {
|
|
464
|
+
$query->where('uuid', $packageName)
|
|
465
|
+
->orWhere('public_id', $packageName)
|
|
466
|
+
->orWhere('slug', $packageName);
|
|
467
|
+
|
|
468
|
+
// Check for fleetbase/ prefix and match slug
|
|
469
|
+
if (Str::startsWith($packageName, 'fleetbase/')) {
|
|
470
|
+
$packageSlug = explode('/', $packageName)[1] ?? null;
|
|
471
|
+
if ($packageSlug) {
|
|
472
|
+
$query->orWhere('slug', $packageSlug);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
})->orWhereHas('currentBundle', function ($query) use ($packageName) {
|
|
476
|
+
$query->where('meta->package.json->name', $packageName)
|
|
477
|
+
->orWhere('meta->composer.json->name', $packageName);
|
|
478
|
+
})->with(['currentBundle'])->first();
|
|
479
|
+
}
|
|
480
|
+
|
|
436
481
|
/**
|
|
437
482
|
* Determines if the current extension instance is ready for submission.
|
|
438
483
|
*
|
|
@@ -688,7 +688,7 @@ class RegistryExtensionBundle extends Model
|
|
|
688
688
|
]);
|
|
689
689
|
|
|
690
690
|
// minimal latency
|
|
691
|
-
usleep(
|
|
691
|
+
usleep(50 * rand(1, 3));
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
694
|
}
|
|
@@ -708,7 +708,7 @@ class RegistryExtensionBundle extends Model
|
|
|
708
708
|
]);
|
|
709
709
|
|
|
710
710
|
// minimal latency
|
|
711
|
-
usleep(
|
|
711
|
+
usleep(50 * rand(1, 3));
|
|
712
712
|
}
|
|
713
713
|
}
|
|
714
714
|
}
|
package/server/src/routes.php
CHANGED
|
@@ -12,7 +12,8 @@ use Illuminate\Support\Facades\Route;
|
|
|
12
12
|
| is assigned the "api" middleware group. Enjoy building your API!
|
|
13
13
|
|
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
// Lookup package endpoint
|
|
16
|
+
Route::get(config('internals.api.routing.prefix', '~registry') . '/v1/lookup', 'Fleetbase\RegistryBridge\Http\Controllers\Internal\v1\RegistryController@lookupPackage');
|
|
16
17
|
Route::prefix(config('internals.api.routing.prefix', '~registry'))->middleware(['fleetbase.registry'])->namespace('Fleetbase\RegistryBridge\Http\Controllers')->group(
|
|
17
18
|
function ($router) {
|
|
18
19
|
/*
|
package/translations/en-us.yaml
CHANGED
|
@@ -9,6 +9,17 @@ registry-bridge:
|
|
|
9
9
|
about: About
|
|
10
10
|
about-extension: About {extensionName}
|
|
11
11
|
component:
|
|
12
|
+
extension-details-modal:
|
|
13
|
+
extension: Extension
|
|
14
|
+
author: Author
|
|
15
|
+
description: Description
|
|
16
|
+
overview: Overview
|
|
17
|
+
details: Details
|
|
18
|
+
version: Version
|
|
19
|
+
updated: Updated
|
|
20
|
+
website: Website
|
|
21
|
+
self-managed: Self Managed
|
|
22
|
+
self-managed-help-text: A self-managed extension is designed for users who host Fleetbase on their own servers, outside of the cloud/SaaS environment. These extensions require manual installation and configuration. If you are using Fleetbase as a self-hosted instance, you can use these extensions to add additional features. However, they are not available for cloud/SaaS users.
|
|
12
23
|
extension-pending-publish-viewer:
|
|
13
24
|
content-panel-title: Extensions Pending Publish
|
|
14
25
|
focused-extension-title: >
|
|
@@ -116,4 +127,6 @@ registry-bridge:
|
|
|
116
127
|
extension-id: Extension ID
|
|
117
128
|
extension-id-help-text: The unique identifier for this extension.
|
|
118
129
|
bundles: Bundles
|
|
119
|
-
upload-new-bundle: Upload new Bundle
|
|
130
|
+
upload-new-bundle: Upload new Bundle
|
|
131
|
+
self-managed: Self Managed
|
|
132
|
+
self-managed-help-text: Enable this option if your module is intended for self-hosted instances only. By selecting this, the module will not be available for installation on the cloud/SaaS version of Fleetbase and must be manually installed by the user on their own server.
|