@fleetbase/solid-engine 0.0.2 → 0.0.3

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.
Files changed (69) hide show
  1. package/README.md +24 -0
  2. package/addon/components/explorer-header.hbs +18 -0
  3. package/addon/components/explorer-header.js +25 -0
  4. package/addon/components/modals/backup-pod.hbs +3 -0
  5. package/addon/components/modals/create-pod.hbs +5 -0
  6. package/addon/components/modals/resync-pod.hbs +3 -0
  7. package/addon/components/table/cell/pod-content-actions.hbs +32 -0
  8. package/addon/components/table/cell/pod-content-actions.js +73 -0
  9. package/addon/components/table/cell/pod-content-name.hbs +8 -0
  10. package/addon/components/table/cell/pod-content-name.js +16 -0
  11. package/addon/controllers/account.js +130 -0
  12. package/addon/controllers/application.js +16 -13
  13. package/addon/controllers/home.js +23 -0
  14. package/addon/controllers/pods/explorer/content.js +12 -0
  15. package/addon/controllers/pods/explorer.js +149 -0
  16. package/addon/controllers/pods/index/pod.js +12 -0
  17. package/addon/controllers/pods/index.js +137 -0
  18. package/addon/routes/account.js +3 -0
  19. package/addon/routes/home.js +3 -0
  20. package/addon/routes/pods/explorer/content.js +10 -0
  21. package/addon/routes/pods/explorer.js +44 -0
  22. package/addon/routes/pods/index/pod.js +3 -0
  23. package/addon/routes/pods/index.js +21 -0
  24. package/addon/routes.js +12 -1
  25. package/addon/services/explorer-state.js +101 -0
  26. package/addon/styles/solid-engine.css +46 -0
  27. package/addon/templates/account.hbs +42 -0
  28. package/addon/templates/application.hbs +17 -12
  29. package/addon/templates/home.hbs +11 -0
  30. package/addon/templates/pods/explorer/content.hbs +19 -0
  31. package/addon/templates/pods/explorer.hbs +20 -0
  32. package/addon/templates/pods/index/pod.hbs +11 -0
  33. package/addon/templates/pods/index.hbs +19 -0
  34. package/app/components/explorer-header.js +1 -0
  35. package/app/components/modals/backup-pod.js +1 -0
  36. package/app/components/modals/create-pod.js +1 -0
  37. package/app/components/modals/resync-pod.js +1 -0
  38. package/app/components/table/cell/pod-content-actions.js +1 -0
  39. package/app/components/table/cell/pod-content-name.js +1 -0
  40. package/app/controllers/account.js +1 -0
  41. package/app/controllers/home.js +1 -0
  42. package/app/controllers/pods/explorer/content.js +1 -0
  43. package/app/controllers/pods/explorer.js +1 -0
  44. package/app/controllers/pods/index/pod.js +1 -0
  45. package/app/controllers/pods/index.js +1 -0
  46. package/app/routes/account.js +1 -0
  47. package/app/routes/home.js +1 -0
  48. package/app/routes/pods/explorer/content.js +1 -0
  49. package/app/routes/pods/explorer.js +1 -0
  50. package/app/routes/pods/index/pod.js +1 -0
  51. package/app/routes/pods/index.js +1 -0
  52. package/app/services/explorer-state.js +1 -0
  53. package/app/templates/account.js +1 -0
  54. package/app/templates/home.js +1 -0
  55. package/app/templates/pods/explorer/content.js +1 -0
  56. package/app/templates/pods/explorer.js +1 -0
  57. package/app/templates/pods/index/pod.js +1 -0
  58. package/app/templates/pods/index.js +1 -0
  59. package/composer.json +9 -3
  60. package/extension.json +1 -1
  61. package/package.json +3 -3
  62. package/server/data/pods.json +328 -0
  63. package/server/src/Client/OpenIDConnectClient.php +2 -2
  64. package/server/src/Client/SolidClient.php +1 -1
  65. package/server/src/Http/Controllers/SolidController.php +57 -4
  66. package/server/src/LegacyClient/OIDCClient.php +1 -1
  67. package/server/src/LegacyClient/SolidClient.php +2 -1
  68. package/server/src/Support/Utils.php +38 -0
  69. package/server/src/routes.php +1 -0
