@lwrjs/core 0.15.0-alpha.45 → 0.15.0-alpha.46
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.
|
@@ -136,17 +136,21 @@ function createViewMiddleware(route, errorRoutes, context, viewHandler) {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
let status = resolvedRoute.status || viewResponse.status || 200;
|
|
139
|
-
const
|
|
139
|
+
const viewDefinitionStatus = viewResponse.metadata?.viewDefinition?.status;
|
|
140
140
|
if (viewResponse.status === 301 || viewResponse.status === 302) {
|
|
141
141
|
status = viewResponse.status;
|
|
142
|
-
} else if (
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
} else if (viewDefinitionStatus && viewDefinitionStatus.code) {
|
|
143
|
+
const origStatus = status;
|
|
144
|
+
const {code, location} = viewDefinitionStatus;
|
|
145
|
+
const isRedirect = code === 301 || code == 302;
|
|
146
|
+
status = code;
|
|
147
|
+
if (isRedirect && location && (0, import_shared_utils.isURL)(location) || location?.startsWith("/")) {
|
|
145
148
|
res.set({
|
|
146
|
-
|
|
149
|
+
location: addRedirectQueryParam(location, (0, import_shared_utils.parseRequestDepth)(req.headers, req.query))
|
|
147
150
|
});
|
|
148
151
|
} else {
|
|
149
|
-
|
|
152
|
+
status = origStatus;
|
|
153
|
+
import_diagnostics.logger.warn(`[view-middleware] Ignoring invalid location header: "${location}"`);
|
|
150
154
|
}
|
|
151
155
|
}
|
|
152
156
|
res.status(status);
|
|
@@ -119,20 +119,25 @@ function createViewMiddleware(route, errorRoutes, context, viewHandler) {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
let status = resolvedRoute.status || viewResponse.status || 200;
|
|
122
|
-
const
|
|
122
|
+
const viewDefinitionStatus = viewResponse.metadata?.viewDefinition?.status;
|
|
123
123
|
if (viewResponse.status === 301 || viewResponse.status === 302) {
|
|
124
124
|
// route handle redirect status takes precedence
|
|
125
125
|
status = viewResponse.status;
|
|
126
126
|
}
|
|
127
|
-
else if (
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
else if (viewDefinitionStatus && viewDefinitionStatus.code) {
|
|
128
|
+
const origStatus = status;
|
|
129
|
+
const { code, location } = viewDefinitionStatus;
|
|
130
|
+
const isRedirect = code === 301 || code == 302;
|
|
131
|
+
status = code;
|
|
132
|
+
if ((isRedirect && location && isURL(location)) || location?.startsWith('/')) {
|
|
130
133
|
res.set({
|
|
131
|
-
|
|
134
|
+
location: addRedirectQueryParam(location, parseRequestDepth(req.headers, req.query)),
|
|
132
135
|
});
|
|
133
136
|
}
|
|
134
137
|
else {
|
|
135
|
-
|
|
138
|
+
// reset the status in the event of an ivalid location when redirecting
|
|
139
|
+
status = origStatus;
|
|
140
|
+
logger.warn(`[view-middleware] Ignoring invalid location header: "${location}"`);
|
|
136
141
|
}
|
|
137
142
|
}
|
|
138
143
|
res.status(status);
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.15.0-alpha.
|
|
7
|
+
"version": "0.15.0-alpha.46",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -43,34 +43,34 @@
|
|
|
43
43
|
"build": "tsc -b"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@lwrjs/app-service": "0.15.0-alpha.
|
|
47
|
-
"@lwrjs/asset-registry": "0.15.0-alpha.
|
|
48
|
-
"@lwrjs/asset-transformer": "0.15.0-alpha.
|
|
49
|
-
"@lwrjs/base-view-provider": "0.15.0-alpha.
|
|
50
|
-
"@lwrjs/base-view-transformer": "0.15.0-alpha.
|
|
51
|
-
"@lwrjs/client-modules": "0.15.0-alpha.
|
|
52
|
-
"@lwrjs/config": "0.15.0-alpha.
|
|
53
|
-
"@lwrjs/diagnostics": "0.15.0-alpha.
|
|
54
|
-
"@lwrjs/esbuild": "0.15.0-alpha.
|
|
55
|
-
"@lwrjs/fs-asset-provider": "0.15.0-alpha.
|
|
56
|
-
"@lwrjs/fs-watch": "0.15.0-alpha.
|
|
57
|
-
"@lwrjs/html-view-provider": "0.15.0-alpha.
|
|
58
|
-
"@lwrjs/instrumentation": "0.15.0-alpha.
|
|
59
|
-
"@lwrjs/loader": "0.15.0-alpha.
|
|
60
|
-
"@lwrjs/lwc-module-provider": "0.15.0-alpha.
|
|
61
|
-
"@lwrjs/lwc-ssr": "0.15.0-alpha.
|
|
62
|
-
"@lwrjs/markdown-view-provider": "0.15.0-alpha.
|
|
63
|
-
"@lwrjs/module-bundler": "0.15.0-alpha.
|
|
64
|
-
"@lwrjs/module-registry": "0.15.0-alpha.
|
|
65
|
-
"@lwrjs/npm-module-provider": "0.15.0-alpha.
|
|
66
|
-
"@lwrjs/nunjucks-view-provider": "0.15.0-alpha.
|
|
67
|
-
"@lwrjs/o11y": "0.15.0-alpha.
|
|
68
|
-
"@lwrjs/resource-registry": "0.15.0-alpha.
|
|
69
|
-
"@lwrjs/router": "0.15.0-alpha.
|
|
70
|
-
"@lwrjs/server": "0.15.0-alpha.
|
|
71
|
-
"@lwrjs/shared-utils": "0.15.0-alpha.
|
|
72
|
-
"@lwrjs/static": "0.15.0-alpha.
|
|
73
|
-
"@lwrjs/view-registry": "0.15.0-alpha.
|
|
46
|
+
"@lwrjs/app-service": "0.15.0-alpha.46",
|
|
47
|
+
"@lwrjs/asset-registry": "0.15.0-alpha.46",
|
|
48
|
+
"@lwrjs/asset-transformer": "0.15.0-alpha.46",
|
|
49
|
+
"@lwrjs/base-view-provider": "0.15.0-alpha.46",
|
|
50
|
+
"@lwrjs/base-view-transformer": "0.15.0-alpha.46",
|
|
51
|
+
"@lwrjs/client-modules": "0.15.0-alpha.46",
|
|
52
|
+
"@lwrjs/config": "0.15.0-alpha.46",
|
|
53
|
+
"@lwrjs/diagnostics": "0.15.0-alpha.46",
|
|
54
|
+
"@lwrjs/esbuild": "0.15.0-alpha.46",
|
|
55
|
+
"@lwrjs/fs-asset-provider": "0.15.0-alpha.46",
|
|
56
|
+
"@lwrjs/fs-watch": "0.15.0-alpha.46",
|
|
57
|
+
"@lwrjs/html-view-provider": "0.15.0-alpha.46",
|
|
58
|
+
"@lwrjs/instrumentation": "0.15.0-alpha.46",
|
|
59
|
+
"@lwrjs/loader": "0.15.0-alpha.46",
|
|
60
|
+
"@lwrjs/lwc-module-provider": "0.15.0-alpha.46",
|
|
61
|
+
"@lwrjs/lwc-ssr": "0.15.0-alpha.46",
|
|
62
|
+
"@lwrjs/markdown-view-provider": "0.15.0-alpha.46",
|
|
63
|
+
"@lwrjs/module-bundler": "0.15.0-alpha.46",
|
|
64
|
+
"@lwrjs/module-registry": "0.15.0-alpha.46",
|
|
65
|
+
"@lwrjs/npm-module-provider": "0.15.0-alpha.46",
|
|
66
|
+
"@lwrjs/nunjucks-view-provider": "0.15.0-alpha.46",
|
|
67
|
+
"@lwrjs/o11y": "0.15.0-alpha.46",
|
|
68
|
+
"@lwrjs/resource-registry": "0.15.0-alpha.46",
|
|
69
|
+
"@lwrjs/router": "0.15.0-alpha.46",
|
|
70
|
+
"@lwrjs/server": "0.15.0-alpha.46",
|
|
71
|
+
"@lwrjs/shared-utils": "0.15.0-alpha.46",
|
|
72
|
+
"@lwrjs/static": "0.15.0-alpha.46",
|
|
73
|
+
"@lwrjs/view-registry": "0.15.0-alpha.46",
|
|
74
74
|
"chokidar": "^3.6.0",
|
|
75
75
|
"esbuild": "^0.9.7",
|
|
76
76
|
"fs-extra": "^11.2.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"ws": "^8.18.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@lwrjs/types": "0.15.0-alpha.
|
|
83
|
+
"@lwrjs/types": "0.15.0-alpha.46",
|
|
84
84
|
"@types/ws": "^8.5.12",
|
|
85
85
|
"memfs": "^4.13.0"
|
|
86
86
|
},
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"volta": {
|
|
94
94
|
"extends": "../../../package.json"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "366b77f76c34626c9449da0042766fc107cc6b8f"
|
|
97
97
|
}
|