@shellui/core 0.5.0-alpha.3 → 0.5.0-alpha.5
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/package.json +2 -2
- package/schemas/shellui.config.schema.json +33 -0
- package/src/features/config/types.ts +31 -0
- package/src/features/settings/utils/buildSettingsForPropagation.spec.ts +26 -0
- package/src/features/settings/utils/buildSettingsForPropagation.ts +15 -0
- package/src/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shellui/core",
|
|
3
|
-
"version": "0.5.0-alpha.
|
|
3
|
+
"version": "0.5.0-alpha.5",
|
|
4
4
|
"description": "Shellui Core - Core React application runtime",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"workbox-routing": "^7.4.0",
|
|
72
72
|
"workbox-strategies": "^7.4.0",
|
|
73
73
|
"workbox-window": "^7.4.0",
|
|
74
|
-
"@shellui/sdk": "0.5.0-alpha.
|
|
74
|
+
"@shellui/sdk": "0.5.0-alpha.5"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -69,6 +69,10 @@
|
|
|
69
69
|
"$ref": "#/definitions/StorageConfig",
|
|
70
70
|
"description": "Storage-service connection. Propagated to iframes via SDK settings. Enables Admin → Storage when `url` is set. Settings → Storage (quota) is shown when `url` is set unless `storage.showInSettings` is false."
|
|
71
71
|
},
|
|
72
|
+
"hosting": {
|
|
73
|
+
"$ref": "#/definitions/HostingConfig",
|
|
74
|
+
"description": "Hosting-service connection for `shellui deploy`. Propagated to iframes via SDK settings when `url` is set. Admin → Hosting appears when `url` is set unless `showInAdmin` is false."
|
|
75
|
+
},
|
|
72
76
|
"theme": {
|
|
73
77
|
"$ref": "#/definitions/ThemeRef",
|
|
74
78
|
"description": "Single theme: built-in name, path to a theme JSON/folder, or inline theme object. When set without `themes`, only this theme is available in the selector."
|
|
@@ -352,6 +356,35 @@
|
|
|
352
356
|
"additionalProperties": false,
|
|
353
357
|
"description": "Optional storage-service wiring for the shell and admin panel. When set, admin shows the Storage sidebar (files explorer, statistics, Django admin). Settings → Storage (quota) appears when `url` is set, unless `showInSettings` is false. Shellui will also use this for the SDK file API (`shellui.storage`)."
|
|
354
358
|
},
|
|
359
|
+
"HostingConfig": {
|
|
360
|
+
"type": "object",
|
|
361
|
+
"properties": {
|
|
362
|
+
"url": {
|
|
363
|
+
"type": "string",
|
|
364
|
+
"description": "Base URL of hosting-service (e.g. `http://localhost:8002`)."
|
|
365
|
+
},
|
|
366
|
+
"publicUrl": {
|
|
367
|
+
"type": "string",
|
|
368
|
+
"description": "Optional public base for browsable hosted app URLs when it differs from `url` (e.g. CDN or reverse proxy)."
|
|
369
|
+
},
|
|
370
|
+
"app": {
|
|
371
|
+
"type": "string",
|
|
372
|
+
"deprecated": true,
|
|
373
|
+
"description": "Deprecated. Use `slug` to redeploy to an existing preview site."
|
|
374
|
+
},
|
|
375
|
+
"slug": {
|
|
376
|
+
"type": "string",
|
|
377
|
+
"description": "Optional preview site slug. When set, redeploys to that slug (must belong to your company and user). When omitted, a new slug is created for each deploy."
|
|
378
|
+
},
|
|
379
|
+
"showInAdmin": {
|
|
380
|
+
"type": "boolean",
|
|
381
|
+
"description": "When false, hide Admin → Hosting even if `url` is set. Default: true when `url` is set. Does not affect `shellui deploy`."
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
"required": ["url"],
|
|
385
|
+
"additionalProperties": false,
|
|
386
|
+
"description": "Optional hosting-service wiring for `shellui deploy` preview uploads. Preview sites expire after 7 days unless redeployed. Admin shows Hosting when `url` is set, unless `showInAdmin` is false."
|
|
387
|
+
},
|
|
355
388
|
"ThemeRef": {
|
|
356
389
|
"anyOf": [
|
|
357
390
|
{
|
|
@@ -187,6 +187,32 @@ export interface StorageConfig {
|
|
|
187
187
|
showInSettings?: boolean;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Optional hosting-service wiring for `shellui deploy` preview uploads.
|
|
192
|
+
* Preview sites expire after 7 days unless redeployed to the same slug.
|
|
193
|
+
*/
|
|
194
|
+
export interface HostingConfig {
|
|
195
|
+
/** Base URL of hosting-service (e.g. `http://localhost:8002`). */
|
|
196
|
+
url: string;
|
|
197
|
+
/**
|
|
198
|
+
* Optional public base for browsable app URLs when different from `url`
|
|
199
|
+
* (e.g. CDN or path-style gateway). The deploy API returns `urls` when possible.
|
|
200
|
+
*/
|
|
201
|
+
publicUrl?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Optional preview site slug. When set, `shellui deploy` redeploys to this slug
|
|
204
|
+
* (must belong to your company and user). When omitted, each deploy gets a new slug.
|
|
205
|
+
*/
|
|
206
|
+
slug?: string;
|
|
207
|
+
/** @deprecated Use `slug` instead. */
|
|
208
|
+
app?: string;
|
|
209
|
+
/**
|
|
210
|
+
* When false, hide Admin → Hosting even if `url` is set.
|
|
211
|
+
* Default: true when `url` is set. Does not affect `shellui deploy`.
|
|
212
|
+
*/
|
|
213
|
+
showInAdmin?: boolean;
|
|
214
|
+
}
|
|
215
|
+
|
|
190
216
|
/**
|
|
191
217
|
* Custom navigation section for the staff administration panel.
|
|
192
218
|
* Admin app URL remains `backend.adminUrl` / `backend.adminPathname`.
|
|
@@ -248,6 +274,11 @@ export interface ShellUIConfig {
|
|
|
248
274
|
* when `url` is set unless `storage.showInSettings` is false.
|
|
249
275
|
*/
|
|
250
276
|
storage?: StorageConfig;
|
|
277
|
+
/**
|
|
278
|
+
* Hosting-service connection. Propagated to iframes via SDK settings.
|
|
279
|
+
* Enables `shellui deploy` when `url` is set.
|
|
280
|
+
*/
|
|
281
|
+
hosting?: HostingConfig;
|
|
251
282
|
/**
|
|
252
283
|
* Single theme: built-in name, path to a theme JSON/folder, or inline theme object.
|
|
253
284
|
* When set without `themes`, only this theme is available in the selector.
|
|
@@ -218,4 +218,30 @@ describe('buildSettingsForPropagation', () => {
|
|
|
218
218
|
expect(result.administration).toBeNull();
|
|
219
219
|
expect(result.storage).toBeNull();
|
|
220
220
|
});
|
|
221
|
+
|
|
222
|
+
it('propagates showInAdmin false when hosting admin is disabled', () => {
|
|
223
|
+
const config = {
|
|
224
|
+
hosting: {
|
|
225
|
+
url: 'http://localhost:8002/',
|
|
226
|
+
showInAdmin: false,
|
|
227
|
+
},
|
|
228
|
+
} as ShellUIConfig;
|
|
229
|
+
|
|
230
|
+
const result = buildSettingsForPropagation(baseSettings, config, 'en');
|
|
231
|
+
expect(result.hosting).toEqual({
|
|
232
|
+
url: 'http://localhost:8002',
|
|
233
|
+
showInAdmin: false,
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('omits showInAdmin from propagated hosting by default', () => {
|
|
238
|
+
const config = {
|
|
239
|
+
hosting: {
|
|
240
|
+
url: 'http://localhost:8002',
|
|
241
|
+
},
|
|
242
|
+
} as ShellUIConfig;
|
|
243
|
+
|
|
244
|
+
const result = buildSettingsForPropagation(baseSettings, config, 'en');
|
|
245
|
+
expect(result.hosting).toEqual({ url: 'http://localhost:8002' });
|
|
246
|
+
});
|
|
221
247
|
});
|
|
@@ -80,6 +80,21 @@ export const buildSettingsForPropagation = (
|
|
|
80
80
|
result = { ...result, storage: null };
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
const hostingUrl = config?.hosting?.url?.trim().replace(/\/+$/, '') || null;
|
|
84
|
+
if (hostingUrl) {
|
|
85
|
+
const app = config.hosting?.app?.trim() || null;
|
|
86
|
+
result = {
|
|
87
|
+
...result,
|
|
88
|
+
hosting: {
|
|
89
|
+
url: hostingUrl,
|
|
90
|
+
...(app ? { app } : {}),
|
|
91
|
+
...(config.hosting?.showInAdmin === false ? { showInAdmin: false } : {}),
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
} else {
|
|
95
|
+
result = { ...result, hosting: null };
|
|
96
|
+
}
|
|
97
|
+
|
|
83
98
|
const authBackendBaseUrl =
|
|
84
99
|
config?.backend?.type === 'shellui' && config.backend.url?.trim()
|
|
85
100
|
? config.backend.url.trim().replace(/\/+$/, '')
|