package/composer.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbase/solid-api",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Solid Protocol Extension to Store and Share Data with Fleetbase",
5
5
  "keywords": [
6
6
  "fleetbase-extension",
@@ -28,8 +28,8 @@
28
28
  ],
29
29
  "require": {
30
30
  "php": "^8.0",
31
- "fleetbase/core-api": "^1.4.16",
32
- "fleetbase/fleetops-api": "^0.4.25",
31
+ "fleetbase/core-api": "^1.4.22",
32
+ "fleetbase/fleetops-api": "^0.4.27",
33
33
  "php-http/guzzle7-adapter": "^1.0",
34
34
  "psr/http-factory-implementation": "*",
35
35
  "jumbojett/openid-connect-php": "^0.9.10",
@@ -50,6 +50,12 @@
50
50
  "phpstan/phpstan": "^1.10.38",
51
51
  "symfony/var-dumper": "^5.4.29"
52
52
  },
53
+ "repositories": [
54
+ {
55
+ "type": "vcs",
56
+ "url": "https://github.com/fleetbase/laravel-model-caching"
57
+ }
58
+ ],
53
59
  "autoload": {
54
60
  "psr-4": {
55
61
  "Fleetbase\\Solid\\": "server/src/",
package/extension.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Solid",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Solid Protocol Extension to Store and Share Data with Fleetbase",
5
5
  "repository": "https://github.com/fleetbase/solid",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/solid-engine",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Solid Protocol Extension to Store and Share Data with Fleetbase",
5
5
  "fleetbase": {
6
6
  "route": "solid-protocol"
@@ -45,8 +45,8 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@babel/core": "^7.23.2",
48
- "@fleetbase/ember-core": "^0.2.8",
49
- "@fleetbase/ember-ui": "^0.2.12",
48
+ "@fleetbase/ember-core": "^0.2.9",
49
+ "@fleetbase/ember-ui": "^0.2.13",
50
50
  "@fleetbase/fleetops-data": "^0.1.14",
51
51
  "@fortawesome/ember-fontawesome": "^0.4.1",
52
52
  "@fortawesome/fontawesome-svg-core": "^6.4.0",
@@ -0,0 +1,328 @@
1
+ [
2
+ {
3
+ "id": "pod_x2y4bdc",
4
+ "name": "Fleetbase-Sync-2024-03-01",
5
+ "slug": "fleetbase-sync-2024-03-01",
6
+ "size": "346kb",
7
+ "updated_at": "May 07, 2024 13:25",
8
+ "created_at": "May 07, 2024 13:25",
9
+ "contents": [
10
+ {
11
+ "id": "content_wsyz38",
12
+ "name": "Orders-May-2024",
13
+ "slug": "orders-may-2024",
14
+ "size": "80kb",
15
+ "type": "folder",
16
+ "updated_at": "May 05, 2024 14:33",
17
+ "created_at": "May 05, 2024 14:33",
18
+ "contents": [
19
+ {
20
+ "id": "content_wxyz12",
21
+ "name": "EmployeeHandbook_2024.pdf",
22
+ "slug": "employeehandbook-2024-pdf",
23
+ "size": "450kb",
24
+ "type": "file",
25
+ "updated_at": "May 07, 2024 14:22",
26
+ "created_at": "May 07, 2024 14:22"
27
+ },
28
+ {
29
+ "id": "content_345ghi",
30
+ "name": "FinancialSummary_Annual_2024.xlsx",
31
+ "slug": "financialsummary-annual-2024-xlsx",
32
+ "size": "625kb",
33
+ "type": "file",
34
+ "updated_at": "May 07, 2024 14:24",
35
+ "created_at": "May 07, 2024 14:24"
36
+ },
37
+ {
38
+ "id": "content_789jkl",
39
+ "name": "DeveloperGuide_Version2.md",
40
+ "slug": "developerguide-version2-md",
41
+ "size": "75kb",
42
+ "type": "file",
43
+ "updated_at": "May 07, 2024 14:26",
44
+ "created_at": "May 07, 2024 14:26"
45
+ },
46
+ {
47
+ "id": "content_mnopqr",
48
+ "name": "ProjectTimeline_Roadmap2024.gantt",
49
+ "slug": "projecttimeline-roadmap2024-gantt",
50
+ "size": "1.1mb",
51
+ "type": "file",
52
+ "updated_at": "May 07, 2024 14:28",
53
+ "created_at": "May 07, 2024 14:28"
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "id": "content_xjdwkj",
59
+ "name": "RandomCode13.txt",
60
+ "slug": "random-code-13-txt",
61
+ "size": "346kb",
62
+ "type": "file",
63
+ "updated_at": "May 07, 2024 13:25",
64
+ "created_at": "May 07, 2024 13:25"
65
+ },
66
+ {
67
+ "id": "content_1a2b3c",
68
+ "name": "SalesReport_Q1_2024.xlsx",
69
+ "slug": "salesreport-q1-2024-xlsx",
70
+ "size": "525kb",
71
+ "type": "file",
72
+ "updated_at": "May 07, 2024 14:10",
73
+ "created_at": "May 07, 2024 14:10"
74
+ },
75
+ {
76
+ "id": "content_4d5e6f",
77
+ "name": "CustomerFeedback_May2024.pdf",
78
+ "slug": "customerfeedback-may2024-pdf",
79
+ "size": "275kb",
80
+ "type": "file",
81
+ "updated_at": "May 07, 2024 14:12",
82
+ "created_at": "May 07, 2024 14:12"
83
+ }
84
+ ]
85
+ },
86
+ {
87
+ "id": "pod_a9c7jkl",
88
+ "name": "Fleetbase-Backup-2024-04-19",
89
+ "slug": "fleetbase-backup-2024-04-19",
90
+ "size": "420kb",
91
+ "updated_at": "May 08, 2024 11:00",
92
+ "created_at": "May 08, 2024 11:00",
93
+ "contents": [
94
+ {
95
+ "id": "content_dn3892",
96
+ "name": "Vehicles-May-2024",
97
+ "slug": "vehicles-may-2024",
98
+ "size": "80kb",
99
+ "type": "folder",
100
+ "updated_at": "May 05, 2024 14:33",
101
+ "created_at": "May 05, 2024 14:33",
102
+ "contents": [
103
+ {
104
+ "id": "content_stuvwx",
105
+ "name": "HR_PolicyDocument.pdf",
106
+ "slug": "hr-policydocument-pdf",
107
+ "size": "350kb",
108
+ "type": "file",
109
+ "updated_at": "May 07, 2024 14:30",
110
+ "created_at": "May 07, 2024 14:30"
111
+ },
112
+ {
113
+ "id": "content_yza123",
114
+ "name": "DesignMockup_2024.sketch",
115
+ "slug": "designmockup-2024-sketch",
116
+ "size": "3.2mb",
117
+ "type": "file",
118
+ "updated_at": "May 07, 2024 14:32",
119
+ "created_at": "May 07, 2024 14:32"
120
+ },
121
+ {
122
+ "id": "content_456bcd",
123
+ "name": "BugTracker_Report_Apr2024.xlsx",
124
+ "slug": "bugtracker-report-apr2024-xlsx",
125
+ "size": "280kb",
126
+ "type": "file",
127
+ "updated_at": "May 07, 2024 14:34",
128
+ "created_at": "May 07, 2024 14:34"
129
+ },
130
+ {
131
+ "id": "content_789efg",
132
+ "name": "TrainingMaterials_Mar2024.pptx",
133
+ "slug": "trainingmaterials-mar2024-pptx",
134
+ "size": "1.5mb",
135
+ "type": "file",
136
+ "updated_at": "May 07, 2024 14:36",
137
+ "created_at": "May 07, 2024 14:36"
138
+ },
139
+ {
140
+ "id": "content_hijklm",
141
+ "name": "TestPlan_ReleaseCycle_Apr2024.docx",
142
+ "slug": "testplan-releasecycle-apr2024-docx",
143
+ "size": "650kb",
144
+ "type": "file",
145
+ "updated_at": "May 07, 2024 14:38",
146
+ "created_at": "May 07, 2024 14:38"
147
+ }
148
+ ]
149
+ },
150
+ {
151
+ "id": "content_7g8h9i",
152
+ "name": "ProductCatalog_Spring2024.csv",
153
+ "slug": "productcatalog-spring2024-csv",
154
+ "size": "1.2mb",
155
+ "type": "file",
156
+ "updated_at": "May 07, 2024 14:15",
157
+ "created_at": "May 07, 2024 14:15"
158
+ },
159
+ {
160
+ "id": "content_jklmno",
161
+ "name": "ProjectPlan_SummerLaunch.docx",
162
+ "slug": "projectplan-summerlaunch-docx",
163
+ "size": "825kb",
164
+ "type": "file",
165
+ "updated_at": "May 07, 2024 14:18",
166
+ "created_at": "May 07, 2024 14:18"
167
+ },
168
+ {
169
+ "id": "content_pqrsuv",
170
+ "name": "MarketingStrategy_Q3_2024.pptx",
171
+ "slug": "marketingstrategy-q3-2024-pptx",
172
+ "size": "2.3mb",
173
+ "type": "file",
174
+ "updated_at": "May 07, 2024 14:20",
175
+ "created_at": "May 07, 2024 14:20"
176
+ },
177
+ {
178
+ "id": "content_wxyz12",
179
+ "name": "EmployeeHandbook_2024.pdf",
180
+ "slug": "employeehandbook-2024-pdf",
181
+ "size": "450kb",
182
+ "type": "file",
183
+ "updated_at": "May 07, 2024 14:22",
184
+ "created_at": "May 07, 2024 14:22"
185
+ }
186
+ ]
187
+ },
188
+ {
189
+ "id": "pod_b3z1mno",
190
+ "name": "Fleetbase-Demo-2024-05-01",
191
+ "slug": "fleetbase-demo-2024-05-01",
192
+ "size": "512kb",
193
+ "updated_at": "May 09, 2024 09:45",
194
+ "created_at": "May 09, 2024 09:45",
195
+ "contents": [
196
+ {
197
+ "id": "content_dnsus7s",
198
+ "name": "Issues-May-2024",
199
+ "slug": "issues-may-2024",
200
+ "size": "80kb",
201
+ "type": "folder",
202
+ "updated_at": "May 05, 2024 14:33",
203
+ "created_at": "May 05, 2024 14:33",
204
+ "contents": [
205
+ {
206
+ "id": "content_d732sz",
207
+ "name": "Fleet-Reports-May-2024",
208
+ "slug": "fleet-reports-may-2024",
209
+ "size": "80kb",
210
+ "type": "folder",
211
+ "updated_at": "May 05, 2024 14:33",
212
+ "created_at": "May 05, 2024 14:33",
213
+ "contents": [
214
+ {
215
+ "id": "content_pqrstuv",
216
+ "name": "MockDataSet1.1.json",
217
+ "slug": "mockdataset1-1-json",
218
+ "size": "250kb",
219
+ "type": "file",
220
+ "updated_at": "May 07, 2024 14:52",
221
+ "created_at": "May 07, 2024 14:52"
222
+ }
223
+ ]
224
+ },
225
+ {
226
+ "id": "content_nopqrs",
227
+ "name": "ProjectSpecification_V3.pdf",
228
+ "slug": "projectspecification-v3-pdf",
229
+ "size": "990kb",
230
+ "type": "file",
231
+ "updated_at": "May 07, 2024 14:40",
232
+ "created_at": "May 07, 2024 14:40"
233
+ },
234
+ {
235
+ "id": "content_tuvwxyz",
236
+ "name": "DeploymentScript_Linux.bash",
237
+ "slug": "deploymentscript-linux-bash",
238
+ "size": "45kb",
239
+ "type": "file",
240
+ "updated_at": "May 07, 2024 14:42",
241
+ "created_at": "May 07, 2024 14:42"
242
+ },
243
+ {
244
+ "id": "content_abc123",
245
+ "name": "QAReport_EndOfQuarter_Mar2024.pdf",
246
+ "slug": "qareport-endofquarter-mar2024-pdf",
247
+ "size": "1.0mb",
248
+ "type": "file",
249
+ "updated_at": "May 07, 2024 14:44",
250
+ "created_at": "May 07, 2024 14:44"
251
+ },
252
+ {
253
+ "id": "content_456def",
254
+ "name": "ReleaseNotes_Patch1.3.json",
255
+ "slug": "releasenotes-patch1-3-json",
256
+ "size": "150kb",
257
+ "type": "file",
258
+ "updated_at": "May 07, 2024 14:46",
259
+ "created_at": "May 07, 2024 14:46"
260
+ },
261
+ {
262
+ "id": "content_789ghi",
263
+ "name": "SprintRetrospective_May2024.csv",
264
+ "slug": "sprintretrospective-may2024-csv",
265
+ "size": "340kb",
266
+ "type": "file",
267
+ "updated_at": "May 07, 2024 14:48",
268
+ "created_at": "May 07, 2024 14:48"
269
+ },
270
+ {
271
+ "id": "content_jklmno",
272
+ "name": "CodeReview_Analysis.xlsx",
273
+ "slug": "codereview-analysis-xlsx",
274
+ "size": "480kb",
275
+ "type": "file",
276
+ "updated_at": "May 07, 2024 14:50",
277
+ "created_at": "May 07, 2024 14:50"
278
+ }
279
+ ]
280
+ },
281
+ {
282
+ "id": "content_1a2b3c",
283
+ "name": "SalesReport_Q1_2024.xlsx",
284
+ "slug": "salesreport-q1-2024-xlsx",
285
+ "size": "525kb",
286
+ "type": "file",
287
+ "updated_at": "May 07, 2024 14:10",
288
+ "created_at": "May 07, 2024 14:10"
289
+ },
290
+ {
291
+ "id": "content_4d5e6f",
292
+ "name": "CustomerFeedback_May2024.pdf",
293
+ "slug": "customerfeedback-may2024-pdf",
294
+ "size": "275kb",
295
+ "type": "file",
296
+ "updated_at": "May 07, 2024 14:12",
297
+ "created_at": "May 07, 2024 14:12"
298
+ },
299
+ {
300
+ "id": "content_7g8h9i",
301
+ "name": "ProductCatalog_Spring2024.csv",
302
+ "slug": "productcatalog-spring2024-csv",
303
+ "size": "1.2mb",
304
+ "type": "file",
305
+ "updated_at": "May 07, 2024 14:15",
306
+ "created_at": "May 07, 2024 14:15"
307
+ },
308
+ {
309
+ "id": "content_jklmno",
310
+ "name": "ProjectPlan_SummerLaunch.docx",
311
+ "slug": "projectplan-summerlaunch-docx",
312
+ "size": "825kb",
313
+ "type": "file",
314
+ "updated_at": "May 07, 2024 14:18",
315
+ "created_at": "May 07, 2024 14:18"
316
+ },
317
+ {
318
+ "id": "content_pqrsuv",
319
+ "name": "MarketingStrategy_Q3_2024.pptx",
320
+ "slug": "marketingstrategy-q3-2024-pptx",
321
+ "size": "2.3mb",
322
+ "type": "file",
323
+ "updated_at": "May 07, 2024 14:20",
324
+ "created_at": "May 07, 2024 14:20"
325
+ }
326
+ ]
327
+ }
328
+ ]
@@ -86,7 +86,7 @@ final class OpenIDConnectClient extends BaseOpenIDConnectClient
86
86
  return parent::authenticate();
87
87
  }
88
88
 
89
- private function setClientCredentials(string $clientName = CLIENT_NAME, $clientCredentials, bool $save = false, \Closure $callback = null): OpenIDConnectClient
89
+ private function setClientCredentials(string $clientName = CLIENT_NAME, $clientCredentials, bool $save = false, ?\Closure $callback = null): OpenIDConnectClient
90
90
  {
91
91
  $this->setClientID($clientCredentials->client_id);
92
92
  $this->setClientName($clientCredentials->client_name);
@@ -156,7 +156,7 @@ final class OpenIDConnectClient extends BaseOpenIDConnectClient
156
156
  return $value;
157
157
  }
158
158
 
159
- public function getOpenIdConfiguration(string $key = null)
159
+ public function getOpenIdConfiguration(?string $key = null)
160
160
  {
161
161
  $openIdConfigResponse = $this->solid->get('.well-known/openid-configuration');
162
162
  if ($openIdConfigResponse instanceof Response) {
@@ -70,7 +70,7 @@ class SolidClient
70
70
  *
71
71
  * @return string the fully constructed URL
72
72
  */
73
- private function createRequestUrl(string $uri = null): string
73
+ private function createRequestUrl(?string $uri = null): string
74
74
  {
75
75
  if (Str::startsWith($uri, 'http')) {
76
76
  return $uri;
@@ -7,8 +7,9 @@ use Fleetbase\Http\Requests\AdminRequest;
7
7
  use Fleetbase\Models\Setting;
8
8
  use Fleetbase\Solid\Client\SolidClient;
9
9
  use Fleetbase\Solid\Models\SolidIdentity;
10
- use Fleetbase\Support\Utils;
10
+ use Fleetbase\Solid\Support\Utils;
11
11
  use Illuminate\Http\Request;
12
+ use Illuminate\Support\Str;
12
13
 
13
14
  class SolidController extends BaseController
14
15
  {
@@ -90,9 +91,9 @@ class SolidController extends BaseController
90
91
  'remember' => true,
91
92
  ],
92
93
  [
93
- 'withoutAuth' => true,
94
- 'headers' => [
95
- 'Cookie' => '_interaction=TDQMh2DWuC8wZvkEB2n_G; _interaction.sig=3HHA_FUVo7Cw9up2keCJ7IaQJws; _session.legacy=jdxTxnTGmvWx2ECaiwYeP; _session.legacy.sig=EUGYX6DAKtBNQqZN5PGcbIJ-5ac',
94
+ 'withoutAuth' => true,
95
+ 'headers' => [
96
+ 'Cookie' => '_interaction=TDQMh2DWuC8wZvkEB2n_G; _interaction.sig=3HHA_FUVo7Cw9up2keCJ7IaQJws; _session.legacy=jdxTxnTGmvWx2ECaiwYeP; _session.legacy.sig=EUGYX6DAKtBNQqZN5PGcbIJ-5ac',
96
97
  ],
97
98
  ]
98
99
  );
@@ -114,4 +115,56 @@ class SolidController extends BaseController
114
115
  // dump($createFileResponse->json());
115
116
  }
116
117
  }
118
+
119
+ public function getPods(Request $request)
120
+ {
121
+ // Retrieve search and sort parameters from the request
122
+ $query = $request->searchQuery();
123
+ $sort = $request->input('sort', '-created_at');
124
+ $id = $request->input('id');
125
+ $slug = $request->input('slug');
126
+
127
+ // Collection of pods data
128
+ $pods = json_decode(file_get_contents(base_path('vendor/fleetbase/solid-api/server/data/pods.json')));
129
+
130
+ // Get single content from pod via slug
131
+ if ($slug) {
132
+ $result = Utils::searchPods($pods, 'slug', $slug);
133
+
134
+ return response()->json($result);
135
+ }
136
+
137
+ // Get a single item via ID
138
+ if ($id && is_array($pods)) {
139
+ $result = Utils::searchPods($pods, 'id', $id);
140
+ if ($result && $query) {
141
+ $result->contents = array_values(
142
+ array_filter(
143
+ data_get($result, 'contents', []),
144
+ function ($content) use ($query) {
145
+ return Str::contains(strtolower(data_get($content, 'name')), strtolower($query));
146
+ }
147
+ )
148
+ );
149
+ }
150
+
151
+ return response()->json($result);
152
+ }
153
+
154
+ // Filtering by search query
155
+ if ($query) {
156
+ $pods = array_filter($pods, function ($pod) use ($query) {
157
+ return Str::contains(strtolower(data_get($pod, 'name')), strtolower($query));
158
+ });
159
+ }
160
+
161
+ // Determine sorting direction and key
162
+ $sortDesc = substr($sort, 0, 1) === '-';
163
+ $sortKey = ltrim($sort, '-');
164
+
165
+ // Sorting by specified field
166
+ $pods = collect($pods)->sortBy($sortKey, SORT_REGULAR, $sortDesc);
167
+
168
+ return response()->json($pods->values());
169
+ }
117
170
  }
@@ -141,7 +141,7 @@ final class OIDCClient extends OpenIDConnectClient
141
141
  return rtrim($url, '=');
142
142
  }
143
143
 
144
- public function createDPoP(string $method, string $url, bool $includeAth = true, string $accessToken = null): string
144
+ public function createDPoP(string $method, string $url, bool $includeAth = true, ?string $accessToken = null): string
145
145
  {
146
146
  if (null === $this->dpopPrivateKey) {
147
147
  $this->dpopPrivateKey = JWKFactory::createECKey('P-256', ['use' => 'sig', 'kid' => base64_encode(random_bytes(20))]);
@@ -98,7 +98,7 @@ class SolidClient
98
98
  *
99
99
  * @return string the fully constructed URL
100
100
  */
101
- private function createRequestUrl(string $uri = null): string
101
+ private function createRequestUrl(?string $uri = null): string
102
102
  {
103
103
  $url = $this->getServerUrl();
104
104
 
@@ -165,6 +165,7 @@ class SolidClient
165
165
  $url = $this->createRequestUrl($uri);
166
166
  }
167
167
  $this->setAuthenticationHeaders($options, $method, $url);
168
+
168
169
  return Http::withOptions($options)->{$method}($url, $data);
169
170
  }
170
171
 
@@ -3,7 +3,45 @@
3
3
  namespace Fleetbase\Solid\Support;
4
4
 
5
5
  use Fleetbase\Support\Utils as FleetbaseUtils;
6
+ use Illuminate\Support\Str;
6
7
 
7
8
  class Utils extends FleetbaseUtils
8
9
  {
10
+ /**
11
+ * Recursively searches through a nested array of pods and their contents
12
+ * to find an item that matches a given key-value pair.
13
+ *
14
+ * This function handles nested structures where each folder may contain
15
+ * additional folders and files. It returns the first matching item based
16
+ * on the specified key and value.
17
+ *
18
+ * @param array $data the array representing the pods and their nested contents
19
+ * @param string $key The key used to search items (e.g., 'name', 'id').
20
+ * @param string $value the value to match against the specified key
21
+ * @param bool $search whether to perform a search match with string contains
22
+ *
23
+ * @return mixed|null returns the first matching item found in the structure or
24
+ * `null` if no item is found that matches the criteria
25
+ */
26
+ public static function searchPods(array $data = [], string $key, string $value, bool $search = false)
27
+ {
28
+ foreach ($data as $item) {
29
+ if ($search === false && data_get($item, $key) && strcasecmp(data_get($item, $key), $value) === 0) {
30
+ return $item;
31
+ }
32
+
33
+ if ($search === true && data_get($item, $key) && Str::contains(strtolower(data_get($item, $key)), strtolower($value))) {
34
+ return $item;
35
+ }
36
+
37
+ if (is_array(data_get($item, 'contents'))) {
38
+ $contentSearchResult = static::searchPods(data_get($item, 'contents', []), $key, $value);
39
+ if ($contentSearchResult) {
40
+ return $contentSearchResult;
41
+ }
42
+ }
43
+ }
44
+
45
+ return null;
46
+ }
9
47
  }
@@ -28,6 +28,7 @@ Route::prefix(config('solid.api.routing.prefix', 'solid'))->namespace('Fleetbase
28
28
  $router->group(
29
29
  ['prefix' => 'v1'],
30
30
  function ($router) {
31
+ $router->get('pods', 'SolidController@getPods');
31
32
  $router->get('authenticate/{identifier}', 'SolidController@authenticate');
32
33
  $router->group(['middleware' => ['fleetbase.protected']], function ($router) {
33
34
  $router->get('account', 'SolidController@getAccountIndex');