@lwrjs/server 0.11.0-alpha.7 → 0.11.0-alpha.9
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/build/cjs/common/abstract-request.cjs +4 -2
- package/build/cjs/express/express-request.cjs +6 -0
- package/build/cjs/koa/koa-request.cjs +6 -0
- package/build/es/common/abstract-request.d.ts +1 -0
- package/build/es/common/abstract-request.js +3 -1
- package/build/es/express/express-request.d.ts +2 -0
- package/build/es/express/express-request.js +6 -0
- package/build/es/koa/koa-request.d.ts +2 -0
- package/build/es/koa/koa-request.js +6 -0
- package/package.json +4 -4
|
@@ -43,7 +43,7 @@ var AbstractMiddlewareRequest = class {
|
|
|
43
43
|
return !targetEnvironment || targetEnvironment === defaultEnvironment || supportedEnvironments?.includes(targetEnvironment);
|
|
44
44
|
}
|
|
45
45
|
getRuntimeContext(defaultRuntimeEnvironment) {
|
|
46
|
-
const {format, apiVersion, compat, locale, environment, bundleSpecifier} = this.params;
|
|
46
|
+
const {format, apiVersion, basePath, compat, locale, environment, bundleSpecifier} = this.params;
|
|
47
47
|
const debug = this.query.debug !== void 0;
|
|
48
48
|
const bundle = !!bundleSpecifier;
|
|
49
49
|
const runtimeEnvironment = {
|
|
@@ -52,9 +52,11 @@ var AbstractMiddlewareRequest = class {
|
|
|
52
52
|
compat: compat || defaultRuntimeEnvironment.compat,
|
|
53
53
|
debug: debug || defaultRuntimeEnvironment.debug,
|
|
54
54
|
apiVersion: apiVersion || defaultRuntimeEnvironment.apiVersion,
|
|
55
|
-
bundle: bundle || defaultRuntimeEnvironment.bundle
|
|
55
|
+
bundle: bundle || defaultRuntimeEnvironment.bundle,
|
|
56
|
+
basePath: this.basePath || basePath || defaultRuntimeEnvironment.basePath
|
|
56
57
|
};
|
|
57
58
|
const runtimeParams = {
|
|
59
|
+
basePath: runtimeEnvironment.basePath,
|
|
58
60
|
locale: locale || this.locale || defaultRuntimeEnvironment.defaultLocale,
|
|
59
61
|
environment
|
|
60
62
|
};
|
|
@@ -56,6 +56,12 @@ var ExpressRequest = class extends import_abstract_request.AbstractMiddlewareReq
|
|
|
56
56
|
get protocol() {
|
|
57
57
|
return this.req.protocol;
|
|
58
58
|
}
|
|
59
|
+
get basePath() {
|
|
60
|
+
return this.req.basePath || "";
|
|
61
|
+
}
|
|
62
|
+
set basePath(bp) {
|
|
63
|
+
this.req.basePath = bp;
|
|
64
|
+
}
|
|
59
65
|
get locale() {
|
|
60
66
|
return this.req.locale;
|
|
61
67
|
}
|
|
@@ -56,6 +56,12 @@ var KoaRequest = class extends import_abstract_request.AbstractMiddlewareRequest
|
|
|
56
56
|
get headers() {
|
|
57
57
|
return this.ctx.headers;
|
|
58
58
|
}
|
|
59
|
+
get basePath() {
|
|
60
|
+
return this.ctx.basePath || "";
|
|
61
|
+
}
|
|
62
|
+
set basePath(bp) {
|
|
63
|
+
this.ctx.basePath = bp;
|
|
64
|
+
}
|
|
59
65
|
get locale() {
|
|
60
66
|
return this.ctx.locale;
|
|
61
67
|
}
|
|
@@ -10,6 +10,7 @@ export declare abstract class AbstractMiddlewareRequest implements MiddlewareReq
|
|
|
10
10
|
abstract params: any;
|
|
11
11
|
abstract query: any;
|
|
12
12
|
abstract locale: string;
|
|
13
|
+
abstract basePath: string;
|
|
13
14
|
abstract headers: Headers;
|
|
14
15
|
abstract acceptsLanguages(): string[];
|
|
15
16
|
abstract get(field: string): string | undefined;
|
|
@@ -36,7 +36,7 @@ export class AbstractMiddlewareRequest {
|
|
|
36
36
|
supportedEnvironments?.includes(targetEnvironment));
|
|
37
37
|
}
|
|
38
38
|
getRuntimeContext(defaultRuntimeEnvironment) {
|
|
39
|
-
const { format, apiVersion, compat, locale, environment, bundleSpecifier } = this.params;
|
|
39
|
+
const { format, apiVersion, basePath, compat, locale, environment, bundleSpecifier } = this.params;
|
|
40
40
|
const debug = this.query.debug !== undefined;
|
|
41
41
|
const bundle = !!bundleSpecifier;
|
|
42
42
|
const runtimeEnvironment = {
|
|
@@ -47,8 +47,10 @@ export class AbstractMiddlewareRequest {
|
|
|
47
47
|
debug: debug || defaultRuntimeEnvironment.debug,
|
|
48
48
|
apiVersion: apiVersion || defaultRuntimeEnvironment.apiVersion,
|
|
49
49
|
bundle: bundle || defaultRuntimeEnvironment.bundle,
|
|
50
|
+
basePath: this.basePath || basePath || defaultRuntimeEnvironment.basePath,
|
|
50
51
|
};
|
|
51
52
|
const runtimeParams = {
|
|
53
|
+
basePath: runtimeEnvironment.basePath,
|
|
52
54
|
locale: locale || this.locale || defaultRuntimeEnvironment.defaultLocale,
|
|
53
55
|
environment,
|
|
54
56
|
};
|
|
@@ -12,6 +12,8 @@ export default class ExpressRequest extends AbstractMiddlewareRequest {
|
|
|
12
12
|
get method(): string;
|
|
13
13
|
get headers(): Headers;
|
|
14
14
|
get protocol(): any;
|
|
15
|
+
get basePath(): string;
|
|
16
|
+
set basePath(bp: string);
|
|
15
17
|
get locale(): string;
|
|
16
18
|
set locale(l: string);
|
|
17
19
|
acceptsLanguages(): string[];
|
|
@@ -29,6 +29,12 @@ export default class ExpressRequest extends AbstractMiddlewareRequest {
|
|
|
29
29
|
get protocol() {
|
|
30
30
|
return this.req.protocol;
|
|
31
31
|
}
|
|
32
|
+
get basePath() {
|
|
33
|
+
return this.req.basePath || '';
|
|
34
|
+
}
|
|
35
|
+
set basePath(bp) {
|
|
36
|
+
this.req.basePath = bp;
|
|
37
|
+
}
|
|
32
38
|
get locale() {
|
|
33
39
|
return this.req.locale;
|
|
34
40
|
}
|
|
@@ -12,6 +12,8 @@ export default class KoaRequest extends AbstractMiddlewareRequest {
|
|
|
12
12
|
get body(): any;
|
|
13
13
|
get method(): string;
|
|
14
14
|
get headers(): Headers;
|
|
15
|
+
get basePath(): string;
|
|
16
|
+
set basePath(bp: string);
|
|
15
17
|
get locale(): string;
|
|
16
18
|
set locale(l: string);
|
|
17
19
|
acceptsLanguages(): string[];
|
|
@@ -28,6 +28,12 @@ export default class KoaRequest extends AbstractMiddlewareRequest {
|
|
|
28
28
|
get headers() {
|
|
29
29
|
return this.ctx.headers;
|
|
30
30
|
}
|
|
31
|
+
get basePath() {
|
|
32
|
+
return this.ctx.basePath || '';
|
|
33
|
+
}
|
|
34
|
+
set basePath(bp) {
|
|
35
|
+
this.ctx.basePath = bp;
|
|
36
|
+
}
|
|
31
37
|
get locale() {
|
|
32
38
|
return this.ctx.locale;
|
|
33
39
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.11.0-alpha.
|
|
7
|
+
"version": "0.11.0-alpha.9",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"build/**/*.d.ts"
|
|
35
35
|
],
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@lwrjs/types": "0.11.0-alpha.
|
|
37
|
+
"@lwrjs/types": "0.11.0-alpha.9",
|
|
38
38
|
"@types/koa-compress": "^4.0.1",
|
|
39
39
|
"@types/koa__router": "^8.0.4",
|
|
40
40
|
"jest-express": "^1.12.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@koa/router": "^10.0.0",
|
|
44
|
-
"@lwrjs/shared-utils": "0.11.0-alpha.
|
|
44
|
+
"@lwrjs/shared-utils": "0.11.0-alpha.9",
|
|
45
45
|
"@types/express": "^4.17.17",
|
|
46
46
|
"@types/koa": "^2.11.7",
|
|
47
47
|
"express": "^4.18.2",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=16.0.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "bc50e3f828be56ebdd2f8206cafe8158ab722470"
|
|
55
55
|
}
|