@jaypie/express 1.2.34 → 1.2.35
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/cjs/cors.helper.d.ts +3 -2
- package/dist/cjs/index.cjs +3 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +3 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/esm/cors.helper.d.ts +3 -2
- package/dist/esm/index.d.ts +3 -2
- package/dist/esm/index.js +4 -3
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Request, Response, NextFunction } from "express";
|
|
2
|
+
export type CorsOrigin = string | RegExp | Array<string | RegExp>;
|
|
2
3
|
export interface CorsConfig {
|
|
3
|
-
origin?:
|
|
4
|
+
origin?: CorsOrigin;
|
|
4
5
|
overrides?: Record<string, unknown>;
|
|
5
6
|
}
|
|
6
7
|
type CorsCallback = (err: Error | null, allow?: boolean) => void;
|
|
7
|
-
export declare const dynamicOriginCallbackHandler: (origin?:
|
|
8
|
+
export declare const dynamicOriginCallbackHandler: (origin?: CorsOrigin) => ((requestOrigin: string | undefined, callback: CorsCallback) => void);
|
|
8
9
|
/**
|
|
9
10
|
* CORS middleware with Lambda streaming support.
|
|
10
11
|
*
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1301,8 +1301,9 @@ const dynamicOriginCallbackHandler = (origin) => {
|
|
|
1301
1301
|
const additionalOrigins = kit.force.array(origin);
|
|
1302
1302
|
allowedOrigins.push(...additionalOrigins);
|
|
1303
1303
|
}
|
|
1304
|
-
// Add localhost origins in sandbox
|
|
1305
|
-
if (
|
|
1304
|
+
// Add localhost origins in local and sandbox environments
|
|
1305
|
+
if (kit.isLocalEnv() ||
|
|
1306
|
+
process.env.PROJECT_ENV === SANDBOX_ENV ||
|
|
1306
1307
|
kit.envBoolean("PROJECT_SANDBOX_MODE")) {
|
|
1307
1308
|
allowedOrigins.push("http://localhost");
|
|
1308
1309
|
allowedOrigins.push(/^http:\/\/localhost:\d+$/);
|