@niledatabase/server 5.3.1-alpha.2 → 5.3.1-alpha.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.
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -52,6 +52,10 @@ declare class Config {
|
|
|
52
52
|
* change the starting route
|
|
53
53
|
*/
|
|
54
54
|
routePrefix: string;
|
|
55
|
+
/**
|
|
56
|
+
* Skip setting the host header in the request.
|
|
57
|
+
*/
|
|
58
|
+
skipHostHeader?: boolean;
|
|
55
59
|
db: NilePoolConfig;
|
|
56
60
|
constructor(config?: ConfigConstructor);
|
|
57
61
|
}
|
|
@@ -552,6 +556,7 @@ declare class Server {
|
|
|
552
556
|
get handlers(): NileHandlers;
|
|
553
557
|
get paths(): ConfigurablePaths;
|
|
554
558
|
set paths(paths: ConfigurablePaths);
|
|
559
|
+
set skipHostHeader(value: boolean);
|
|
555
560
|
/**
|
|
556
561
|
* Sets the context for a particular set of requests or db calls to be sure the context is fully managed for the entire lifecycle
|
|
557
562
|
*/
|
|
@@ -719,6 +724,10 @@ type NileConfig = {
|
|
|
719
724
|
* Re-use the last set context
|
|
720
725
|
*/
|
|
721
726
|
useLastContext?: boolean;
|
|
727
|
+
/**
|
|
728
|
+
* Skip setting the host header in the request.
|
|
729
|
+
*/
|
|
730
|
+
skipHostHeader?: boolean;
|
|
722
731
|
};
|
|
723
732
|
type NileDb = NilePoolConfig & {
|
|
724
733
|
tenantId?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,10 @@ declare class Config {
|
|
|
52
52
|
* change the starting route
|
|
53
53
|
*/
|
|
54
54
|
routePrefix: string;
|
|
55
|
+
/**
|
|
56
|
+
* Skip setting the host header in the request.
|
|
57
|
+
*/
|
|
58
|
+
skipHostHeader?: boolean;
|
|
55
59
|
db: NilePoolConfig;
|
|
56
60
|
constructor(config?: ConfigConstructor);
|
|
57
61
|
}
|
|
@@ -552,6 +556,7 @@ declare class Server {
|
|
|
552
556
|
get handlers(): NileHandlers;
|
|
553
557
|
get paths(): ConfigurablePaths;
|
|
554
558
|
set paths(paths: ConfigurablePaths);
|
|
559
|
+
set skipHostHeader(value: boolean);
|
|
555
560
|
/**
|
|
556
561
|
* Sets the context for a particular set of requests or db calls to be sure the context is fully managed for the entire lifecycle
|
|
557
562
|
*/
|
|
@@ -719,6 +724,10 @@ type NileConfig = {
|
|
|
719
724
|
* Re-use the last set context
|
|
720
725
|
*/
|
|
721
726
|
useLastContext?: boolean;
|
|
727
|
+
/**
|
|
728
|
+
* Skip setting the host header in the request.
|
|
729
|
+
*/
|
|
730
|
+
skipHostHeader?: boolean;
|
|
722
731
|
};
|
|
723
732
|
type NileDb = NilePoolConfig & {
|
|
724
733
|
tenantId?: string;
|
package/dist/index.js
CHANGED
|
@@ -554,7 +554,9 @@ async function request(url, _init, config) {
|
|
|
554
554
|
process.env.NODE_ENV === "production" ? "true" : "false"
|
|
555
555
|
);
|
|
556
556
|
}
|
|
557
|
-
|
|
557
|
+
if (config.skipHostHeader !== true) {
|
|
558
|
+
updatedHeaders.set("host", requestUrl.host);
|
|
559
|
+
}
|
|
558
560
|
if (config.callbackUrl) {
|
|
559
561
|
const cbUrl = new URL(config.callbackUrl);
|
|
560
562
|
debug(`Obtained origin from config.callbackUrl ${config.callbackUrl}`);
|
|
@@ -2128,12 +2130,17 @@ var Config = class {
|
|
|
2128
2130
|
* change the starting route
|
|
2129
2131
|
*/
|
|
2130
2132
|
routePrefix;
|
|
2133
|
+
/**
|
|
2134
|
+
* Skip setting the host header in the request.
|
|
2135
|
+
*/
|
|
2136
|
+
skipHostHeader;
|
|
2131
2137
|
db;
|
|
2132
2138
|
constructor(config) {
|
|
2133
2139
|
this.routePrefix = config?.routePrefix ?? "/api";
|
|
2134
2140
|
this.debug = config?.debug;
|
|
2135
2141
|
this.origin = config?.origin;
|
|
2136
2142
|
this.extensions = config?.extensions;
|
|
2143
|
+
this.skipHostHeader = config?.skipHostHeader;
|
|
2137
2144
|
this.extensionCtx = config?.extensionCtx;
|
|
2138
2145
|
this.serverOrigin = config?.origin ?? "http://localhost:3000";
|
|
2139
2146
|
this.logger = Logger(config);
|
|
@@ -3734,6 +3741,9 @@ var Server = class {
|
|
|
3734
3741
|
set paths(paths) {
|
|
3735
3742
|
this.#config.paths = paths;
|
|
3736
3743
|
}
|
|
3744
|
+
set skipHostHeader(value) {
|
|
3745
|
+
this.#config.skipHostHeader = value;
|
|
3746
|
+
}
|
|
3737
3747
|
async withContext(contextOrFn, maybeFn) {
|
|
3738
3748
|
const isFn = typeof contextOrFn === "function";
|
|
3739
3749
|
const context = isFn ? {} : contextOrFn ?? {};
|