@fleetbase/registry-bridge-engine 0.1.6 → 0.1.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.1.6",
3
+ "version": "0.1.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.1.6",
3
+ "version": "0.1.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.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Internal Bridge between Fleetbase API and Extensions Registry",
5
5
  "fleetbase": {
6
6
  "route": "extensions"
@@ -8,6 +8,7 @@ use Fleetbase\Models\Setting;
8
8
  use Fleetbase\RegistryBridge\Http\Controllers\RegistryBridgeController;
9
9
  use Fleetbase\RegistryBridge\Http\Requests\CreateRegistryExtensionRequest;
10
10
  use Fleetbase\RegistryBridge\Http\Requests\RegistryExtensionActionRequest;
11
+ use Fleetbase\RegistryBridge\Http\Resources\PublicRegistryExtension;
11
12
  use Fleetbase\RegistryBridge\Models\RegistryExtension;
12
13
  use Fleetbase\RegistryBridge\Support\Utils;
13
14
  use Illuminate\Http\Request;
@@ -41,14 +42,15 @@ class RegistryExtensionController extends RegistryBridgeController
41
42
 
42
43
  $extensions = \Illuminate\Support\Facades\Cache::remember($cacheKey, $cacheTtl, function () {
43
44
  return RegistryExtension::where('status', 'published')
44
- ->with(['author', 'category', 'currentBundle'])
45
- ->orderBy('install_count', 'desc')
45
+ ->with(['company', 'category', 'currentBundle'])
46
+ ->withCount('installs')
47
+ ->orderBy('installs_count', 'desc')
46
48
  ->get();
47
49
  });
48
50
 
49
- $this->resource::wrap('registryExtensions');
51
+ PublicRegistryExtension::withoutWrapping();
50
52
 
51
- return $this->resource::collection($extensions);
53
+ return PublicRegistryExtension::collection($extensions);
52
54
  }
53
55
 
54
56
  /**
@@ -0,0 +1,95 @@
1
+ <?php
2
+
3
+ namespace Fleetbase\RegistryBridge\Http\Resources;
4
+
5
+ use Fleetbase\Http\Resources\FleetbaseResource;
6
+
7
+ class PublicRegistryExtension extends FleetbaseResource
8
+ {
9
+ /**
10
+ * Transform the resource into an array.
11
+ *
12
+ * Only exposes fields that are safe for public consumption.
13
+ * No UUIDs, no Stripe data, no internal IDs, no bundle file relationships,
14
+ * no purchase/install relationships, no sensitive company data.
15
+ *
16
+ * @param \Illuminate\Http\Request $request
17
+ *
18
+ * @return array
19
+ */
20
+ public function toArray($request)
21
+ {
22
+ return [
23
+ // Core identity (public_id only, no uuid)
24
+ 'id' => $this->public_id,
25
+ 'slug' => $this->slug,
26
+ 'name' => $this->name,
27
+ 'subtitle' => $this->subtitle,
28
+ 'description' => $this->description,
29
+ 'promotional_text' => $this->promotional_text,
30
+ 'fa_icon' => $this->fa_icon,
31
+ 'icon_url' => $this->icon_url,
32
+ 'tags' => $this->tags ?? [],
33
+ 'languages' => $this->languages ?? [],
34
+ 'primary_language' => $this->primary_language,
35
+ 'version' => $this->version,
36
+ 'status' => $this->status,
37
+
38
+ // URLs
39
+ 'website_url' => $this->website_url,
40
+ 'repo_url' => $this->repo_url,
41
+ 'support_url' => $this->support_url,
42
+ 'privacy_policy_url' => $this->privacy_policy_url,
43
+ 'tos_url' => $this->tos_url,
44
+ 'copyright' => $this->copyright,
45
+
46
+ // Pricing (public-safe fields only, no Stripe IDs)
47
+ 'payment_required' => $this->payment_required,
48
+ 'price' => $this->price,
49
+ 'sale_price' => $this->sale_price,
50
+ 'on_sale' => $this->on_sale,
51
+ 'currency' => $this->currency,
52
+ 'subscription_required' => $this->subscription_required,
53
+
54
+ // Flags
55
+ 'core_extension' => $this->core_extension,
56
+ 'self_managed' => $this->self_managed,
57
+
58
+ // Stats
59
+ 'installs_count' => $this->installs_count ?? 0,
60
+
61
+ // Timestamps
62
+ 'published_at' => $this->published_at,
63
+ 'created_at' => $this->created_at,
64
+ 'updated_at' => $this->updated_at,
65
+
66
+ // Publisher (minimal safe fields only)
67
+ 'publisher' => $this->when($this->relationLoaded('company') && $this->company, [
68
+ 'name' => data_get($this, 'company.name'),
69
+ 'slug' => data_get($this, 'company.slug'),
70
+ 'type' => data_get($this, 'company.type'),
71
+ 'website_url' => data_get($this, 'company.website_url'),
72
+ 'description' => data_get($this, 'company.description'),
73
+ ]),
74
+
75
+ // Category (safe fields only, no UUIDs)
76
+ 'category' => $this->when($this->relationLoaded('category') && $this->category, [
77
+ 'id' => data_get($this, 'category.public_id'),
78
+ 'name' => data_get($this, 'category.name'),
79
+ 'slug' => data_get($this, 'category.slug'),
80
+ 'description' => data_get($this, 'category.description'),
81
+ 'icon' => data_get($this, 'category.icon'),
82
+ 'icon_color' => data_get($this, 'category.icon_color'),
83
+ 'tags' => data_get($this, 'category.tags', []),
84
+ ]),
85
+
86
+ // Current bundle (status, version, meta, bundle_number only - no file relationships, no UUIDs)
87
+ 'current_bundle' => $this->when($this->relationLoaded('currentBundle') && $this->currentBundle, [
88
+ 'bundle_number' => data_get($this, 'currentBundle.bundle_number'),
89
+ 'version' => data_get($this, 'currentBundle.version'),
90
+ 'status' => data_get($this, 'currentBundle.status'),
91
+ 'meta' => data_get($this, 'currentBundle.meta'),
92
+ ]),
93
+ ];
94
+ }
95
+ }