Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated class paths (haxe 4) #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/express/Error.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package express;

@:native("Error")
extern class Error extends js.Error {
extern class Error extends #if (haxe_ver>=4.0) js.lib.Error #else js.Error #end {
public var status : Int;
}
2 changes: 1 addition & 1 deletion src/express/Next.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract Next(Dynamic)
public inline function call()
untyped this();

public inline function error(err : js.Error)
public inline function error(err : #if (haxe_ver >= 4.0) js.lib.Error #else js.Error #end)
untyped this(err);

public inline function route()
Expand Down
4 changes: 4 additions & 0 deletions src/mw/BasicAuth.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import haxe.crypto.Base64;
import express.Request;
import express.Response;
import express.Next;
#if (haxe_ver >= 4.0)
import js.lib.Error;
#else
import js.Error;
#end
import js.node.Buffer;
using StringTools;

Expand Down
4 changes: 4 additions & 0 deletions src/mw/BearerTokenAuth.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package mw;
import express.Request;
import express.Response;
import express.Next;
#if (haxe_ver >= 4.0)
import js.lib.Error;
#else
import js.Error;
#end
using StringTools;

class BearerTokenAuth {
Expand Down
5 changes: 5 additions & 0 deletions src/mw/OnFinished.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ package mw;

import express.Request;
import express.Response;

#if (haxe_ver >= 4.0)
import js.lib.Error;
#else
import js.Error;
#end

@:jsRequire("on-finished")
extern class OnFinished {
Expand Down
4 changes: 4 additions & 0 deletions src/mw/Unless.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package mw;
import express.Request;
import express.Middleware;
import haxe.extern.EitherType;
#if (haxe_ver >= 4.0)
import js.lib.RegExp;
#else
import js.RegExp;
#end
import mw.jwt.*;

@:jsRequire("express-unless")
Expand Down
4 changes: 4 additions & 0 deletions src/mw/cors/Options.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ package mw.cors;

import express.Request;
import haxe.extern.EitherType;
#if (haxe_ver >= 4.0)
import js.lib.Error;
#else
import js.Error;
#end

typedef Options = {
?origin : EitherType<Bool, EitherType<String, OriginFunction>>,
Expand Down
7 changes: 7 additions & 0 deletions src/mw/expressbrute/Options.hx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ Defines whether the remaining lifetime of a counter should be based on the time
/*
Gets called whenever an error occurs with the persistent store from which ExpressBrute cannot recover. It is passed an object containing the properties message (a description of the message), parent (the error raised by the session store), and [key, ip] or [req, res, next] depending on whether or the error occurs during reset or in the middleware itself.
*/
#if (haxe_ver >= 4.0)
?handleStoreError : EitherType<
({ message : String, parent : js.lib.Error}, String, String) -> Void,
({ message : String, parent : js.lib.Error}, Request, Response, Next) -> Void
>
#else
?handleStoreError : EitherType<
{ message : String, parent : js.Error} -> String -> String -> Void,
{ message : String, parent : js.Error} -> Request -> Response -> Next -> Void
>
#end
}