@ossy/platform 3.13.0 → 3.14.0
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 +7 -6
- package/src/runtime.js +15 -3
- package/src/server.js +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/platform",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"description": "Ossy application server runtime",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,14 +48,15 @@
|
|
|
48
48
|
"@ossy/config": "^3.0.9",
|
|
49
49
|
"@ossy/event-store": "^3.12.0",
|
|
50
50
|
"@ossy/locale": "^3.4.0",
|
|
51
|
-
"@ossy/manifest": "^3.
|
|
51
|
+
"@ossy/manifest": "^3.14.0",
|
|
52
52
|
"@ossy/observability": "^3.0.9",
|
|
53
53
|
"@ossy/policies": "^3.0.9",
|
|
54
|
-
"@ossy/
|
|
54
|
+
"@ossy/router": "^3.0.9",
|
|
55
|
+
"@ossy/schema": "^3.14.0",
|
|
55
56
|
"@ossy/sdk": "^3.12.0",
|
|
56
57
|
"@ossy/tokens": "^3.11.1",
|
|
57
|
-
"@ossy/users": "^3.
|
|
58
|
-
"@ossy/workspaces": "^3.
|
|
58
|
+
"@ossy/users": "^3.14.0",
|
|
59
|
+
"@ossy/workspaces": "^3.14.0",
|
|
59
60
|
"cookie-parser": "^1.4.7",
|
|
60
61
|
"dotenv": ">=16.0.0 <18.0.0",
|
|
61
62
|
"express": ">=5.0.0 <6.0.0",
|
|
@@ -76,5 +77,5 @@
|
|
|
76
77
|
"Dockerfile",
|
|
77
78
|
"docker-healthcheck.js"
|
|
78
79
|
],
|
|
79
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "539cc1b14a57e9f6472a89648939e21821dc204d"
|
|
80
81
|
}
|
package/src/runtime.js
CHANGED
|
@@ -180,14 +180,23 @@ export async function startRuntime ({ port } = {}) {
|
|
|
180
180
|
return
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
const config = manifest.config
|
|
184
|
+
const { language, messages, fallbackMessages } = resolveRequestLocale(pageRouter, requestUrl, buildDir, config)
|
|
185
|
+
if (typeof pageEntry.redirect === 'string' && pageEntry.redirect.trim()) {
|
|
186
|
+
const targetId = pageEntry.redirect.trim().replace(/^@/, '')
|
|
187
|
+
const targetPath = pageRouter.getPathname({ id: targetId, language })
|
|
188
|
+
if (targetPath) {
|
|
189
|
+
const search = new URL(requestUrl, 'http://localhost').search || ''
|
|
190
|
+
res.redirect(302, `${targetPath}${search}`)
|
|
191
|
+
return
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
183
195
|
const mod = await loadEntry(pageEntry.entry)
|
|
184
196
|
if (typeof mod.render !== 'function') {
|
|
185
197
|
res.status(503).type('text').send('SSR runtime unavailable')
|
|
186
198
|
return
|
|
187
199
|
}
|
|
188
|
-
|
|
189
|
-
const config = manifest.config
|
|
190
|
-
const { language, messages, fallbackMessages } = resolveRequestLocale(pageRouter, requestUrl, buildDir, config)
|
|
191
200
|
const {
|
|
192
201
|
Layout,
|
|
193
202
|
layoutEntry,
|
|
@@ -212,6 +221,9 @@ export async function startRuntime ({ port } = {}) {
|
|
|
212
221
|
id: page.id,
|
|
213
222
|
path: page.path,
|
|
214
223
|
...(page.package ? { package: page.package } : {}),
|
|
224
|
+
...(typeof page.redirect === 'string' && page.redirect.trim()
|
|
225
|
+
? { redirect: page.redirect.trim() }
|
|
226
|
+
: {}),
|
|
215
227
|
})),
|
|
216
228
|
pageId: pageRoute.id,
|
|
217
229
|
componentEntries: manifest.components,
|
package/src/server.js
CHANGED
|
@@ -505,6 +505,16 @@ export async function startServer (options = {}) {
|
|
|
505
505
|
res.status(404).send('Not found')
|
|
506
506
|
return
|
|
507
507
|
}
|
|
508
|
+
if (typeof pageEntry.redirect === 'string' && pageEntry.redirect.trim()) {
|
|
509
|
+
const { language } = resolveRequestLocale(pageRouter, requestUrl, buildDir, config)
|
|
510
|
+
const targetId = pageEntry.redirect.trim().replace(/^@/, '')
|
|
511
|
+
const targetPath = pageRouter.getPathname({ id: targetId, language })
|
|
512
|
+
if (targetPath) {
|
|
513
|
+
const search = new URL(requestUrl, 'http://localhost').search || ''
|
|
514
|
+
res.redirect(302, `${targetPath}${search}`)
|
|
515
|
+
return
|
|
516
|
+
}
|
|
517
|
+
}
|
|
508
518
|
const loadEntryTimer = createTimedOperation(`SSR loadEntry ${pageRoute.id}`, { log })
|
|
509
519
|
const mod = await loadEntry(pageEntry.entry)
|
|
510
520
|
loadEntryTimer.finish()
|
|
@@ -575,6 +585,9 @@ export async function startServer (options = {}) {
|
|
|
575
585
|
id: page.id,
|
|
576
586
|
path: page.path,
|
|
577
587
|
...(page.package ? { package: page.package } : {}),
|
|
588
|
+
...(typeof page.redirect === 'string' && page.redirect.trim()
|
|
589
|
+
? { redirect: page.redirect.trim() }
|
|
590
|
+
: {}),
|
|
578
591
|
})),
|
|
579
592
|
pageId: pageRoute.id,
|
|
580
593
|
componentEntries: manifest.components,
|