├── .gitignore ├── .travis.yml ├── BuildExamples.hx ├── HOWTO.md ├── ImportAll.hx ├── LICENSE ├── README.md ├── build.hxml ├── doc.hxml ├── examples └── Empty.hx ├── haxelib.json └── js └── npm ├── Callback.hx ├── authom └── Authom.hx ├── base64stream └── Base64Stream.hx ├── bluebird └── Bluebird.hx ├── bodyparser └── BodyParser.hx ├── bull └── Bull.hx ├── bullarena └── BullArena.hx ├── bunyan └── Bunyan.hx ├── busboy └── Busboy.hx ├── canvas └── NodeCanvas.hx ├── cassandra └── Cassandra.hx ├── clicolor └── CliColor.hx ├── colour └── Colour.hx ├── commander └── Commander.hx ├── cookies └── Cookies.hx ├── d3 └── D3.hx ├── deepequal └── DeepEqual.hx ├── digraph ├── DiGraph.hx ├── GraphView.hx ├── GraphViewExample.hx └── GraphViewImplementation.hx ├── docker └── Docker.hx ├── express ├── Application.hx ├── Express.hx ├── ExpressRequest.hx ├── ExpressResponse.hx ├── Path.hx ├── Request.hx ├── Response.hx └── Router.hx ├── fetch └── Fetch.hx ├── filenamify └── Filenamify.hx ├── fluentlogger └── FluentLogger.hx ├── formidable └── Formidable.hx ├── fsextended └── FsExtended.hx ├── gm └── GM.hx ├── history └── History.hx ├── httpproxy └── HttpProxy.hx ├── jwtdecode └── JWTDecode.hx ├── long └── Long.hx ├── materialui ├── MaterialUI.hx └── MaterialUINext.hx ├── md5file ├── Md5File.hx └── Md5FilePromise.hx ├── moment └── MomentTimezone.hx ├── mongodb ├── Admin.hx ├── BSON.hx ├── BatchWriteResult.hx ├── Binary.hx ├── Code.hx ├── CursorStream.hx ├── Double.hx ├── Long.hx ├── MaxKey.hx ├── MinKey.hx ├── MongoAdmin.hx ├── MongoClient.hx ├── MongoCollection.hx ├── MongoCursor.hx ├── MongoDatabase.hx ├── MongoDatabaseRef.hx ├── MongoGrid.hx ├── MongoGridStore.hx ├── MongoOption.hx ├── MongoServer.hx ├── Mongos.hx ├── ObjectID.hx ├── OrderedBulkOperation.hx ├── ReadPreference.hx ├── ReadStream.hx ├── ReplSetServers.hx ├── Symbol.hx ├── Timestamp.hx └── UnorderedBulkOperation.hx ├── msgpack └── MsgPackLite.hx ├── node_static └── Server.hx ├── nodegraph └── ReactNodeGraph.hx ├── pageres └── Pageres.hx ├── parseduration └── ParseDuration.hx ├── pem └── Pem.hx ├── pkgcloud └── PkgCloud.hx ├── prettyms └── PrettyMs.hx ├── prometheus └── Prometheus.hx ├── radium └── Radium.hx ├── randomsentence └── RandomSentence.hx ├── reactdnd └── ReactDnD.hx ├── reactgridlayout └── ReactGridLayout.hx ├── reactinfinite └── Infinite.hx ├── reactjsonviewer └── ReactJsonViewer.hx ├── reactlineto └── LineTo.hx ├── reactlist └── ReactList.hx ├── reactsvg └── ReactSvg.hx ├── reacttable └── ReactTable.hx ├── reacttapeventplugin └── ReactTapEventPlugin.hx ├── reactvirtualized ├── AutoSizer.hx ├── InfiniteLoader.hx └── List.hx ├── redis └── RedisClient.hx ├── redisdump └── RedisDump.hx ├── redismock └── RedisClientMock.hx ├── reduxlogger └── ReduxLogger.hx ├── reduxpersist └── ReduxPersist.hx ├── request └── Request.hx ├── rsmq └── Rsmq.hx ├── send └── Send.hx ├── shortid └── ShortId.hx ├── simulateevent └── SimulateEvent.hx ├── sourcemapsupport └── SourceMapSupport.hx ├── ssh2 └── Ssh.hx ├── streamifier └── Streamifier.hx ├── tarfs └── TarFs.hx ├── targz └── TarGz.hx ├── tarstream └── TarStream.hx ├── uuid └── NodeUuid.hx ├── vagrant └── Vagrant.hx ├── watchr └── Watchr.hx └── ws ├── WebSocket.hx └── WebSocketServer.hx /.gitignore: -------------------------------------------------------------------------------- 1 | *.hxproj 2 | Main.hx 3 | bin/ 4 | /examples/*.js 5 | .haxelib 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: haxe 2 | haxe: 3 | - development 4 | - 4.0.5 5 | - 3.4.7 6 | 7 | install: 8 | - haxelib install all --always 9 | 10 | script: 11 | - haxe build.hxml 12 | -------------------------------------------------------------------------------- /BuildExamples.hx: -------------------------------------------------------------------------------- 1 | import haxe.io.Path; 2 | import sys.FileSystem; 3 | 4 | class BuildExamples { 5 | static function run() { 6 | Sys.setCwd("examples"); 7 | for (file in FileSystem.readDirectory(".")) { 8 | if (Path.extension(file) == "hx") { 9 | var main = Path.withoutExtension(file); 10 | Sys.command("haxe", [ 11 | "-main", main, 12 | "-cp", "..", 13 | "-js", '$main.js', 14 | "-D", "js-es5", 15 | "-D", "analyzer", 16 | "-dce", "full", 17 | ]); 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /HOWTO.md: -------------------------------------------------------------------------------- 1 | # Extern guidelines 2 | 3 | This document describes the principles used in `hxnodejs` regarding package structure, naming, typing and useful tricks. 4 | It is advised to follow these guidelines when creating externs for third-party node modules. 5 | 6 | ## Package structure 7 | 8 | If a node module contains functions and/or variables, an extern class with static functions is created with capitalized name of that module. For that class, a `@:jsRequire("modulename")` metadata is added, so it's automatically `require`d on use. 9 | 10 | For example: 11 | 12 | ```haxe 13 | @:jsRequire("fs") 14 | extern class Fs { 15 | static function writeFileSync(filename:String, data:String):Void; 16 | } 17 | ``` 18 | 19 | If a module contains classes, a package is also created for that module and the classes are placed inside that package. For example: 20 | 21 | ```haxe 22 | package fs; 23 | 24 | extern class Stats { 25 | // ... 26 | } 27 | ``` 28 | 29 | If that class is supposed to be available to user for creating with `new`, the `@:jsRequire("modulename", "ClassName")` metadata is added. For example: 30 | 31 | ```haxe 32 | package events; 33 | 34 | @:jsRequire("events", "EventEmitter") 35 | extern class EventEmitter implements IEventEmitter { 36 | function new(); 37 | // ... 38 | } 39 | ``` 40 | 41 | Example module layout: 42 | * root 43 | * events 44 | * EventEmitter.hx 45 | * fs 46 | * Stats.hx 47 | * FSWatcher.hx 48 | * Fs.hx 49 | 50 | ### Imports 51 | 52 | It makes sense to use e.g. `import fs.*` in the `Fs.hx` so that all relevant classes are brought into context of the module static class. Other than that, usual import recommendations apply: import only what's necessary and remove unused imports. 53 | 54 | ## Naming 55 | 56 | All modules, classes, fields and functions arguments should be named after the official API documentation of the native module. Static classes representing node modules are capitalized as they are Haxe types and must follow haxe type naming requirements. Acronyms are NOT uppercased (i.e. `Json`, not `JSON`). 57 | 58 | In case Haxe name for a node.js module matches the name of its inner class, that class is imported into module using `import as`, adding `Object` as a postfix. For example: 59 | 60 | ```haxe 61 | import js.node.child_process.ChildProcess as ChildProcessObject; // class representing node.js inner class 62 | 63 | @:jsRequire("child_process") // class representing node.js module 64 | extern class ChildProcess { 65 | static function spawn(/*...*/):ChildProcessObject; 66 | } 67 | ``` 68 | 69 | ## Events 70 | 71 | Node.js event emitters take strings as event names and don't check listener signatures in any way. The hxnodejs extern for `EventEmitter` supports that behaviour for convenience of copy-pasting JavaScript code. However it also provides a way to type-check event listeners. 72 | 73 | If you provide an instance of `Event` abstract string type where an event name is expected in any `EventEmitter` method, then the listener type will be unified with `T` and thus provide type checking and inference for the listener function. 74 | 75 | We provide [@:enum abstract types](http://haxe.org/manual/types-abstract-enum.html) that enumerate possible event names for a given event emitter. They are implicitly castable to `Event` and can be used for type-checking listener functions as described above. For each `EventEmitter` subclass, an `@:enum abstract` type must be created with a `Event` postfix in its name. For example, if we have a `Process` class which is an `EventEmitter`, it should have a pairing `ProcessEvent` type in its module, i.e.: 76 | 77 | ```haxe 78 | extern class Process extends EventEmitter { 79 | // ... 80 | } 81 | 82 | @:enum abstract ProcessEvent(Event) to Event { 83 | var Exit : ProcessEventVoid> = "exit"; 84 | } 85 | ``` 86 | 87 | In the example above, the listener type for the 'exit' event is `Int->Void` which means it takes `Int` as its first argument and returns nothing. 88 | 89 | Event constant names are `UpperCamelCase` and their values are actual event names. 90 | 91 | ## Method overloading and optional arguments 92 | 93 | TODO (describe the difference of overloading/optional argument concepts and advise where to use which and that, describe `haxe.Rest`) 94 | 95 | ## Typing 96 | 97 | The whole idea of haxe externs is provide a fully type-checked access to external API. Considering that, we must avoid the need for use `Dynamic` type or `cast` and think of a way to properly express type restrictions. 98 | 99 | On the other hand, we want developers to be able to copy-paste node.js code into haxe with minimal modification and have it compiling. For that reason we have to weaken some typing restrictions, for example adding implicit cast `from String` for our `@:enum abstract` types. 100 | 101 | ### Multiple inheritance 102 | 103 | TODO (describe how to deal with multiple inheritance using interfaces, as we do with IReadable/IWritable streams, mention `@:remove` metadata for interfaces). 104 | 105 | ### Chaining methods 106 | 107 | TODO (describe how to use type parameters + interface to properly type chaining methods) 108 | 109 | ### Object structures 110 | 111 | When a function takes/returns an object with predefined fields (e.g. options argument in many node.js methods), [anonymous structures](http://haxe.org/manual/types-anonymous-structure.html) are used along with `typedef`s. 112 | 113 | Example: 114 | ```haxe 115 | typedef FileOptions = { 116 | var path:String; 117 | @:optional var encoding:String; 118 | @:optional var mode:Int; 119 | } 120 | 121 | function readFile(options:FileOptions):Void; 122 | ``` 123 | 124 | **TODO describe typedef naming** 125 | 126 | ### Dynamic objects 127 | 128 | If a JavaScript object is intended to be used as a *keyed collection* of values and thus doesn't have a predefined structure (e.g. `process.env`), use `haxe.DynamicAccess`. It's a special abstract type designed just for that. It provides `Map`-like API for iterating over its keys and working with values. 129 | 130 | Note that in some cases, an object doesn't have a predefined structure, but neither is a *collection*. In those cases, use simple `Dynamic`. 131 | 132 | ### Either types 133 | 134 | If a function accepts different types for a single argument, at the most times it is better to use `@:overload` do describe that. However there are cases where it is not sufficient, for example: a collection can contain elements of different (but limited) types or an options object field can be of either type. 135 | 136 | To deal with that Haxe provides the `haxe.EitherType` type that is an abstract over `Dynamic` that can be implicitly casted from and to both `T1` and `T2`. 137 | 138 | Example: 139 | ```haxe 140 | typedef SomeOptions = { 141 | var field:haxe.EitherType>; 142 | } 143 | ``` 144 | Here, the `SomeOptions.field` can be assigned to/from either a string or array of strings. 145 | 146 | If a type can be of 3 and more types, nested `EitherType` can be used. 147 | 148 | ### Constant enumeration 149 | 150 | If there's a finite set of posible values for a function argument or object field, [@:enum abstract types](http://haxe.org/manual/types-abstract-enum.html) are used to enumerate those values. 151 | 152 | Example: 153 | 154 | ```haxe 155 | @:enum abstract SymlinkType(String) from String to String { 156 | var File = "file"; 157 | var Dir = "dir"; 158 | var Junction = "junction"; 159 | } 160 | ``` 161 | 162 | The `to` and `from` implicit cast must be added so user can use both enumeration constants and original values as documented in API documentation of native library, however `from` cast may be omitted if the type is used only for return values and is not supposed to be created by user. 163 | 164 | Constant names are `UpperCamelCase` and their values are actual values expected by native API. 165 | 166 | 167 | Note that combined with `haxe.EitherType` (described above), `@:enum abstract`s can handle even complicated cases where a value can be of different types, e.g. 168 | 169 | ```haxe 170 | @:enum abstract ListeningEventAddressType(haxe.EitherType) to haxe.EitherType { 171 | var TCPv4 = 4; 172 | var TCPv6 = 6; 173 | var Unix = -1; 174 | var UDPv4 = "udp4"; 175 | var UDPv6 = "udp6"; 176 | } 177 | ``` 178 | 179 | ## API Documenting 180 | 181 | We use API documentation style found in Haxe standard library and copy upstream API documentation text to externs (applying some minor editing/reformatting to it). 182 | 183 | Example of Haxe standard library style: 184 | 185 | ```haxe 186 | /** 187 | Does that and returns this. 188 | 189 | Some more info about using argument `a` and `b`. 190 | **/ 191 | static function doStuff(a:Int, b:String):Void; 192 | ``` 193 | 194 | Note that node.js API documentation often describes types of variables which is mostly redundant in Haxe, so these parts can be removed. 195 | 196 | ## Deprecated API 197 | 198 | Use `@:deprecated` metadata for upstream API that is deprecated. That way compiler will emit a warning when using deprecated API. 199 | 200 | Example: 201 | ```haxe 202 | @:deprecated // default warning message 203 | extern class DeprecatedClass { 204 | } 205 | 206 | extern class NotSoDeprecated { 207 | @:deprecated("use otherMethod instead") // custom warning message 208 | function deprecatedMethod():Void; 209 | 210 | function otherMethod():Void; 211 | } 212 | ``` 213 | 214 | ## Tricks and hints 215 | 216 | TODO (dealing with keywords, `untyped __js__`, inline methods and properties on extern classes) 217 | -------------------------------------------------------------------------------- /ImportAll.hx: -------------------------------------------------------------------------------- 1 | import haxe.io.Path; 2 | import haxe.macro.Context; 3 | import sys.FileSystem; 4 | 5 | class ImportAll { 6 | static function run(root:String):Void { 7 | function loop(acc:Array):Void { 8 | var path = Path.join(acc); 9 | if (FileSystem.isDirectory(path)) { 10 | for (file in FileSystem.readDirectory(path)) 11 | loop(acc.concat([file])); 12 | } else if (Path.extension(path) == "hx") { 13 | var moduleName = Path.withoutExtension(acc[acc.length - 1]); 14 | var modulePath = acc.slice(0, acc.length - 1); 15 | Context.getModule(modulePath.join(".") + "." + moduleName); 16 | } 17 | } 18 | loop([root]); 19 | } 20 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Haxe Foundation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![hxnodelibs](https://raw.githubusercontent.com/HaxeFoundation/hxnodejs/master/hxnodejs.png) 2 | 3 | # Haxe NodeLibs 4 | 5 | ## Overview 6 | 7 | Extern type definitions for the most common Node.JS Libraries like: 8 | 9 | - `mongodb` 10 | - `express` 11 | - `multiparty` 12 | - `nodewebkit` 13 | 14 | Haxe-generated API documentation is available at [] 15 | 16 | Original node.js documentation can be found at http://nodejs.org/api/index.html. 17 | 18 | ## Features 19 | 20 | - TBD 21 | 22 | ## Example 23 | 24 | - TBD 25 | 26 | ## Status 27 | 28 | This library is currently WIP. 29 | 30 | Requires Haxe 3.2RC1 or later (builds available at http://builds.haxe.org/) 31 | -------------------------------------------------------------------------------- /build.hxml: -------------------------------------------------------------------------------- 1 | -js no-output 2 | -lib hxnodejs 3 | -lib react 4 | --no-output 5 | --each 6 | --next 7 | --macro ImportAll.run("js") 8 | --next 9 | --macro BuildExamples.run() 10 | -------------------------------------------------------------------------------- /doc.hxml: -------------------------------------------------------------------------------- 1 | --macro ImportAll.run("js") 2 | --no-output 3 | -D doc-gen 4 | -js all.js 5 | -xml bin/js.xml 6 | 7 | --next 8 | 9 | -cmd haxelib run dox -o bin/api -i bin -D source-path https://github.com/HaxeFoundation/hxnodelibs/blob/master/ 10 | -------------------------------------------------------------------------------- /examples/Empty.hx: -------------------------------------------------------------------------------- 1 | import js.Error; 2 | 3 | class Empty 4 | { 5 | static function main() 6 | { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /haxelib.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hxnodelibs", 3 | "url": "https://github.com/HaxeFoundation/hxnodelibs", 4 | "description": "Extern definitions for common node.js npm libraries.", 5 | "license": "MIT", 6 | "version": "0.1.0", 7 | "releasenote": "Initial Release for node.js 0.12", 8 | "contributors": ["nadako","eduardo-costa"], 9 | "tags": ["js", "nodejs", "mongodb", "express", "extern"], 10 | "dependencies": 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /js/npm/Callback.hx: -------------------------------------------------------------------------------- 1 | package js.npm; 2 | 3 | import js.Error; 4 | 5 | typedef Callback0 = Null -> Void; 6 | 7 | typedef Callback1 = Null -> Null -> Void; 8 | 9 | typedef Callback2 = Null -> Null -> Null -> Void; 10 | 11 | typedef Callback = Callback1; 12 | -------------------------------------------------------------------------------- /js/npm/authom/Authom.hx: -------------------------------------------------------------------------------- 1 | package js.npm.authom; 2 | 3 | import js.node.events.EventEmitter; 4 | import js.node.http.Server; 5 | import js.node.https.Server; 6 | import js.node.http.IncomingMessage; 7 | import js.node.http.ServerResponse; 8 | 9 | /** 10 | * Enumeration for the possible events of the Authom class. 11 | */ 12 | class AuthomEventType 13 | { 14 | /** 15 | * Listens for successful authentications across all services. The listener is called with the original request/response objects as well as a service-specific user object [AuthomData] 16 | * authom.on("auth", function(req, res, data){}) 17 | */ 18 | static public var Auth : String = "auth"; 19 | 20 | /** 21 | * Listens for failed authentications across all services. Like the auth event, the listener is called with the original request/response objects as well as an error object, allowing you to provide your own session scheme. 22 | * authom.on("error", function(req, res, data){}) 23 | */ 24 | static public var Error : String = "error"; 25 | } 26 | 27 | /** 28 | * 29 | */ 30 | extern class AuthomServerOption 31 | { 32 | /** 33 | * 34 | */ 35 | var service : String; 36 | 37 | /** 38 | * 39 | */ 40 | var id : String; 41 | 42 | /** 43 | * 44 | */ 45 | var name : String; 46 | 47 | /** 48 | * 49 | */ 50 | var secret : String; 51 | 52 | /** 53 | * 54 | */ 55 | var scope : Dynamic; 56 | 57 | /** 58 | * 59 | */ 60 | var info : Bool; 61 | 62 | /** 63 | * 64 | */ 65 | var fields : Dynamic; 66 | 67 | /** 68 | * 69 | */ 70 | var redirect_uri : String; 71 | 72 | /** 73 | * 74 | */ 75 | var state : String; 76 | 77 | /** 78 | * 79 | */ 80 | var emails : Bool; 81 | 82 | /** 83 | * 84 | */ 85 | var format : String; 86 | } 87 | 88 | /** 89 | * 90 | */ 91 | extern class AuthomData 92 | { 93 | /** 94 | * the token resulting from authentication 95 | */ 96 | var token : String; 97 | 98 | /** 99 | * the refresh_token resulting from authentication, if implemented by auth service, otherwise undefined 100 | */ 101 | var refresh_token : String; 102 | 103 | /** 104 | * the ID of the user on the remote service 105 | */ 106 | var id : String; 107 | 108 | /** 109 | * the original data returned from the service 110 | */ 111 | var data : Dynamic; 112 | 113 | /** 114 | * the name of the service, given so that you can branch your code: 115 | */ 116 | var service : String; 117 | } 118 | 119 | /** 120 | * authom is an authentication library for node.js. It unifies authentication APIs for multiple services into a single EventEmitter, and works with both the built-in node.js HTTP module and as an Express/Connect app. 121 | * authom was designed to solve one problem and solve it well. It has an intuitive node.js-like API, no required dependencies, and doesn't force any particular persistence, session, or middleware approaches on you. 122 | * @author Eduardo Pons - eduardo@thelaborat.org 123 | */ 124 | @:native("require('authom')") 125 | extern class Authom implements Dynamic 126 | //extends EventEmitter 127 | { 128 | /** 129 | * Returns an instance of Authom 130 | */ 131 | static var instance(get, never):Authom; 132 | static inline function get_instance():Authom { return cast Node.require("authom"); } 133 | 134 | /** 135 | * A regular expression that is run on the pathname of every request. 136 | * authom will only run if this expression is matched. 137 | * By default, it is /^\/auth\/([^\/]+)\/?$/. 138 | */ 139 | var route : EReg; 140 | 141 | /** 142 | * This is a convenience Express app, which should be mounted at a path containing a :service parameter. 143 | */ 144 | function app():Dynamic; 145 | 146 | /** 147 | * Creates an EventEmitter for the given authentication service. 148 | * The service is specified by the service key of the options object, with all other keys differing based on the service. 149 | * @param p_options 150 | */ 151 | @:overload(function(p_options:AuthomServerOption):Dynamic{}) 152 | function createServer(p_options : AuthomServerOption, p_callback : IncomingMessage -> ServerResponse -> Void) : Dynamic; 153 | 154 | 155 | /** 156 | * Listens to an existing HTTP(S) server for request events. 157 | * Like socket.io's .listen method, authom will intercept any request whose path starts with /auth. 158 | * @param p_server 159 | */ 160 | @:overload(function(p_server: js.node.https.Server):Void { } ) 161 | function listen(p_server : js.node.http.Server):Void; 162 | 163 | /** 164 | * A standard node.js listener. This can be used for more control over the path at which authom is used. For example, the following two are equivalent: 165 | * @param p_request 166 | * @param p_response 167 | */ 168 | function listener(p_request : IncomingMessage, p_response : ServerResponse):Void; 169 | 170 | /** 171 | * Authom-compliant services can be registered using this method. 172 | * This is useful for adding custom authentication services not suited to be part of the /lib core services. 173 | * (For example a business-specific in-house authentication service.) 174 | * Custom services will override existing services of the same name. 175 | * @param p_name 176 | * @param p_service 177 | */ 178 | function registerService(p_name:String, p_service : Dynamic -> Void):Void; 179 | 180 | 181 | } -------------------------------------------------------------------------------- /js/npm/base64stream/Base64Stream.hx: -------------------------------------------------------------------------------- 1 | package js.npm.base64stream; 2 | 3 | import js.node.stream.Duplex; 4 | 5 | @:jsRequire("base64-stream") 6 | extern class Base64Stream extends js.node.events.EventEmitter 7 | { 8 | public static function encode() :IDuplex; 9 | public static function decode() :IDuplex; 10 | } 11 | -------------------------------------------------------------------------------- /js/npm/bluebird/Bluebird.hx: -------------------------------------------------------------------------------- 1 | package js.npm.bluebird; 2 | 3 | import haxe.Constraints; 4 | import haxe.extern.EitherType; 5 | 6 | @:jsRequire("bluebird") 7 | extern class Bluebird 8 | { 9 | // Statics 10 | public static function method(fn : Function) : Bluebird; 11 | public static function resolve(value : Dynamic) : Bluebird; 12 | public static function reject(value : Dynamic) : Bluebird; 13 | 14 | // Promisification 15 | @:overload(function(nodeFunction : A1) : A1 {}) 16 | public static function promisify(nodeFunction : A1, ?receiver : Dynamic) : A1; 17 | 18 | @:overload(function(target : A1) : A1 {}) 19 | public static function promisifyAll(target : Dynamic, ?options : {}) : A1; 20 | 21 | @:overload(function(items : Array) : Bluebird, A2> {}) 22 | public static function all(items : Array>) : Bluebird, A2>; 23 | 24 | @:overload(function(object : Bluebird<{}, A2>) : Bluebird<{}, A2> {}) 25 | public static function props(object : {}) : Bluebird<{}, A2>; 26 | 27 | // Constructor 28 | @:overload(function() : Void {}) 29 | @:overload(function(resolver : (T -> Void) -> Void) : Void {}) 30 | public function new(resolver : (T -> Void) -> (T2 -> Void) -> Void); 31 | 32 | // Continuation 33 | @:overload(function(fulfilledHandler : T -> T3) : Bluebird {}) 34 | public function then(fulfilledHandler : T -> T3, rejectedHandler : T2 -> T4) : Bluebird; 35 | 36 | @:overload(function(fulfilledHandler : Function) : Bluebird {}) 37 | public function spread(fulfilledHandler : Function, rejectedHandler : T2 -> T4) : Bluebird; 38 | 39 | // Error handling 40 | @:overload(function(error : T5 -> Void) : Bluebird {}) 41 | public function caught(cls : Class, error : T5 -> Void) : Bluebird; 42 | public function error(rejectedHandler : T5 -> Void) : Bluebird; 43 | public function lastly(fulfilledHandler : T -> T3) : Bluebird; 44 | 45 | // Status 46 | public function isFulfilled() : Bool; 47 | public function isRejected() : Bool; 48 | public function isPending() : Bool; 49 | public function value() : T; 50 | public function reason() : T2; 51 | 52 | // Delay 53 | public function delay(ms : Int) : Bluebird; 54 | 55 | // Utils 56 | public function tap(fulfilledHandler : T -> T3) : Bluebird; 57 | public function get(index : EitherType) : Bluebird; 58 | public function thenReturn(value : T3) : Bluebird; 59 | public function thenThrow(value : T3) : Bluebird; 60 | } -------------------------------------------------------------------------------- /js/npm/bodyparser/BodyParser.hx: -------------------------------------------------------------------------------- 1 | package js.npm.bodyparser; 2 | 3 | import js.node.Buffer; 4 | import js.node.http.*; 5 | 6 | typedef UrlencodedOptions = { 7 | extended : Bool, 8 | ?inflate : Bool, 9 | ?limit : Int, 10 | ?parameterLimit : Int, 11 | ?type : String, 12 | ?verify : IncomingMessage -> ServerResponse -> Buffer -> String -> Void 13 | } 14 | 15 | @:jsRequire('body-parser') 16 | extern class BodyParser 17 | { 18 | public static function json(?options : {}) : BodyParser; 19 | public static function raw(?options : {}) : BodyParser; 20 | public static function text(?options : {}) : BodyParser; 21 | public static function urlencoded(?options : UrlencodedOptions) : BodyParser; 22 | 23 | public inline static function body(req : IncomingMessage) : Dynamic { 24 | return untyped req.body; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /js/npm/bull/Bull.hx: -------------------------------------------------------------------------------- 1 | package js.npm.bull; 2 | 3 | import js.Error; 4 | import js.Promise; 5 | import js.node.events.EventEmitter; 6 | import js.node.events.EventEmitter.Event; 7 | import js.npm.redis.RedisClient; 8 | 9 | typedef BullJobError=Dynamic; 10 | typedef Done0=Void->Void; 11 | typedef Done1=Error->Void; 12 | typedef Done2=Null->Result->Void; 13 | 14 | typedef JobOptionsBackoff = { 15 | var type :String; 16 | var delay :Int; 17 | } 18 | 19 | typedef JobOptionsRepeatOpts = { 20 | /* Not clear if you should pass this in, but getRepeatableJobs returns blobs with and id */ 21 | @:optional var id :String; 22 | @:optional var cron :String; 23 | @:optional var tz :String; 24 | @:optional var endDate :Dynamic; 25 | @:optional var limit :Int; 26 | @:optional var every :Float; 27 | } 28 | 29 | typedef JobOptions = { 30 | @:optional var delay :Int; 31 | @:optional var attempts :Int; 32 | @:optional var backoff :JobOptionsBackoff; 33 | @:optional var lifo :Bool; 34 | @:optional var timeout :Int; 35 | @:optional var jobId :String; 36 | @:optional var stackTraceLimit :Int; 37 | @:optional var removeOnComplete :Bool; 38 | @:optional var removeOnFail :Bool; 39 | @:optional var repeat :JobOptionsRepeatOpts; 40 | @:optional var priority :Int; 41 | } 42 | 43 | typedef BullJobCounts = { 44 | var waiting :Int; 45 | var active :Int; 46 | var completed :Int; 47 | var failed :Int; 48 | var delayed :Int; 49 | } 50 | 51 | @:enum 52 | abstract RedisConnectionType(String) from String to String { 53 | var client = 'client'; 54 | var subscriber = 'subscriber'; 55 | } 56 | 57 | typedef BullOptions = { 58 | @:optional var redis :{?port:Int, ?host:String, ?password :String, ?db:Int}; 59 | @:optional var limiter :{max:Float, duration:Float}; 60 | @:optional var prefix :String; 61 | @:optional var settings :{ 62 | ?lockDuration :Float, 63 | ?stalledInterval :Float, 64 | ?maxStalledCount :Float, 65 | ?guardInterval :Float, 66 | ?retryProcessDelay :Float 67 | }; 68 | @:optional var createClient :RedisConnectionType->RedisClient; 69 | } 70 | 71 | typedef Progress=Float; 72 | typedef JobType=String; 73 | 74 | typedef WorkerMetaData = { 75 | var id :String; 76 | var addr :String; 77 | var fd :String; 78 | var name :String; 79 | var age :String; 80 | var idle :String; 81 | var flags :String; 82 | var db :String; 83 | var sub :String; 84 | var psub :String; 85 | var multi :String; 86 | var qbuf :String; 87 | var obl :String; 88 | var oll :String; 89 | var omem :String; 90 | var events :String; 91 | var cmd :String; 92 | } 93 | 94 | /** 95 | Enumeration of events emitted by the `Readable` class. 96 | **/ 97 | @:enum abstract QueueEvent(Event) to Event { 98 | var Ready : QueueEventVoid> = "ready"; 99 | var Cleaned : QueueEvent->String->Void> = "cleaned"; 100 | var Error : QueueEventVoid> = "error"; 101 | var Active : QueueEvent->Promise->Void> = "active"; 102 | var Stalled : QueueEvent->Void> = "stalled"; 103 | var Progress : QueueEvent->Progress->Void> = "progress"; 104 | var Completed : QueueEvent->Dynamic->Void> = "completed"; 105 | var Failed : QueueEvent->Dynamic->Void> = "failed"; 106 | var Paused : QueueEventVoid> = "paused"; 107 | var Resumed : QueueEvent->Void> = "resumed"; 108 | } 109 | 110 | @:enum abstract JobEvent(Event) to Event { 111 | var Error : JobEventVoid> = "error"; 112 | } 113 | 114 | @:jsRequire("bull") 115 | extern class Queue extends EventEmitter> 116 | { 117 | @:selfCall 118 | @:overload(function(queueName :String, url :String, opts :BullOptions) :Void { }) 119 | @:overload(function(queueName :String, url :String) :Void { }) 120 | @:overload(function(queueName :String) :Void { }) 121 | public function new(queueName :String, opts :BullOptions) :Void; 122 | 123 | @:overload(function(concurrency :Int, job :Job) :Promise { }) 124 | @:overload(function(job :Job) :Promise { }) 125 | @:overload(function(cb :Job->Done0->Void) :Void { }) 126 | @:overload(function(cb :Job->Done1->Void) :Void { }) 127 | @:overload(function(cb :Job->Done2->Void) :Void { }) 128 | @:overload(function(concurrency :Int, cb :Job->Done0->Void) :Void { }) 129 | @:overload(function(concurrency :Int, cb :Job->Done1->Void) :Void { }) 130 | public function process(concurrency :Int, cb :Job->Done2->Void) :Void; 131 | 132 | @:overload(function(queueName :String, data :JobData) :Promise> { }) 133 | @:overload(function(queueName :String, data :JobData, opts :JobOptions) :Promise> { }) 134 | @:overload(function(data :JobData) :Promise> { }) 135 | public function add(data :JobData, opts :JobOptions) :Promise>; 136 | public function pause(?isLocal :Bool) :Promise; 137 | public function resume(?isLocal :Bool) :Promise; 138 | public function count() :Promise; 139 | public function getJobCounts() :Promise; 140 | public function getRepeatableJobs(?start :Float, ?end :Float, ?asc :Bool) :Promise>; 141 | @:overload(function(opts :JobOptionsRepeatOpts) :Promise { }) 142 | public function removeRepeatable(name :String, opts :JobOptionsRepeatOpts) :Promise; 143 | public function getActive() :Promise>>; 144 | public function getActiveCount() :Promise; 145 | public function getDelayed() :Promise>>; 146 | public function getDelayedCount() :Promise; 147 | public function getFailed() :Promise>>; 148 | public function getFailedCount() :Promise; 149 | public function getCompleted() :Promise>>; 150 | public function getCompletedCount() :Promise; 151 | public function getWaitingCount() :Promise; 152 | public function getPausedCount() :Promise; 153 | public function getWaiting() :Promise; 154 | public function getWorkers() :Promise>; 155 | public function empty() :Promise; 156 | public function close() :Promise; 157 | public function getJob(jobId :String) :Promise>>; 158 | public function getJobs(types: Array, ?start: Float, ?end: Float, ?asc: Bool) :Promise>>; 159 | public function clean(gracePeriod :Int, ?type :JobType, ?limit :Int) :Promise; 160 | } 161 | 162 | extern class Job 163 | { 164 | public var data :JobData; 165 | public function discard() :Promise; 166 | public function finished() :Promise; 167 | public function progress(val :Progress) :Void; 168 | public function promote() :Void; 169 | public function remove() :Promise; 170 | public function retry() :Promise; 171 | public function update(data :JobData) :Promise; 172 | } 173 | -------------------------------------------------------------------------------- /js/npm/bullarena/BullArena.hx: -------------------------------------------------------------------------------- 1 | package js.npm.bullarena; 2 | 3 | typedef BullArenaOptions = { 4 | var queues :Array; 5 | } 6 | typedef BullArenaQueueConfiguration = { 7 | var name :String; 8 | @:optional var port :Int; 9 | @:optional var host :String; 10 | var hostId :String; 11 | @:optional var db :String; 12 | @:optional var password :String; 13 | @:optional var prefix :String; 14 | @:optional var url :String; 15 | } 16 | 17 | typedef BullArenaListenOptions = { 18 | @:optional var port :Int; 19 | @:optional var basePath :String; 20 | @:optional var disableListen :Bool; 21 | } 22 | 23 | @:jsRequire("bull-arena") 24 | extern class BullArena 25 | { 26 | @:selfCall 27 | public function new(queueOpts :BullArenaOptions, ?listenOpts :BullArenaListenOptions) :Void; 28 | } -------------------------------------------------------------------------------- /js/npm/bunyan/Bunyan.hx: -------------------------------------------------------------------------------- 1 | package js.npm.bunyan; 2 | 3 | import haxe.extern.Rest; 4 | 5 | typedef BunyanLogger = { 6 | function trace(args :Rest) :Void; 7 | function debug(args :Rest) :Void; 8 | function info(args :Rest) :Void; 9 | function warn(args :Rest) :Void; 10 | function error(args :Rest) :Void; 11 | function fatal(args :Rest) :Void; 12 | function child(fields :Dynamic) :BunyanLogger; 13 | function level(?newLevel :Int) :Int; 14 | function levels() :Array; 15 | } 16 | 17 | @:jsRequire("bunyan") 18 | extern class Bunyan extends js.node.events.EventEmitter 19 | { 20 | public static var TRACE :Int; 21 | public static var DEBUG :Int; 22 | public static var INFO :Int; 23 | public static var WARN :Int; 24 | public static var ERROR :Int; 25 | public static var FATAL :Int; 26 | 27 | public static function createLogger(args :Dynamic) :BunyanLogger; 28 | } 29 | -------------------------------------------------------------------------------- /js/npm/busboy/Busboy.hx: -------------------------------------------------------------------------------- 1 | package js.npm.busboy; 2 | /** 3 | * https://github.com/mscdex/busboy 4 | */ 5 | import js.node.http.*; 6 | import js.node.stream.Readable; 7 | import js.node.stream.Writable; 8 | import js.node.events.EventEmitter; 9 | import js.Error; 10 | 11 | typedef FieldName=String; 12 | typedef FileName=String; 13 | typedef Encoding=String; 14 | typedef MimeType=String; 15 | 16 | typedef Value=String; 17 | typedef FieldNameTruncated=Bool; 18 | typedef ValueTruncated=Bool; 19 | 20 | typedef BusboyConstructorLimits = { 21 | @:optional var fieldNameSize :Float; 22 | @:optional var fieldSize :Float; 23 | @:optional var fields :Float; 24 | @:optional var fileSize :Float; 25 | @:optional var files :Float; 26 | @:optional var parts :Float; 27 | @:optional var headerPairs :Float; 28 | } 29 | 30 | typedef BusboyConstructorOpts = { 31 | @:optional var headers :Dynamic; 32 | @:optional var highWaterMark :Float; 33 | @:optional var fileHwm :Float; 34 | @:optional var defCharset :String; 35 | @:optional var preservePath :Bool; 36 | @:optional var limits :BusboyConstructorLimits; 37 | } 38 | 39 | /** 40 | Enumeration of events emitted by the `Busboy` objects 41 | **/ 42 | @:enum abstract BusboyEvent(Event) to Event { 43 | var File : BusboyEventReadable->FileName->Encoding->MimeType->Void> = "file"; 44 | var Field : BusboyEventValue->FieldNameTruncated->ValueTruncated->Void> = "field"; 45 | var Finish : BusboyEventVoid> = "finish"; 46 | var Limit : BusboyEventVoid> = "limit"; 47 | var PartsLimit : BusboyEventVoid> = "partsLimit"; 48 | var FilesLimit : BusboyEventVoid> = "filesLimit"; 49 | var FieldsLimit : BusboyEventVoid> = "fieldsLimit"; 50 | } 51 | 52 | @:jsRequire('busboy') 53 | extern class Busboy extends Writable 54 | { 55 | public function new(opts :BusboyConstructorOpts) :Void; 56 | } 57 | -------------------------------------------------------------------------------- /js/npm/cassandra/Cassandra.hx: -------------------------------------------------------------------------------- 1 | package js.npm.cassandra; 2 | 3 | import haxe.Json; 4 | 5 | typedef ConstructorArgs = { 6 | var contactPoints :Array; 7 | @:optional var keyspace :String; //This is strictly not necessary, but we'll create it not present 8 | @:optional var protocolOptions :{port :Int}; 9 | @:optional var authProvider :Dynamic; 10 | } 11 | 12 | typedef Err=Dynamic; 13 | 14 | typedef Result = { 15 | var rows :Array;//This is the row object 16 | var info :{queriedHost :String, triedHosts :Dynamic, achievedConsistency :Int}; 17 | var rowLength :Int; 18 | var pageState : Dynamic; 19 | var columns :Array<{name :String, type :Int, sybtypes :Dynamic}>; 20 | } 21 | 22 | typedef ResultsCallback=Err->Result->Void; 23 | 24 | @:jsRequire("cassandra-driver", "Client") 25 | extern class Client extends js.node.events.EventEmitter 26 | { 27 | public function new(args :ConstructorArgs) : Void; 28 | 29 | @:overload(function(csql :String, parameters :Array, cb :ResultsCallback):Void {}) 30 | @:overload(function(csql :String, parameters :Array, queryParameters :Dynamic, cb :ResultsCallback):Void {}) 31 | public function execute(csql :String, cb :ResultsCallback) : Void; 32 | 33 | public function connect(cb :Null->Void) : Void; 34 | public function shutdown(cb :Null->Void) : Void; 35 | 36 | public var metadata :Dynamic; 37 | public var keyspace :String; 38 | } 39 | 40 | @:jsRequire("cassandra-driver", "types.Uuid") 41 | extern class Uuid 42 | { 43 | public static function random() :Uuid; 44 | public static function fromString(val :String) :Uuid; 45 | public function toString() :String; 46 | } 47 | 48 | @:jsRequire("cassandra-driver", "types.Long") 49 | extern class CassandraLong 50 | { 51 | public static function fromNumber(n :Float) :CassandraLong; 52 | public static function fromString(val :String) :CassandraLong; 53 | 54 | public function toString() :String; 55 | public function equals(other :CassandraLong) :Bool; 56 | public function add(other :CassandraLong) :CassandraLong; 57 | } 58 | 59 | @:jsRequire("cassandra-driver", "auth.PlainTextAuthProvider") 60 | extern class PlainTextAuthProvider 61 | { 62 | public function new(login :String, password :String) :Void; 63 | } 64 | 65 | @:jsRequire("cassandra-driver", "Connection") 66 | extern class Connection extends js.node.events.EventEmitter 67 | { 68 | public function new(endPoint :String, protocolVersion :Float, options :ConstructorArgs) :Void; 69 | public function open(cb :Null->Void) :Void; 70 | } -------------------------------------------------------------------------------- /js/npm/clicolor/CliColor.hx: -------------------------------------------------------------------------------- 1 | package js.npm.clicolor; 2 | 3 | @:jsRequire('cli-color') 4 | extern class CliColor 5 | { 6 | public static function bold(s :String) :String; 7 | public static function italic(s :String) :String; 8 | public static function underline(s :String) :String; 9 | public static function blink(s :String) :String; 10 | public static function inverse(s :String) :String; 11 | public static function strike(s :String) :String; 12 | 13 | public static function black(s :String) :String; 14 | public static function red(s :String) :String; 15 | public static function green(s :String) :String; 16 | public static function yellow(s :String) :String; 17 | public static function blue(s :String) :String; 18 | public static function magenta(s :String) :String; 19 | public static function cyan(s :String) :String; 20 | public static function white(s :String) :String; 21 | 22 | public static function blackBright(s :String) :String; 23 | public static function redBright(s :String) :String; 24 | public static function greenBright(s :String) :String; 25 | public static function yellowBright(s :String) :String; 26 | public static function blueBright(s :String) :String; 27 | public static function magentaBright(s :String) :String; 28 | public static function cyanBright(s :String) :String; 29 | public static function whiteBright(s :String) :String; 30 | 31 | public static function bgBlack(s :String) :String; 32 | public static function bgRed(s :String) :String; 33 | public static function bgGreen(s :String) :String; 34 | public static function bgYellow(s :String) :String; 35 | public static function bgBlue(s :String) :String; 36 | public static function bgMagenta(s :String) :String; 37 | public static function bgCyan(s :String) :String; 38 | public static function bgWhite(s :String) :String; 39 | 40 | public static function xterm(v :Int) :String->String; 41 | public static function bgXterm(v :Int) :String->String; 42 | 43 | public static function art(text :String, style :Dynamic) :String; 44 | 45 | public static var reset :String; 46 | public static var erase :{ 47 | screenLeft :String, 48 | screenRight :String, 49 | line :String, 50 | lineRight :String, 51 | lineLeft :String, 52 | }; 53 | } -------------------------------------------------------------------------------- /js/npm/colour/Colour.hx: -------------------------------------------------------------------------------- 1 | package js.npm.colour; 2 | 3 | @:jsRequire("colour") 4 | extern class Colour 5 | { 6 | public static function green(s :String) :String; 7 | public static function uninstall() :Void; 8 | public static function install() :Void; 9 | } -------------------------------------------------------------------------------- /js/npm/commander/Commander.hx: -------------------------------------------------------------------------------- 1 | package js.npm.commander; 2 | 3 | import haxe.extern.Rest; 4 | 5 | @:jsRequire("commander") 6 | extern class Commander 7 | { 8 | public var args :Array; 9 | public var rawArgs :Array; 10 | public var commands :Array; 11 | 12 | public function version (s :String) :Commander; 13 | public function command (s :String, ?description :String, r:Rest) :Command; 14 | public function option(optionString :String, description :String, r:Rest) :Commander; 15 | public function parse (args :Array) :Void; 16 | public function help(?f :Void->Void) :Void; 17 | public function outputHelp() :Void; 18 | } 19 | 20 | extern class Command 21 | { 22 | public var _name :String; 23 | public var parent :Commander; 24 | public function description(s :String) :Command; 25 | 26 | @:overload(function (flags :String, description :String, coercion :Dynamic, ?defaultValue :Dynamic) :Command {}) 27 | @:overload(function (flags :String, description :String) :Command {}) 28 | public function option(flags :String) :Command; 29 | 30 | public function alias(s :String) :Command; 31 | 32 | @:overload(function(f :Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Void) :Command {}) 33 | @:overload(function(f :Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Void) :Command {}) 34 | @:overload(function(f :Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Void) :Command {}) 35 | @:overload(function(f :Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Void) :Command {}) 36 | @:overload(function(f :Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Void) :Command {}) 37 | @:overload(function(f :Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Void) :Command {}) 38 | @:overload(function(f :Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Void) :Command {}) 39 | @:overload(function(f :Dynamic->Dynamic->Dynamic->Dynamic->Dynamic->Void) :Command {}) 40 | @:overload(function(f :Dynamic->Dynamic->Dynamic->Dynamic->Void) :Command {}) 41 | @:overload(function(f :Dynamic->Dynamic->Dynamic->Void) :Command {}) 42 | @:overload(function(f :Dynamic->Dynamic->Void) :Command {}) 43 | public function action(f :Dynamic->Void) :Command; 44 | 45 | public function on(arg :String, f :Void->Void) :Command; 46 | 47 | public function addImplicitHelpCommand() :Void; 48 | public function optionHelp() :String; 49 | public function helpInformation() :String; 50 | } -------------------------------------------------------------------------------- /js/npm/cookies/Cookies.hx: -------------------------------------------------------------------------------- 1 | package js.npm.cookies; 2 | import js.node.http.IncomingMessage; 3 | import js.node.http.ServerResponse; 4 | 5 | /** 6 | * Configuration object for the get/set methods of the Cookies class. 7 | */ 8 | extern class CookieOptions 9 | { 10 | /** 11 | * a number representing the milliseconds from Date.now() for expiry 12 | */ 13 | var maxAge : Int; 14 | 15 | /** 16 | * a Date object indicating the cookie's expiration date (expires at the end of session by default). 17 | */ 18 | var expires : Date; 19 | 20 | /** 21 | * a string indicating the path of the cookie ( / by default). 22 | */ 23 | var path : String; 24 | 25 | /** 26 | * a string indicating the domain of the cookie (no default). 27 | */ 28 | var domain : String; 29 | 30 | /** 31 | * a boolean indicating whether the cookie is only to be sent over HTTPS (false by default for HTTP, true by default for HTTPS). 32 | */ 33 | var secure : Bool; 34 | 35 | /** 36 | * a boolean indicating whether the cookie is only to be sent over HTTPS (use this if you handle SSL not in your node process). 37 | */ 38 | var secureProxy : Bool; 39 | 40 | /** 41 | * a boolean indicating whether the cookie is only to be sent over HTTP(S), and not made available to client JavaScript (true by default). 42 | */ 43 | var httpOnly : Bool; 44 | 45 | /** 46 | * a boolean indicating whether the cookie is to be signed (false by default). If this is true, another cookie of the same name with the .sig suffix appended will also be sent, with a 27 - byte url - safe base64 SHA1 value representing the hash of cookie-name = cookie-value against the first Keygrip key. This signature key is used to detect tampering the next time a cookie is received. 47 | */ 48 | var signed : Bool; 49 | 50 | /** 51 | * a boolean indicating whether to overwrite previously set cookies of the same name (false by default). If this is true, all cookies set during the same request with the same name (regardless of path or domain) are filtered out of the Set - Cookie header when setting this cookie. 52 | */ 53 | var overwrite : Bool; 54 | } 55 | 56 | /** 57 | * Cookies is a node.js module for getting and setting HTTP(S) cookies. Cookies can be signed to prevent tampering, using Keygrip. It can be used with the built-in node.js HTTP library, or as Connect/Express middleware. 58 | * @author Eduardo Pons - eduardo@thelaborat.org 59 | */ 60 | @:native("(require('cookies'))") 61 | extern class Cookies 62 | { 63 | 64 | /** 65 | * This adds cookie support as a Connect middleware layer for use in Express apps, allowing inbound cookies to be read using req.cookies.get and outbound cookies to be set using res.cookies.set. 66 | * @param p_arg 67 | * @return 68 | */ 69 | static public function express(p_keys : Dynamic):Dynamic; 70 | 71 | /** 72 | * This creates a cookie jar corresponding to the current request and response. 73 | * A Keygrip object or an array of keys can optionally be passed as the third argument keygrip to enable cryptographic signing based on SHA1 HMAC, using rotated credentials. 74 | * Note that since this only saves parameters without any other processing, it is very lightweight. 75 | * Cookies are only parsed on demand when they are accessed. 76 | * @param p_request 77 | * @param p_response 78 | * @param p_keys 79 | */ 80 | @:overload(function(p_request : IncomingMessage, p_response : ServerResponse):Void { } ) 81 | public function new(p_request : IncomingMessage, p_response : ServerResponse,p_keys : Array):Void; 82 | 83 | /** 84 | * This extracts the cookie with the given name from the Cookie header in the request. If such a cookie exists, its value is returned. Otherwise, nothing is returned. 85 | * { signed: true } can optionally be passed as the second parameter options. In this case, a signature cookie (a cookie of same name ending with the .sig suffix appended) is fetched. 86 | * If no such cookie exists, nothing is returned. 87 | * If the signature cookie does exist, the provided Keygrip object is used to check whether the hash of cookie-name=cookie-value matches that of any registered key: 88 | * - If the signature cookie hash matches the first key, the original cookie value is returned. 89 | * - If the signature cookie hash matches any other key, the original cookie value is returned AND an outbound header is set to update the signature cookie's value to the hash of the first key. This enables automatic freshening of signature cookies that have become stale due to key rotation. 90 | * - If the signature cookie hash does not match any key, nothing is returned, and an outbound header with an expired date is used to delete the cookie. 91 | * @param p_name 92 | * @param p_options 93 | */ 94 | @:overload(function(p_name:String):String{}) 95 | function get(p_name:String, p_options:CookieOptions):String; 96 | 97 | /** 98 | * This sets the given cookie in the response and returns the current context to allow chaining. 99 | * If the value is omitted, an outbound header with an expired date is used to delete the cookie. 100 | * @param p_name 101 | * @param p_value 102 | * @param p_options 103 | */ 104 | @:overload(function(p_name:String):Void { } ) 105 | @:overload(function(p_name:String, p_value:String):Void { } ) 106 | function set(p_name:String, p_value : String, p_options : CookieOptions):Void; 107 | 108 | 109 | } -------------------------------------------------------------------------------- /js/npm/d3/D3.hx: -------------------------------------------------------------------------------- 1 | package js.npm.d3; 2 | 3 | @:jsRequire("d3") 4 | extern class D3 5 | { 6 | } 7 | 8 | -------------------------------------------------------------------------------- /js/npm/deepequal/DeepEqual.hx: -------------------------------------------------------------------------------- 1 | package js.npm.deepequal; 2 | 3 | @:jsRequire("deep-equal") 4 | extern class DeepEqual 5 | { 6 | @:selfCall 7 | public static function equal(a :Dynamic, b :Dynamic) :Bool; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /js/npm/digraph/DiGraph.hx: -------------------------------------------------------------------------------- 1 | package js.npm.digraph; 2 | 3 | import haxe.DynamicAccess; 4 | 5 | import react.ReactComponent; 6 | import react.ReactMacro.jsx; 7 | 8 | typedef NodeType = { 9 | @:optional var typeText :String; 10 | var shapeId :String; 11 | var shape :Dynamic; 12 | } 13 | 14 | typedef EdgeType = { 15 | shapeId:String, 16 | shape: Dynamic 17 | } 18 | 19 | typedef GraphConfig = { 20 | var NodeTypes:DynamicAccess; 21 | var EdgeTypes:DynamicAccess; 22 | @:optional var NodeSubtypes:DynamicAccess; 23 | } 24 | 25 | typedef GraphOperations = { 26 | function getViewNode(nodeKey :String) :GraphStateNode; 27 | function onSelectNode(node :GraphStateNode) :Void; 28 | function onCreateNode(x :Int, y :Int) :Void; 29 | function onUpdateNode(node :GraphStateNode) :Void; 30 | function onDeleteNode(node :GraphStateNode) :Void; 31 | function onSelectEdge(edge :GraphStateEdge) :Void; 32 | function onCreateEdge(sourceViewNode :GraphStateNode, targetViewNode :GraphStateNode) :Void; 33 | function onSwapEdge(sourceViewNode :GraphStateNode, targetViewNode :GraphStateNode, viewEdge :GraphStateEdge) :Void; 34 | function onDeleteEdge(edge :GraphStateEdge) :Void; 35 | } 36 | 37 | typedef GraphStateNode = { 38 | var id :Int; 39 | var title :String; 40 | var x :Float; 41 | var y :Float; 42 | var type :String; 43 | } 44 | 45 | typedef GraphStateEdge = { 46 | var source :Int; 47 | var target :Int; 48 | var type :String; 49 | } 50 | 51 | typedef GraphState = { 52 | var nodes :Array; 53 | var edges :Array; 54 | } 55 | 56 | typedef GraphComponentState = { 57 | @:optional var graph :GraphState; 58 | @:optional var selected :Dynamic; 59 | } 60 | 61 | typedef GraphComponentProps = { 62 | var nodeKey :String; 63 | var emptyType :String; 64 | var config :GraphConfig; 65 | var ops :GraphOperations; 66 | @:optional var state :GraphComponentState; 67 | } 68 | 69 | class DiGraphConstants 70 | { 71 | inline public static var NODE_KEY = 'id'; 72 | inline public static var EMPTY_TYPE = 'empty'; 73 | 74 | } -------------------------------------------------------------------------------- /js/npm/digraph/GraphView.hx: -------------------------------------------------------------------------------- 1 | package js.npm.digraph; 2 | 3 | @:jsRequire('react-digraph', 'default')//Wow, 'default' was a huge gotcha 4 | extern class GraphView extends react.ReactComponent { } -------------------------------------------------------------------------------- /js/npm/digraph/GraphViewExample.hx: -------------------------------------------------------------------------------- 1 | package js.npm.digraph; 2 | 3 | import haxe.DynamicAccess; 4 | import haxe.Json; 5 | 6 | import react.ReactComponent; 7 | import react.ReactMacro.jsx; 8 | 9 | import js.npm.digraph.DiGraph; 10 | import js.npm.digraph.DiGraph.DiGraphConstants.*; 11 | import js.npm.digraph.GraphViewImplementation; 12 | 13 | using Lambda; 14 | 15 | class GraphViewExample 16 | extends ReactComponentOfState 17 | { 18 | // These keys are arbitrary (but must match the config) 19 | // However, GraphView renders text differently for empty types 20 | // so this has to be passed in if that behavior is desired. 21 | static var EMPTY_TYPE = "empty"; // Empty node type 22 | static var SPECIAL_TYPE = "special"; 23 | static var SPECIAL_CHILD_SUBTYPE = "specialChild"; 24 | static var EMPTY_EDGE_TYPE = "emptyEdge"; 25 | static var SPECIAL_EDGE_TYPE = "specialEdge"; 26 | 27 | public function new(props) 28 | { 29 | super(props); 30 | this.state = EXAMPLE_STATE; 31 | } 32 | 33 | override public function render() 34 | { 35 | var ops :GraphOperations = { 36 | getViewNode: this.getViewNode, 37 | onSelectNode: this.onSelectNode, 38 | onCreateNode: this.onCreateNode, 39 | onUpdateNode: this.onUpdateNode, 40 | onDeleteNode: this.onDeleteNode, 41 | onSelectEdge: this.onSelectEdge, 42 | onCreateEdge: this.onCreateEdge, 43 | onSwapEdge: this.onSwapEdge, 44 | onDeleteEdge: this.onDeleteEdge, 45 | }; 46 | var config :GraphConfig = EXAMPLE_CONFIG; 47 | var nodeKey = NODE_KEY; 48 | var emptyType = EMPTY_TYPE; 49 | var state :GraphComponentState = this.state; 50 | 51 | var styles = { 52 | graph: { 53 | height: '100%', 54 | width: '100%' 55 | } 56 | }; 57 | return jsx(' 58 |
59 | 66 |
67 | '); 68 | } 69 | 70 | // Given a nodeKey, return the corresponding node 71 | public function getViewNode(nodeKey) 72 | { 73 | var searchNode :GraphStateNode = cast {id:nodeKey}; 74 | var i = this.getNodeIndex(searchNode); 75 | return this.state.graph.nodes[i]; 76 | } 77 | 78 | /* 79 | * Handlers/Interaction 80 | */ 81 | 82 | // Called by 'drag' handler, etc.. 83 | // to sync updates from D3 with the graph 84 | public function onUpdateNode(viewNode) 85 | { 86 | var graph = this.state.graph; 87 | var i = this.getNodeIndex(viewNode); 88 | 89 | graph.nodes[i] = viewNode; 90 | this.setState({graph: graph}); 91 | } 92 | 93 | 94 | // Node 'mouseUp' handler 95 | public function onSelectNode(viewNode) 96 | { 97 | // Deselect events will send Null viewNode 98 | if (viewNode != null) { 99 | this.setState({selected: viewNode}); 100 | } else{ 101 | this.setState({selected: {}}); 102 | } 103 | } 104 | 105 | // Edge 'mouseUp' handler 106 | public function onSelectEdge(viewEdge) 107 | { 108 | this.setState({selected: viewEdge}); 109 | } 110 | 111 | // Updates the graph with a new node 112 | public function onCreateNode(x :Int, y :Int) 113 | { 114 | trace('onCreateNode'); 115 | var graph = this.state.graph; 116 | 117 | // This is just an example - any sort of logic 118 | // could be used here to determine node type 119 | // There is also support for subtypes. (see 'sample' above) 120 | // The subtype geometry will underlay the 'type' geometry for a node 121 | var type = Math.random() < 0.25 ? SPECIAL_TYPE : EMPTY_TYPE; 122 | 123 | var viewNode :GraphStateNode = { 124 | id: this.state.graph.nodes.length + 1, 125 | title: '', 126 | type: type, 127 | x: x, 128 | y: y 129 | } 130 | 131 | graph.nodes.push(viewNode); 132 | this.setState({graph: graph}); 133 | } 134 | 135 | // Deletes a node from the graph 136 | public function onDeleteNode(viewNode :GraphStateNode) 137 | { 138 | var graph = this.state.graph; 139 | var i = this.getNodeIndex(viewNode); 140 | graph.nodes.splice(i, 1); 141 | 142 | // Delete any connected edges 143 | var newEdges = graph.edges.filter(function(edge) { 144 | return edge.source != viewNode.id && 145 | edge.target != viewNode.id; 146 | }); 147 | 148 | graph.edges = newEdges; 149 | 150 | this.setState({graph: graph, selected: {}}); 151 | } 152 | 153 | // Creates a new node between two edges 154 | public function onCreateEdge(sourceViewNode :GraphStateNode, targetViewNode :GraphStateNode) 155 | { 156 | trace('onCreateEdge'); 157 | var graph = this.state.graph; 158 | 159 | // This is just an example - any sort of logic 160 | // could be used here to determine edge type 161 | var type = sourceViewNode.type == SPECIAL_TYPE ? SPECIAL_EDGE_TYPE : EMPTY_EDGE_TYPE; 162 | 163 | var viewEdge = { 164 | source: sourceViewNode.id,//[NODE_KEY], 165 | target: targetViewNode.id,//[NODE_KEY], 166 | type: type 167 | }; 168 | graph.edges.push(viewEdge); 169 | this.setState({graph: graph}); 170 | } 171 | 172 | public function onSwapEdge(sourceViewNode :GraphStateNode, targetViewNode :GraphStateNode, viewEdge :GraphStateEdge) 173 | { 174 | var graph = this.state.graph; 175 | var i = this.getEdgeIndex(viewEdge); 176 | var edge = Json.parse(Json.stringify(graph.edges[i])); 177 | 178 | edge.source = sourceViewNode.id;//[NODE_KEY]; 179 | edge.target = targetViewNode.id;//[NODE_KEY]; 180 | graph.edges[i] = edge; 181 | 182 | this.setState({graph: graph}); 183 | } 184 | 185 | public function onDeleteEdge(edge :GraphStateEdge) 186 | { 187 | var graph = this.state.graph; 188 | var i = this.getEdgeIndex(edge); 189 | graph.edges.splice(i, 1); 190 | this.setState({graph: graph, selected: {}}); 191 | } 192 | 193 | // Helper to find the index of a given node 194 | function getNodeIndex(searchNode :GraphStateNode) :Int 195 | { 196 | var i = 0; 197 | while(i < this.state.graph.nodes.length) { 198 | var node = this.state.graph.nodes[i]; 199 | if (node.id == searchNode.id) { 200 | return i; 201 | } 202 | i++; 203 | } 204 | return -1; 205 | } 206 | 207 | // Helper to find the index of a given edge 208 | function getEdgeIndex(searchEdge :GraphStateEdge) :Int 209 | { 210 | var i = 0; 211 | while(i < this.state.graph.edges.length) { 212 | var edge = this.state.graph.edges[i]; 213 | if (edge.source == searchEdge.source && 214 | edge.target == searchEdge.target) { 215 | return i; 216 | } 217 | i++; 218 | } 219 | return -1; 220 | } 221 | 222 | static var EXAMPLE_STATE :GraphComponentState = { 223 | "graph": { 224 | "nodes": [ 225 | { 226 | "id": 1, 227 | "title": "Node A", 228 | "x": 258.3976135253906, 229 | "y": 331.9783248901367, 230 | "type": "empty" 231 | }, 232 | { 233 | "id": 2, 234 | "title": "Node B", 235 | "x": 593.9393920898438, 236 | "y": 260.6060791015625, 237 | "type": "empty" 238 | }, 239 | { 240 | "id": 3, 241 | "title": "Node C", 242 | "x": 237.5757598876953, 243 | "y": 61.81818389892578, 244 | "type": "empty" 245 | }, 246 | { 247 | "id": 4, 248 | "title": "Node C", 249 | "x": 600.5757598876953, 250 | "y": 600.81818389892578, 251 | "type": "empty" 252 | } 253 | ], 254 | "edges": [ 255 | { 256 | "source": 1, 257 | "target": 2, 258 | "type": "emptyEdge" 259 | }, 260 | { 261 | "source": 2, 262 | "target": 4, 263 | "type": "emptyEdge" 264 | } 265 | ] 266 | }, 267 | "selected": null 268 | }; 269 | 270 | static var EmptyShape = jsx(' 271 | 272 | 273 | 274 | '); 275 | 276 | static var SpecialShape = jsx(' 277 | 278 | 279 | 280 | '); 281 | 282 | static var SpecialChildShape = jsx(' 283 | 284 | 285 | '); 286 | 287 | static var EmptyEdgeShape = jsx(' 288 | 289 | 290 | 291 | '); 292 | 293 | static var SpecialEdgeShape = jsx(' 294 | 295 | 296 | 297 | '); 298 | 299 | 300 | // static var EmptyShape = jsx(' 301 | //
302 | // '); 303 | 304 | // static var SpecialShape = jsx(' 305 | //
306 | // '); 307 | 308 | // static var SpecialChildShape = jsx(' 309 | //
310 | // '); 311 | 312 | // static var EmptyEdgeShape = jsx(' 313 | //
314 | // '); 315 | 316 | // static var SpecialEdgeShape = jsx(' 317 | //
318 | // '); 319 | 320 | 321 | 322 | static var EXAMPLE_CONFIG :GraphConfig = 323 | { 324 | "NodeTypes": { 325 | "empty": { 326 | "typeText": "None", 327 | "shapeId": "#empty", 328 | "shape": EmptyShape 329 | }, 330 | "special": { 331 | "typeText": "Special", 332 | "shapeId": "#special", 333 | "shape": SpecialShape 334 | } 335 | }, 336 | "NodeSubtypes": { 337 | "specialChild": { 338 | "shapeId": "#specialChild", 339 | "shape": SpecialChildShape 340 | } 341 | }, 342 | "EdgeTypes": { 343 | "emptyEdge": { 344 | "shapeId": "#emptyEdge", 345 | "shape": EmptyEdgeShape 346 | }, 347 | "specialEdge": { 348 | "shapeId": "#specialEdge", 349 | "shape": SpecialEdgeShape 350 | } 351 | } 352 | }; 353 | } 354 | 355 | 356 | -------------------------------------------------------------------------------- /js/npm/digraph/GraphViewImplementation.hx: -------------------------------------------------------------------------------- 1 | package js.npm.digraph; 2 | 3 | import haxe.DynamicAccess; 4 | 5 | import react.ReactComponent; 6 | import react.ReactMacro.jsx; 7 | 8 | import js.npm.digraph.DiGraph; 9 | import js.npm.digraph.DiGraph.DiGraphConstants.*; 10 | import js.npm.digraph.GraphView; 11 | 12 | 13 | class GraphViewImplementation 14 | extends ReactComponentOfProps 15 | { 16 | public function new(props) 17 | { 18 | super(props); 19 | } 20 | 21 | override public function render() 22 | { 23 | var nodeKey = this.props.nodeKey; 24 | var emptyType = this.props.emptyType; 25 | var config = this.props.config; 26 | var ops = this.props.ops; 27 | 28 | var NodeTypes = config != null ? config.NodeTypes : null; 29 | var NodeSubtypes = config != null ? config.NodeSubtypes : null; 30 | var EdgeTypes = config != null ? config.EdgeTypes : null; 31 | 32 | var graphState :GraphComponentState = this.props.state != null ? this.props.state : {}; 33 | 34 | var nodes = graphState.graph != null && graphState.graph.nodes != null ? graphState.graph.nodes : []; 35 | var edges = graphState.graph != null && graphState.graph.edges != null ? graphState.graph.edges : []; 36 | var selected = graphState.selected != null ? graphState.selected : {}; 37 | 38 | return jsx(' 39 | 58 | '); 59 | } 60 | } -------------------------------------------------------------------------------- /js/npm/express/Express.hx: -------------------------------------------------------------------------------- 1 | package js.npm.express; 2 | 3 | /** 4 | * Global context class for expressjs features. 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:jsRequire("express") 8 | extern class Express 9 | { 10 | /** 11 | * Create an express application. 12 | */ 13 | @:deprecated("Use `new js.npm.express.Application()` instead") 14 | inline static public function GetApplication():Application { return new Application(); } 15 | 16 | /** 17 | * Create a new router by using "express.Router()" 18 | */ 19 | @:deprecated("Use `new js.npm.express.Router()` instead") 20 | inline static public function GetRouter(p_case_sensitive:Bool=false, p_strict : Bool=false):Router 21 | { 22 | var opt:Dynamic = { }; 23 | opt.caseSensitive = p_case_sensitive; 24 | opt.strict = p_strict; 25 | return new Router(opt); 26 | } 27 | 28 | @:native("static") 29 | static public function Static(root:String, ?options:{ 30 | ?dotfiles : String, 31 | ?etag : Bool, 32 | ?extensions : Bool, 33 | ?fallthrough : Bool, 34 | ?immutable : Bool, 35 | ?index : Dynamic, 36 | ?lastModified : Bool, 37 | ?maxAge : Int, 38 | ?redirect : Bool, 39 | ?setHeaders : Response -> String -> js.node.fs.Stats -> Void 40 | }):haxe.Constraints.Function; 41 | } -------------------------------------------------------------------------------- /js/npm/express/ExpressRequest.hx: -------------------------------------------------------------------------------- 1 | package js.npm.express; 2 | 3 | @:deprecated("Use js.npm.express.Request instead") 4 | typedef ExpressRequest = Request; -------------------------------------------------------------------------------- /js/npm/express/ExpressResponse.hx: -------------------------------------------------------------------------------- 1 | package js.npm.express; 2 | 3 | @:deprecated("Use js.npm.express.Response instead") 4 | typedef ExpressResponse = Response; -------------------------------------------------------------------------------- /js/npm/express/Path.hx: -------------------------------------------------------------------------------- 1 | package js.npm.express; 2 | 3 | import haxe.extern.EitherType; 4 | 5 | /* 6 | can be any of: 7 | A string representing a path. 8 | A path pattern. 9 | A regular expression pattern to match paths. 10 | An array of combinations of any of the above. 11 | */ 12 | typedef Path = EitherType, Array>; 13 | -------------------------------------------------------------------------------- /js/npm/express/Request.hx: -------------------------------------------------------------------------------- 1 | package js.npm.express; 2 | 3 | import haxe.extern.*; 4 | 5 | /** 6 | * http://expressjs.com/4x/api.html#req.params 7 | * @author Eduardo Pons - eduardo@thelaborat.org 8 | */ 9 | extern class Request extends js.node.http.IncomingMessage implements Dynamic 10 | { 11 | 12 | /** 13 | * This property is an object containing properties mapped to the named route "parameters". 14 | * For example if you have the route /user/:name, then the "name" property is available to you as req.params.name. 15 | * This object defaults to {}. 16 | */ 17 | var params : Dynamic; 18 | 19 | /** 20 | * This property is an object containing the parsed query-string, defaulting to {}. 21 | */ 22 | var query : Dynamic; 23 | 24 | /** 25 | * The currently matched Route containing several properties such as the route's original path string, the regexp generated, and so on. 26 | */ 27 | var route : Dynamic; 28 | 29 | /** 30 | * When the cookieParser() middleware is used this object defaults to {}, otherwise contains the cookies sent by the user-agent. 31 | */ 32 | var cookies : Dynamic; 33 | 34 | /** 35 | * When the cookieParser(secret) middleware is used this object defaults to {}, otherwise contains the signed cookies sent by the user-agent, unsigned and ready for use. Signed cookies reside in a different object to show developer intent, otherwise a malicious attack could be placed on `req.cookie` values which are easy to spoof. Note that signing a cookie does not mean it is "hidden" nor encrypted, this simply prevents tampering as the secret used to sign is private. 36 | */ 37 | var signedCookies : Dynamic; 38 | 39 | /** 40 | * Return the remote address, or when "trust proxy" is enabled - the upstream address. 41 | */ 42 | var ip : String; 43 | 44 | /** 45 | * When "trust proxy" is `true`, parse the "X-Forwarded-For" ip address list and return an array, otherwise an empty array is returned. 46 | * For example if the value were "client, proxy1, proxy2" you would receive the array ["client", "proxy1", "proxy2"] where "proxy2" is the furthest down-stream. 47 | */ 48 | var ips : Array; 49 | 50 | /** 51 | * Returns the request URL pathname. 52 | */ 53 | var path : String; 54 | 55 | /** 56 | * Returns the hostname from the "Host" header field (void of portno). 57 | */ 58 | var host : String; 59 | 60 | /** 61 | * Check if the request is fresh - aka Last-Modified and/or the ETag still match, indicating that the resource is "fresh". 62 | */ 63 | var fresh : Bool; 64 | 65 | /** 66 | * Check if the request is stale - aka Last-Modified and/or the ETag do not match, indicating that the resource is "stale". 67 | */ 68 | var stale : Bool; 69 | 70 | /** 71 | * Check if the request was issued with the "X-Requested-With" header field set to "XMLHttpRequest" (jQuery etc). 72 | */ 73 | var xhr : Bool; 74 | 75 | /** 76 | * Return the protocol string "http" or "https" when requested with TLS. When the "trust proxy" setting is enabled the "X-Forwarded-Proto" header field will be trusted. If you're running behind a reverse proxy that supplies https for you this may be enabled. 77 | */ 78 | var protocol : String; 79 | 80 | /** 81 | * Check if a TLS connection is established. This is a short-hand for: 'https' == req.protocol; 82 | */ 83 | var secure : Bool; 84 | 85 | /** 86 | * Return subdomains as an array. 87 | */ 88 | var subdomains : Array; 89 | 90 | /** 91 | * This property is much like req.url, however it retains the original request url, allowing you to rewrite req.url freely for internal routing purposes. 92 | * For example the "mounting" feature of app.use() will rewrite req.url to strip the mount point. 93 | */ 94 | var originalUrl : String; 95 | 96 | /** 97 | * Return the value of param name when present. 98 | * @param p_name 99 | * @return 100 | */ 101 | function param(p_name:String):String; 102 | 103 | /** 104 | * Get the case-insensitive request header field. The Referrer and Referer fields are interchangeable. 105 | * @param p_name 106 | * @return 107 | */ 108 | function get(p_name:String):String; 109 | 110 | /** 111 | * Check if the given types are acceptable, returning the best match when true, otherwise undefined - in which case you should respond with 406 "Not Acceptable". 112 | * The type value may be a single mime type string such as "application/json", the extension name such as "json", a comma-delimited list or an array. 113 | * When a list or array is given the best match, if any is returned. 114 | * @param p_method 115 | */ 116 | @:overload(function(p_methods:Array):EitherType{}) 117 | function accepts(p_method:String):EitherType; 118 | 119 | /** 120 | * Returns the first accepted charset of the specified character sets, based on the request’s Accept-Charset HTTP header field. If none of the specified charsets is accepted, returns false. 121 | */ 122 | function acceptsCharsets(charset:String, charsets:Rest):EitherType; 123 | 124 | /** 125 | * Returns the first accepted encoding of the specified encodings, based on the request’s Accept-Encoding HTTP header field. If none of the specified encodings is accepted, returns false. 126 | */ 127 | function acceptsEncodings(encoding:String, encodings:Rest):EitherType; 128 | 129 | /** 130 | * Returns the first accepted language of the specified languages, based on the request’s Accept-Language HTTP header field. If none of the specified languages is accepted, returns false. 131 | */ 132 | function acceptsLanguages(lang:String, langs:Rest):EitherType; 133 | 134 | /** 135 | * Check if the incoming request contains the "Content-Type" header field, and it matches the give mime type. 136 | * @param p_type 137 | * @return 138 | */ 139 | function is(p_type:String):Bool; 140 | 141 | } -------------------------------------------------------------------------------- /js/npm/express/Response.hx: -------------------------------------------------------------------------------- 1 | package js.npm.express; 2 | import haxe.Constraints; 3 | import haxe.extern.EitherType; 4 | #if (haxe_ver >= 4) 5 | import js.lib.Error; 6 | #else 7 | import js.Error; 8 | #end 9 | 10 | typedef CookieOptions = { 11 | @:optional var domain:String; 12 | @:optional var encode:Function; 13 | @:optional var expires:Dynamic; 14 | @:optional var httpOnly:Bool; 15 | @:optional var maxAge:Float; 16 | @:optional var path:String; 17 | @:optional var secure:Bool; 18 | @:optional var signed:Bool; 19 | @:optional var sameSite:EitherType; 20 | }; 21 | 22 | /** 23 | * http://expressjs.com/4x/api.html#res.status 24 | * @author Eduardo Pons - eduardo@thelaborat.org 25 | */ 26 | extern class Response extends js.node.http.ServerResponse implements Dynamic 27 | { 28 | 29 | /** 30 | * Response local variables are scoped to the request, thus only available to the view(s) rendered during that request / response cycle, if any. Otherwise this API is identical to app.locals. 31 | * This object is useful for exposing request-level information such as the request pathname, authenticated user, user settings etcetera. 32 | */ 33 | var locals : Dynamic; 34 | 35 | /** 36 | * Chainable alias of node's res.statusCode=. 37 | * @param p_code 38 | * @return 39 | */ 40 | function status(p_code:Int):Response; 41 | 42 | /** 43 | * Set header field to value, or pass an object to set multiple fields at once. 44 | * @param p_field 45 | * @param p_value 46 | */ 47 | @:overload(function(p_field:Dynamic):Void{}) 48 | function set(p_field:String, p_value:String):Void; 49 | 50 | /** 51 | * Get the case-insensitive response header field. 52 | * @param p_field 53 | * @return 54 | */ 55 | function get(p_field:String):String; 56 | 57 | 58 | /** 59 | * Set cookie name to value, which may be a string or object converted to JSON. 60 | * The path option defaults to "/". 61 | * The maxAge option is a convenience option for setting "expires" relative to the current time in milliseconds. 62 | */ 63 | function cookie(name:String, value:String, ?options:CookieOptions):Void; 64 | 65 | /** 66 | * Clear cookie name. The path option defaults to "/". 67 | */ 68 | function clearCookie(name:String, ?options:CookieOptions):Void; 69 | 70 | /** 71 | * Redirect to the given url with optional status code defaulting to 302 "Found". 72 | * @param p_status 73 | * @param p_url 74 | */ 75 | @:overload(function(p_url:String):Void { } ) 76 | function redirect(p_status:Int,p_url:String):Void; 77 | 78 | /** 79 | * Set the location header. 80 | * @param p_location 81 | */ 82 | function location(p_location:String):Void; 83 | 84 | /** 85 | * Send a response. 86 | * @param p_status 87 | * @param p_body 88 | */ 89 | @:overload(function(p_data:Dynamic):Void { } ) 90 | function send(p_body_or_status:Dynamic, p_body : Dynamic):Void; 91 | 92 | /** 93 | * Send a JSON response. 94 | * This method is identical to res.send() when an object or array is passed, however it may be used for explicit JSON conversion of non-objects (null, undefined, etc), though these are technically not valid JSON. 95 | * @param p_body_or_status 96 | * @param p_body 97 | */ 98 | @:overload(function(p_data:Dynamic):Void { } ) 99 | function json(p_body_or_status:Dynamic, p_body : Dynamic):Void; 100 | 101 | /** 102 | * Send a JSON response with JSONP support. This method is identical to res.json() however opts - in to JSONP callback support. 103 | * @param p_body_or_status 104 | * @param p_body 105 | */ 106 | @:overload(function(p_data:Dynamic):Void { } ) 107 | function jsonp(p_body_or_status:Dynamic, p_body : Dynamic):Void; 108 | 109 | 110 | /** 111 | * Sets the Content-Type to the mime lookup of type, or when "/" is present the Content-Type is simply set to this literal value. 112 | * @param p_type 113 | */ 114 | function type(p_type:String):Void; 115 | 116 | /** 117 | * Performs content-negotiation on the request Accept header field when present. This method uses req.accepted, an array of acceptable types ordered by their quality values, otherwise the first callback is invoked. When no match is performed the server responds with 406 "Not Acceptable", or invokes the default callback. 118 | * The Content-Type is set for you when a callback is selected, however you may alter this within the callback using res.set() or res.type() etcetera. 119 | * @param p_object 120 | */ 121 | function format(p_object : Dynamic):Void; 122 | 123 | 124 | /** 125 | * Sets the Content-Disposition header field to "attachment". If a filename is given then the Content-Type will be automatically set based on the extname via res.type(), and the Content-Disposition's "filename=" parameter will be set. 126 | * @param p_filename 127 | */ 128 | @:overload(function():Void{}) 129 | function attachment(p_filename:String):Void; 130 | 131 | /** 132 | * Transfer the file at the given path. 133 | * Automatically defaults the Content-Type response header field based on the filename's extension. 134 | * The callback fn(err) is invoked when the transfer is complete or when an error occurs. 135 | * @param p_path 136 | * @param p_options 137 | * @param p_fn 138 | */ 139 | @:overload(function(p_path:String):Void{}) 140 | @:overload(function(p_path:String,p_options:Dynamic):Void{}) 141 | function sendfile(p_path:String, p_options:Dynamic, p_fn: Error -> Void):Void; 142 | 143 | /** 144 | * Transfer the file at path as an "attachment", typically browsers will prompt the user for download. 145 | * The Content-Disposition "filename=" parameter, aka the one that will appear in the brower dialog is set to path by default, however you may provide an override filename. 146 | * When an error has ocurred or transfer is complete the optional callback fn is invoked. 147 | * This method uses res.sendfile() to transfer the file. 148 | * @param p_path 149 | * @param p_options 150 | * @param p_fn 151 | */ 152 | @:overload(function(p_path:String):Void{}) 153 | @:overload(function(p_path:String,p_options:Dynamic):Void{}) 154 | function download(p_path:String, p_options:Dynamic, p_fn: Error -> Void):Void; 155 | 156 | 157 | /** 158 | * Join the given links to populate the "Link" response header field. 159 | * @param p_links 160 | */ 161 | function links(p_links:Dynamic):Void; 162 | 163 | /** 164 | * Render a view with a callback responding with the rendered string. When an error occurs next(err) is invoked internally. When a callback is provided both the possible error and rendered string are passed, and no automated response is performed. 165 | */ 166 | function render(view:String, ?locals:Dynamic, ?callback:Function):Void; 167 | } -------------------------------------------------------------------------------- /js/npm/express/Router.hx: -------------------------------------------------------------------------------- 1 | package js.npm.express; 2 | import haxe.ds.StringMap; 3 | 4 | /** 5 | * A router is an isolated instance of middleware and routes. Routers can be thought of as "mini" applications only capable of performing middleware and routing. Every express application has a builtin app router. 6 | * Routers behave like middleware themselves and can be ".use()'d" by the app or in other routers. 7 | * Create a new router by using "express.Router()" 8 | * @author Eduardo Pons - eduardo@thelaborat.org 9 | */ 10 | @:jsRequire("express", "Router") 11 | extern class Router 12 | { 13 | function new(?options:Dynamic):Void; 14 | 15 | /** 16 | * Use the given middleware function, with optional mount path, defaulting to "/". 17 | * Middleware is like a plumbing pipe, requests start at the first middleware you define and work their way "down" the middleware stack processing for each path they match. 18 | * @param p_path 19 | * @param p_function 20 | */ 21 | @:overload(function(p_function:Dynamic):Void{}) 22 | function use(p_path:Path, p_function:Dynamic):Void; 23 | 24 | 25 | /** 26 | * Map logic to route parameters. For example when :user is present in a route path you may map user loading logic to automatically provide req.user to the route, or perform validations on the parameter input. 27 | * The following snippet illustrates how the callback is much like middleware, thus supporting async operations, however providing the additional value of the parameter, here named as id. An attempt to load the user is then performed, assigning req.user, otherwise passing an error to next(err). 28 | * It is important to realize that any route that triggered a named parameter function to run will only be run if next was not called with an error in the named parameter handler. 29 | * @param p_name 30 | * @param p_function 31 | */ 32 | @:overload(function(p_callback:Dynamic):Void{}) 33 | function param(p_name:String, p_callback:Dynamic):Void; 34 | 35 | /** 36 | * Returns an instance of a single route which can then be used to handle HTTP verbs with optional middleware. 37 | * Using router.route() is a recommended approach to avoiding duplicate route naming and thus typo errors. 38 | * Building on the router.param() example from before, we see how router.route() allows us to easily specify the various HTTP verb handlers. 39 | * @param p_path 40 | */ 41 | function route(p_path:Path):Dynamic; 42 | 43 | 44 | /** 45 | * The app.VERB() methods provide the routing functionality in Express, where VERB is one of the HTTP verbs, such as app.post(). 46 | * Multiple callbacks may be given, all are treated equally, and behave just like middleware, with the one exception that these callbacks may invoke next('route') 47 | * to bypass the remaining route callback(s). This mechanism can be used to perform pre-conditions on a route then pass control to subsequent routes when there is 48 | * no reason to proceed with the route matched. 49 | * @param p_path 50 | * @param p_cb0 51 | * @param p_cb1 52 | * @param p_cb2 53 | * @param p_cb3 54 | */ 55 | function get(p_path:Path, p_cb0 : Dynamic, ?p_cb1 : Dynamic, ?p_cb2 : Dynamic, ?p_cb3 : Dynamic):Void; 56 | 57 | /** 58 | * The app.VERB() methods provide the routing functionality in Express, where VERB is one of the HTTP verbs, such as app.post(). 59 | * Multiple callbacks may be given, all are treated equally, and behave just like middleware, with the one exception that these callbacks may invoke next('route') 60 | * to bypass the remaining route callback(s). This mechanism can be used to perform pre-conditions on a route then pass control to subsequent routes when there is 61 | * no reason to proceed with the route matched. 62 | * @param p_path 63 | * @param p_cb0 64 | * @param p_cb1 65 | * @param p_cb2 66 | * @param p_cb3 67 | */ 68 | function post(p_path:Path, ?p_cb0 : Dynamic, ?p_cb1 : Dynamic, ?p_cb2 : Dynamic, ?p_cb3 : Dynamic):Void; 69 | 70 | /** 71 | * The app.VERB() methods provide the routing functionality in Express, where VERB is one of the HTTP verbs, such as app.post(). 72 | * Multiple callbacks may be given, all are treated equally, and behave just like middleware, with the one exception that these callbacks may invoke next('route') 73 | * to bypass the remaining route callback(s). This mechanism can be used to perform pre-conditions on a route then pass control to subsequent routes when there is 74 | * no reason to proceed with the route matched. 75 | * @param p_path 76 | * @param p_cb0 77 | * @param p_cb1 78 | * @param p_cb2 79 | * @param p_cb3 80 | */ 81 | function put(p_path:Path, ?p_cb0 : Dynamic, ?p_cb1 : Dynamic, ?p_cb2 : Dynamic, ?p_cb3 : Dynamic):Void; 82 | 83 | /** 84 | * The app.VERB() methods provide the routing functionality in Express, where VERB is one of the HTTP verbs, such as app.post(). 85 | * Multiple callbacks may be given, all are treated equally, and behave just like middleware, with the one exception that these callbacks may invoke next('route') 86 | * to bypass the remaining route callback(s). This mechanism can be used to perform pre-conditions on a route then pass control to subsequent routes when there is 87 | * no reason to proceed with the route matched. 88 | * @param p_path 89 | * @param p_cb0 90 | * @param p_cb1 91 | * @param p_cb2 92 | * @param p_cb3 93 | */ 94 | function delete(p_path:Path, ?p_cb0 : Dynamic, ?p_cb1 : Dynamic, ?p_cb2 : Dynamic, ?p_cb3 : Dynamic):Void; 95 | 96 | } -------------------------------------------------------------------------------- /js/npm/fetch/Fetch.hx: -------------------------------------------------------------------------------- 1 | package js.npm.fetch; 2 | 3 | import haxe.extern.EitherType; 4 | 5 | #if (haxe_ver >= 4) 6 | import js.lib.Promise; 7 | #else 8 | import js.Promise; 9 | #end 10 | 11 | @:enum 12 | abstract RedirectOption(String) { 13 | var Follow = 'follow'; 14 | var Manual = 'manual'; 15 | var Error = 'error'; 16 | } 17 | 18 | typedef FetchOptions = { 19 | @:optional var method :String; 20 | #if nodejs 21 | @:optional var body :EitherType; 22 | #else 23 | @:optional var body :EitherType; 24 | #end 25 | @:optional var headers :Dynamic; 26 | @:optional var redirect :RedirectOption; 27 | @:optional var follow :Int; 28 | @:optional var timeout :Int; 29 | @:optional var compress :Bool; 30 | @:optional var size :Int; 31 | @:optional var agent :Dynamic; 32 | } 33 | 34 | #if nodejs 35 | @:jsRequire("node-fetch") 36 | #else 37 | @:jsRequire("whatwg-fetch") 38 | #end 39 | extern class Fetch 40 | { 41 | @:selfCall 42 | public static function fetch(url :String, ?options :FetchOptions) :Promise; 43 | } 44 | 45 | extern class FetchResponse 46 | { 47 | var type(default,null) : String; 48 | var url(default,null) : String; 49 | var redirected(default,null) : Bool; 50 | var status(default,null) : Int; 51 | var ok(default,null) : Bool; 52 | var statusText(default,null) : String; 53 | 54 | public function json() :Promise; 55 | public function text() :Promise; 56 | #if nodejs 57 | public function buffer() :Promise; 58 | public var body :js.node.stream.Readable.IReadable; 59 | #else 60 | public var bodyUsed :Bool; 61 | public function blob() :Promise; 62 | public function arrayBuffer() :Promise; 63 | public function formData() :Promise; 64 | #end 65 | } -------------------------------------------------------------------------------- /js/npm/filenamify/Filenamify.hx: -------------------------------------------------------------------------------- 1 | package js.npm.filenamify; 2 | 3 | /** 4 | * https://www.npmjs.com/package/filenamify 5 | */ 6 | 7 | @:jsRequire("filenamify") 8 | extern class Filenamify 9 | { 10 | @:selfCall 11 | public static function filenamify(s :String, ?opts :{replacement:String}) :String; 12 | } 13 | -------------------------------------------------------------------------------- /js/npm/fluentlogger/FluentLogger.hx: -------------------------------------------------------------------------------- 1 | package js.npm.fluentlogger; 2 | 3 | /** 4 | * https://www.npmjs.com/package/fluent-logger 5 | */ 6 | 7 | import js.Node; 8 | import js.Error; 9 | import haxe.extern.EitherType; 10 | 11 | typedef FluentConfigureOpts = { 12 | @:optional var host :String; 13 | @:optional var port :Int; 14 | @:optional var timeout :Float; 15 | @:optional var reconnectInterval :Float; 16 | @:optional var path :String; 17 | } 18 | 19 | @:jsRequire("fluent-logger") 20 | extern class FluentLogger 21 | { 22 | public static function createFluentSender(tag :String, opts :FluentConfigureOpts) :FluentLogger; 23 | 24 | @:overload(function(record :Dynamic, ?time :EitherType, ?cb :Void->Void) :Void {}) 25 | public function emit(label :String, record :Dynamic, ?time :EitherType, ?cb :Void->Void) :Void; 26 | } 27 | -------------------------------------------------------------------------------- /js/npm/formidable/Formidable.hx: -------------------------------------------------------------------------------- 1 | package js.npm.formidable; 2 | /** 3 | * https://github.com/felixge/node-formidable 4 | */ 5 | import js.node.http.*; 6 | import js.node.events.EventEmitter; 7 | import js.Error; 8 | 9 | typedef Fields=Array; 10 | 11 | @:jsRequire('formidable') 12 | extern class Formidable {} 13 | 14 | /** 15 | Enumeration of events emitted by the `IncomingForm` objects 16 | **/ 17 | @:enum abstract IncomingFormEvent(Event) to Event { 18 | var Progress : IncomingFormEventInt->Void> = "progress"; 19 | var Field : IncomingFormEventString->Void> = "field"; 20 | var FileBegin : IncomingFormEventString->Void> = "fileBegin"; 21 | var File : IncomingFormEventFormidableFile->Void> = "file"; 22 | var Error : IncomingFormEventVoid> = "error"; 23 | var Aborted : IncomingFormEventVoid> = "aborted"; 24 | var End : IncomingFormEventVoid> = "end"; 25 | } 26 | 27 | @:jsRequire('formidable', 'IncomingForm') 28 | extern class IncomingForm extends EventEmitter 29 | { 30 | public var encoding :String; 31 | public var uploadDir :String; 32 | public var keepExtensions :Bool; 33 | public var type :String; 34 | public var maxFieldsSize :Float; 35 | public var maxFields :Int; 36 | public var hash :haxe.extern.EitherType; 37 | public var multiples :Bool; 38 | public var bytesReceived :Int; 39 | public var bytesExpected :Int; 40 | public var onPart :js.node.events.EventEmitter->Void; 41 | 42 | public function parse(req :IncomingMessage, ?cb :Error->Fields->Array->Void) :Void; 43 | } 44 | 45 | extern class FormidableFile 46 | { 47 | public var size :Int; 48 | public var path :String; 49 | public var name :String; 50 | public var type :String; 51 | public var lastModifiedDate :Dynamic; 52 | public var hash :String; 53 | public function toJson() :Dynamic; 54 | } 55 | -------------------------------------------------------------------------------- /js/npm/fsextended/FsExtended.hx: -------------------------------------------------------------------------------- 1 | package js.npm.fsextended; 2 | 3 | import js.node.fs.FSWatcher; 4 | import js.node.fs.Stats; 5 | import js.node.Buffer; 6 | import js.node.stream.Readable; 7 | import js.node.stream.Writable; 8 | import js.Node; 9 | import haxe.extern.EitherType; 10 | import js.Error; 11 | 12 | typedef Callback0 = Null -> Void; 13 | 14 | typedef Callback1 = Null -> Null -> Void; 15 | 16 | typedef Callback2 = Null -> Null -> Null -> Void; 17 | 18 | typedef Callback = Callback1; 19 | 20 | typedef SearchOptions = { 21 | @:optional var recursive :Bool; 22 | @:optional var prependDir :Bool; 23 | @:optional var filter :String->Stats->Bool; 24 | @:optional var map :Dynamic; 25 | @:optional var sort :Dynamic; 26 | } 27 | 28 | @:jsRequire('fs-extended') 29 | extern class FsExtended 30 | { 31 | public static function createDir(dir :String, ?mode :Dynamic, cb :Null->Void) :Void; 32 | public static function createDirSync(dir :String, ?mode :Dynamic) :Void; 33 | public static function ensureDir(dir :String, ?mode :Dynamic, cb :Null->Void) :Void; 34 | public static function ensureDirSync(dir :String, ?mode :Dynamic) :Void; 35 | 36 | public static function copyDir(sourceDir :String, targetDir :String, cb :Null->Void) :Void; 37 | public static function copyDirSync(sourceDir :String, targetDir :String) :Void; 38 | 39 | public static function copyFile(source :String, target :String, cb :Null->Void) :Void; 40 | public static function copyFileSync(source :String, target :String) :Void; 41 | 42 | public static function deleteDir(dir :String, cb :Null->Void) :Void; 43 | public static function deleteDirSync(dir :String) :Void; 44 | 45 | public static function deleteFile(file :String, cb :Null->Void) :Void; 46 | public static function deleteFileSync(file :String) :Void; 47 | 48 | public static function listFilesSync(dir :String, ?option :SearchOptions) :Array; 49 | public static function listFiles(dir :String, ?option :SearchOptions, cb :Null->Null>->Void) :Void; 50 | public static function listDirs(dir :String, ?option :SearchOptions, cb :Null->Null>->Void) :Void; 51 | public static function listDirsSync(dir :String, ?option :SearchOptions) :Array; 52 | public static function listAll(dir :String, ?option :SearchOptions, cb :Null->Null>->Void) :Void; 53 | public static function listAllSync(dir :String, ?option :SearchOptions) :Array; 54 | 55 | /* 56 | * Bulk copy/pasted from Fs.hx 57 | */ 58 | static function rename(from:String,to:String,cb:Callback0):Void; 59 | static function renameSync(from:String,to:String):Void; 60 | 61 | static function stat(path:String,cb:Callback):Void; 62 | static function statSync(path:String):Stats; 63 | 64 | static function lstat(path:Dynamic,cb:Callback):Void; 65 | static function lstatSync(path:String):Stats; 66 | 67 | static function fstat(fd:Int,cb:Callback):Void; 68 | static function fstatSync(fd:Int):Stats; 69 | 70 | static function link(srcPath:String,dstPath:String,cb:Callback0):Void; 71 | static function linkSync(srcPath:String,dstPath:String):Void; 72 | 73 | static function unlink(path:String,cb:Callback0):Void; 74 | static function unlinkSync(path:String):Void; 75 | 76 | @:overload(function(linkData:Dynamic,path:String,type:String,?cb:Callback0):Void {}) 77 | static function symlink(linkData:Dynamic,path:String,?cb:Callback0):Void; 78 | static function symlinkSync(linkData:Dynamic,path:String,?type:String):Void; 79 | 80 | static function readlink(path:String,cb:Callback):Void; 81 | static function readlinkSync(path:String):String; 82 | 83 | static function realpath(path:String,cb:Callback):Void; 84 | static function realpathSync(path:String):String; 85 | 86 | static function chmod(path:String,mode:Int,cb:Callback0):Void; 87 | static function chmodSync(path:String,?mode:Int):Void; 88 | 89 | static function fchmod(fd:Int,mode:Int,cb:Callback0):Void; 90 | static function fchmodSync(fd:Int,?mode:Int):Void; 91 | 92 | static function chown(path:String,uid:Int,gid:Int,cb:Callback0):Void ; 93 | static function chownSync(path:String,uid:Int,gid:Int):Void; 94 | 95 | static function fchown(fd:Int,uid:Int,gid:Int,cb:Callback0):Void ; 96 | static function fchownSync(fd:Int,uid:Int,gid:Int):Void; 97 | 98 | static function rmdir(path:String,cb:Callback0):Void; 99 | static function rmdirSync(path:String):Void; 100 | 101 | @:overload(function(path:String,mode:Int,?cb:Callback0):Void {}) 102 | static function mkdir(path:String,?cb:Callback0):Void; 103 | static function mkdirSync(path:String,?mode:Int):Void; 104 | 105 | static function readdir(path:String,cb:Callback>):Void; 106 | static function readdirSync(path:String):Array; 107 | 108 | static function close(fd:Int,cb:Callback0):Void; 109 | static function closeSync(fd:Int):Void; 110 | 111 | @:overload(function (path:String,flags:String,mode:Int,cb:Callback):Void {} ) 112 | static function open(path:String,flags:String,cb:Callback):Void; 113 | 114 | static function openSync(path:String,flags:String,?mode:Int):Int; 115 | 116 | static function write(fd:Int,bufOrStr:EitherType,offset:Int,length:Int,position:Null,?cb:Callback):Void; 117 | 118 | @:overload(function(fd:Int,bufOrStr:EitherType):Int {}) 119 | @:overload(function(fd:Int,bufOrStr:EitherType,position:Null):Int {}) 120 | static function writeSync(fd:Int,bufOrStr:EitherType,position:Null,encoding:String):Int; 121 | 122 | static function read(fd:Int,buffer:Buffer,offset:Int,length:Int,position:Int,cb:Callback2):Void; 123 | static function readSync(fd:Int,buffer:Buffer,offset:Int,length:Int,position:Int):Int; 124 | 125 | static function truncate(fd:Int,len:Int,cb:Callback0):Void; 126 | static function truncateSync(fd:Int,len:Int):Error; 127 | 128 | @:overload(function(path:String,options:FsReadFileOpt,cb:Callback):Void {}) 129 | @:overload(function(path:String,options:FsReadFileOpt,cb:Callback):Void {}) 130 | static function readFile(path:String,cb:Callback):Void; 131 | @:overload(function(path:String,options:FsReadFileOpt):String {}) 132 | static function readFileSync(path:String):Buffer; 133 | 134 | @:overload(function(fileName:String,data:EitherType):Void {}) 135 | @:overload(function(fileName:String,data:EitherType,options:FsWriteFileOpt):Void {}) 136 | static function writeFile(fileName:String,data:EitherType,options:FsWriteFileOpt,cb:Callback0):Void; 137 | @:overload(function(fileName:String,data:Buffer,options:FsWriteFileOpt):Void {}) 138 | @:overload(function(fileName:String,data:Buffer):Void {}) 139 | @:overload(function(fileName:String,contents:String,options:FsWriteFileOpt):Void {}) 140 | static function writeFileSync(fileName:String,contents:String):Void; 141 | 142 | @:overload(function(fileName:String,data:EitherType,cb:Callback0):Void {}) 143 | static function appendFile(fileName:String,data:EitherType,options:FsWriteFileOpt,cb:Callback0):Void; 144 | @:overload(function(fileName:String,data:EitherType):Void {}) 145 | static function appendFileSync(fileName:String,data:EitherType,options:FsWriteFileOpt):Void; 146 | 147 | static function utimes(path:String,atime:Dynamic,mtime:Dynamic,cb:Callback0):Void; 148 | static function utimeSync(path:String,atime:Dynamic,mtime:Dynamic):Void; 149 | 150 | static function futimes(fd:Int,atime:Dynamic,mtime:Dynamic,cb:Callback0):Void; 151 | static function futimeSync(fd:Int,atime:Dynamic,mtime:Dynamic):Void; 152 | 153 | static function fsync(fd:Int,cb:Callback0):Void; 154 | static function fsyncSync(fd:Int):Void; 155 | 156 | static function watchFile(fileName:String,?options:FsWatchOpt,listener:Stats->Stats->Void):Void; 157 | static function unwatchFile(fileName:String):Void; 158 | static function watch(fileName:String,?options:FsWatchOpt,listener:String->String->Void):FSWatcher; 159 | static function createReadStream(path:String,?options:FsReadStreamOpt):IReadable; 160 | static function createWriteStream(path:String,?options:FsWriteStreamOpt):IWritable; 161 | 162 | static function exists(p:String,cb:Bool->Void):Void; 163 | static function existsSync(p:String):Bool; 164 | } 165 | 166 | typedef FsReadStreamOpt = { 167 | flags:String, 168 | encoding:String, 169 | fd:Null, 170 | mode:Int, 171 | bufferSize:Int, 172 | ?start:Int, 173 | ?end:Int 174 | } 175 | 176 | typedef FsReadFileOpt = { 177 | ?encoding : String, 178 | ?flag : String 179 | } 180 | 181 | typedef FsWriteFileOpt = { 182 | ?encoding : String, 183 | ?mode : Int, 184 | ?flag : String 185 | } 186 | 187 | typedef FsWriteStreamOpt = { 188 | var flags:String; 189 | var encoding:String; 190 | var mode:Int; 191 | @:optional var fd:Int; 192 | } 193 | 194 | typedef FsWatchOpt = {persistent:Bool,interval:Int}; -------------------------------------------------------------------------------- /js/npm/history/History.hx: -------------------------------------------------------------------------------- 1 | package js.npm.history; 2 | 3 | 4 | @:enum 5 | abstract HistoryAction(String) { 6 | var PUSH = 'PUSH'; 7 | var REPLACE = 'REPLACE'; 8 | var POP = 'POP'; 9 | } 10 | 11 | typedef HistoryLocation = { 12 | var path :String; 13 | var search :String; 14 | var hash :String; 15 | @:optional var state :Dynamic; 16 | @:optional var key :String; 17 | }; 18 | typedef Unlistener=Void->Void; 19 | 20 | typedef BrowserHistoryOpts = { 21 | var basename :HistoryLocation; 22 | @:optional var forceRefresh :Bool; 23 | @:optional var keyLength :Int; 24 | } 25 | 26 | typedef MemoryHistoryOpts = Dynamic; 27 | typedef HashHistoryOpts = Dynamic; 28 | 29 | @:jsRequire('history') 30 | extern class History 31 | { 32 | public static function createBrowserHistory(?opts :BrowserHistoryOpts) :HistoryObject; 33 | public static function createMemoryHistory(?opts :MemoryHistoryOpts) :HistoryObject; 34 | public static function createHashHistory(?opts :HashHistoryOpts) :HistoryObject; 35 | } 36 | 37 | extern class HistoryObject 38 | { 39 | public var location :HistoryLocation; 40 | public var length :Int; 41 | public var action :Int; 42 | 43 | public function listen(cb :HistoryLocation->HistoryAction->Void) :Unlistener; 44 | 45 | public function push(location :String, state :Dynamic) :Void; 46 | public function replace(location :String, state :Dynamic) :Void; 47 | public function go(count :Int) :Void; 48 | public function goBack() :Void; 49 | public function goForward() :Void; 50 | public function canGo(count :Int) :Bool; 51 | 52 | public function block(message :String) :Void->Void; 53 | } 54 | -------------------------------------------------------------------------------- /js/npm/httpproxy/HttpProxy.hx: -------------------------------------------------------------------------------- 1 | package js.npm.httpproxy; 2 | 3 | import js.node.http.*; 4 | 5 | typedef ProxyServerOptions = { 6 | @:optional var target :String; 7 | @:optional var ssl :{key :String, cert :String}; 8 | @:optional var secure :Bool; 9 | @:optional var ws :Bool; 10 | @:optional var forward :String; 11 | @:optional var agent :Dynamic; 12 | @:optional var xfwd :Bool; 13 | @:optional var toProxy :String; 14 | @:optional var hostRewrite :Bool; 15 | @:optional var autoRewrite :Bool; 16 | @:optional var changeOrigin :Bool; 17 | @:optional var localAddress :String; 18 | @:optional var ignorePath :Bool; 19 | @:optional var prependPath :Bool; 20 | @:optional var proxyTimeout :Int; 21 | } 22 | 23 | @:jsRequire('http-proxy') 24 | extern class HttpProxy extends js.node.events.EventEmitter 25 | { 26 | public static function createProxyServer(?options :ProxyServerOptions) :Proxy; 27 | } 28 | 29 | extern class Proxy extends js.node.events.EventEmitter 30 | { 31 | public function close(?cb :Void->Void) :Void; 32 | public function listen(port :Int) :Void; 33 | public function web(req :IncomingMessage, res:ServerResponse, ?options :Dynamic) :Void; 34 | } 35 | -------------------------------------------------------------------------------- /js/npm/jwtdecode/JWTDecode.hx: -------------------------------------------------------------------------------- 1 | package js.npm.jwtdecode; 2 | 3 | @:jsRequire('jwt-decode') 4 | extern class JWTDecode 5 | { 6 | @:selfCall 7 | public static function decode(jwtToken :String) :T; 8 | } -------------------------------------------------------------------------------- /js/npm/long/Long.hx: -------------------------------------------------------------------------------- 1 | package js.npm.long; 2 | 3 | @:jsRequire('long') 4 | extern class Long 5 | { 6 | public static var MAX_UNSIGNED_VALUE :Long; 7 | public static var MAX_VALUE :Long; 8 | public static var MIN_VALUE :Long; 9 | public static var NEG_ONE :Long; 10 | public static var ONE :Long; 11 | public static var UONE :Long; 12 | public static var UZERO :Long; 13 | public static var ZERO :Long; 14 | 15 | public static function fromBits (low :Int, high :Int, ?unsigned :Bool=false) :Long; 16 | public static function fromInt (low :Int, ?unsigned :Bool=false) :Long; 17 | public static function fromNumber (low :Float, ?unsigned :Bool=false) :Long; 18 | public static function fromString (s :String, ?unsigned :Bool=false, ?radix :Int=10) :Long; 19 | public static function isLong (obj :Dynamic) :Bool; 20 | //TODO: Many more instance methods 21 | 22 | public function new(low :Int, high :Int, ?unsigned :Bool=false) : Void; 23 | 24 | public function toString() :String; 25 | } -------------------------------------------------------------------------------- /js/npm/materialui/MaterialUI.hx: -------------------------------------------------------------------------------- 1 | package js.npm.materialui; 2 | 3 | @:jsRequire('material-ui','AppBar') 4 | extern class AppBar extends react.ReactComponent { } 5 | 6 | @:jsRequire('material-ui','Avatar') 7 | extern class Avatar extends react.ReactComponent { } 8 | 9 | @:jsRequire('material-ui','AutoComplete') 10 | extern class AutoComplete extends react.ReactComponent { } 11 | 12 | @:jsRequire('material-ui','BottomNavigation') 13 | extern class BottomNavigation extends react.ReactComponent { } 14 | 15 | @:jsRequire('material-ui','BottomNavigationItem') 16 | extern class BottomNavigationItem extends react.ReactComponent { } 17 | 18 | @:jsRequire('material-ui','Button') 19 | extern class Button extends react.ReactComponent { } 20 | 21 | @:jsRequire('material-ui','Card') 22 | extern class Card extends react.ReactComponent { } 23 | 24 | @:jsRequire('material-ui','CardTitle') 25 | extern class CardTitle extends react.ReactComponent { } 26 | 27 | @:jsRequire('material-ui','CardMedia') 28 | extern class CardMedia extends react.ReactComponent { } 29 | 30 | @:jsRequire('material-ui','CardHeader') 31 | extern class CardHeader extends react.ReactComponent { } 32 | 33 | @:jsRequire('material-ui','Chip') 34 | extern class Chip extends react.ReactComponent { } 35 | 36 | @:jsRequire('material-ui/Progress', 'CircularProgress') 37 | extern class CircularProgress extends react.ReactComponent { } 38 | 39 | @:jsRequire('material-ui','CloseIcon') 40 | extern class CloseIcon extends react.ReactComponent { } 41 | 42 | @:jsRequire('material-ui','Dialog') 43 | extern class Dialog extends react.ReactComponent { } 44 | 45 | @:jsRequire('material-ui','Divider') 46 | extern class Divider extends react.ReactComponent { } 47 | 48 | @:jsRequire('material-ui','FlatButton') 49 | extern class FlatButton extends react.ReactComponent { } 50 | 51 | @:jsRequire('material-ui','FontIcon') 52 | extern class FontIcon extends react.ReactComponent { } 53 | 54 | @:jsRequire('material-ui','GridList') 55 | extern class GridList extends react.ReactComponent { } 56 | 57 | @:jsRequire('material-ui','GridTile') 58 | extern class GridTile extends react.ReactComponent { } 59 | 60 | @:jsRequire('material-ui','Icon') 61 | extern class Icon extends react.ReactComponent { } 62 | 63 | @:jsRequire('material-ui','IconButton') 64 | extern class IconButton extends react.ReactComponent { } 65 | 66 | @:jsRequire('material-ui','IconMenu') 67 | extern class IconMenu extends react.ReactComponent { } 68 | 69 | @:jsRequire('material-ui','LinearProgress') 70 | extern class LinearProgress extends react.ReactComponent { } 71 | 72 | @:jsRequire('material-ui','List') 73 | extern class List extends react.ReactComponent { } 74 | 75 | @:jsRequire('material-ui','ListItem') 76 | extern class ListItem extends react.ReactComponent { } 77 | 78 | @:jsRequire('material-ui','MenuItem') 79 | extern class MenuItem extends react.ReactComponent { } 80 | 81 | @:jsRequire('material-ui','MuiThemeProvider') 82 | extern class MuiThemeProvider extends react.ReactComponent { } 83 | 84 | @:jsRequire('material-ui','Paper') 85 | extern class Paper extends react.ReactComponent { } 86 | 87 | @:jsRequire('material-ui','RadioButton') 88 | extern class RadioButton extends react.ReactComponent { } 89 | 90 | @:jsRequire('material-ui','RadioButtonGroup') 91 | extern class RadioButtonGroup extends react.ReactComponent { } 92 | 93 | @:jsRequire('material-ui','RaisedButton') 94 | extern class RaisedButton extends react.ReactComponent { } 95 | 96 | @:jsRequire('material-ui','Table') 97 | extern class Table extends react.ReactComponent { } 98 | 99 | @:jsRequire('material-ui','TableFooter') 100 | extern class TableFooter extends react.ReactComponent { } 101 | 102 | @:jsRequire('material-ui','TableRowColumn') 103 | extern class TableRowColumn extends react.ReactComponent { } 104 | 105 | @:jsRequire('material-ui','TableHeader') 106 | extern class TableHeader extends react.ReactComponent { } 107 | 108 | @:jsRequire('material-ui','TableHeaderColumn') 109 | extern class TableHeaderColumn extends react.ReactComponent { } 110 | 111 | @:jsRequire('material-ui','TableRow') 112 | extern class TableRow extends react.ReactComponent { } 113 | 114 | @:jsRequire('material-ui','TableBody') 115 | extern class TableBody extends react.ReactComponent { } 116 | 117 | @:jsRequire('material-ui','TextField') 118 | extern class TextField extends react.ReactComponent { } 119 | 120 | @:jsRequire('material-ui','Toggle') 121 | extern class Toggle extends react.ReactComponent { } 122 | 123 | @:jsRequire('material-ui','Toolbar') 124 | extern class Toolbar extends react.ReactComponent { } 125 | 126 | @:jsRequire('material-ui','ToolbarGroup') 127 | extern class ToolbarGroup extends react.ReactComponent { } 128 | 129 | @:jsRequire('material-ui','ToolbarTitle') 130 | extern class ToolbarTitle extends react.ReactComponent { } 131 | 132 | //Icons (material-ui-icons) 133 | 134 | @:jsRequire('material-ui-icons', 'ModeEdit') 135 | extern class ModeEditIcon extends react.ReactComponent { } 136 | -------------------------------------------------------------------------------- /js/npm/materialui/MaterialUINext.hx: -------------------------------------------------------------------------------- 1 | package js.npm.materialui; 2 | 3 | /** 4 | * Incomplete 5 | */ 6 | 7 | @:jsRequire('material-ui/styles/withTheme', 'default') 8 | class StylesWithTheme 9 | { 10 | @:selfCall 11 | public static var call :Dynamic; 12 | } 13 | 14 | @:jsRequire('material-ui/styles/createMuiTheme', 'default') 15 | class StylesCreateMuiTheme 16 | { 17 | @:selfCall 18 | public static var call :Dynamic; 19 | } 20 | 21 | @:jsRequire('material-ui/styles/withStyles', 'default') 22 | class StylesWithStyles 23 | { 24 | @:selfCall 25 | public static var call :Dynamic; 26 | } 27 | 28 | @:jsRequire('material-ui/styles/withStyles', 'default') 29 | class Styles 30 | { 31 | public static var withStyles :Dynamic = Reflect.field(js.Lib.require('material-ui/styles/withStyles'), 'default'); 32 | public static var createMuiTheme :Dynamic = Reflect.field(js.Lib.require('material-ui/styles/createMuiTheme'), 'default'); 33 | public static var withTheme :Dynamic = Reflect.field(js.Lib.require('material-ui/styles/withTheme'), 'default'); 34 | } 35 | -------------------------------------------------------------------------------- /js/npm/md5file/Md5File.hx: -------------------------------------------------------------------------------- 1 | package js.npm.md5file; 2 | 3 | import js.Error; 4 | 5 | @:jsRequire("md5-file") 6 | extern class Md5File 7 | { 8 | @:selfCall 9 | public static function md5(path :String, cb :Null->String->Void) :Void; 10 | } 11 | -------------------------------------------------------------------------------- /js/npm/md5file/Md5FilePromise.hx: -------------------------------------------------------------------------------- 1 | package js.npm.md5file; 2 | 3 | import js.Promise; 4 | 5 | @:jsRequire("md5-file/promise") 6 | extern class Md5FilePromise 7 | { 8 | @:selfCall 9 | public static function md5(path :String) :Promise; 10 | } 11 | -------------------------------------------------------------------------------- /js/npm/moment/MomentTimezone.hx: -------------------------------------------------------------------------------- 1 | package js.npm.moment; 2 | 3 | import haxe.extern.EitherType; 4 | 5 | @:jsRequire("moment-timezone") 6 | extern class MomentTimezone 7 | { 8 | @:selfCall public function new(?date :EitherType, ?format :String); 9 | 10 | public function tz(timezone :String) :MomentTimezone; 11 | public function format(format :String) :MomentTimezone; 12 | public function toString() :String; 13 | } -------------------------------------------------------------------------------- /js/npm/mongodb/Admin.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * Allows the user to access the admin functionality of MongoDB 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("require('mongodb').Admin") 8 | extern class Admin 9 | { 10 | var buildInfo : Dynamic; 11 | var serverStatus : Dynamic; 12 | var profilingLevel : Dynamic; 13 | var ping : Dynamic; 14 | var authenticate : Dynamic; 15 | var logout : Dynamic; 16 | var addUser : Dynamic; 17 | var removeUser : Dynamic; 18 | var setProfilingLevel : Dynamic; 19 | var profilingInfo : Dynamic; 20 | var command : Dynamic; 21 | var validateCollection : Dynamic; 22 | var listDatabases : Dynamic; 23 | var replSetGetStatus : Dynamic; 24 | 25 | } -------------------------------------------------------------------------------- /js/npm/mongodb/BSON.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | import js.html.ArrayBuffer; 3 | import js.html.ArrayBufferView; 4 | import js.html.Int8Array; 5 | import js.html.Uint8Array; 6 | import js.node.Buffer; 7 | import js.npm.mongodb.MongoOption.BSONOption; 8 | 9 | /** 10 | * BSON [bee · sahn], short for Bin­ary JSON, is a bin­ary-en­coded seri­al­iz­a­tion of JSON-like doc­u­ments. 11 | * Like JSON, BSON sup­ports the em­bed­ding of doc­u­ments and ar­rays with­in oth­er doc­u­ments and ar­rays. 12 | * BSON also con­tains ex­ten­sions that al­low rep­res­ent­a­tion of data types that are not part of the JSON spec. 13 | * For ex­ample, BSON has a Date type and a BinData type. 14 | * http://http://bsonspec.org/ 15 | * @author Eduardo Pons - eduardo@thelaborat.org 16 | */ 17 | @:native("(require('mongodb').BSON)") 18 | extern class BSON 19 | { 20 | /** 21 | * 1 Number BSON Type 22 | */ 23 | static var BSON_DATA_NUMBER :Int; 24 | /** 25 | * 2 String BSON Type 26 | */ 27 | static var BSON_DATA_STRING :Int; 28 | /** 29 | * 3 Object BSON Type 30 | */ 31 | static var BSON_DATA_OBJECT :Int; 32 | /** 33 | * 4 Array BSON Type 34 | */ 35 | static var BSON_DATA_ARRAY :Int; 36 | /** 37 | * 5 Binary BSON Type 38 | */ 39 | static var BSON_DATA_BINARY :Int; 40 | /** 41 | * 7 ObjectID BSON Type 42 | */ 43 | static var BSON_DATA_OID :Int; 44 | /** 45 | * 8 Boolean BSON Type 46 | */ 47 | static var BSON_DATA_BOOLEAN :Int; 48 | /** 49 | * 9 Date BSON Type 50 | */ 51 | static var BSON_DATA_DATE :Int; 52 | /** 53 | * 10 null BSON Type 54 | */ 55 | static var BSON_DATA_NULL :Int; 56 | /** 57 | * 11 RegExp BSON Type 58 | */ 59 | static var BSON_DATA_REGEXP :Int; 60 | /** 61 | * 13 Code BSON Type 62 | */ 63 | static var BSON_DATA_CODE :Int; 64 | /** 65 | * 14 Symbol BSON Type 66 | */ 67 | static var BSON_DATA_SYMBOL :Int; 68 | /** 69 | * 15 Code with Scope BSON Type 70 | */ 71 | static var BSON_DATA_CODE_W_SCOPE :Int; 72 | /** 73 | * 16 32 bit Integer BSON Type 74 | */ 75 | static var BSON_DATA_INT :Int; 76 | 77 | /** 78 | * 17 Timestamp BSON Type 79 | */ 80 | static var BSON_DATA_TIMESTAMP :Int; 81 | 82 | /** 83 | * 18 Long BSON Type 84 | */ 85 | static var BSON_DATA_LONG :Int; 86 | /** 87 | * 0xff MinKey BSON Type 88 | */ 89 | static var BSON_DATA_MIN_KEY :Int; 90 | /** 91 | * 0x7f MaxKey BSON Type 92 | */ 93 | static var BSON_DATA_MAX_KEY :Int; 94 | /** 95 | * 0 Binary Default Type 96 | */ 97 | static var BSON_BINARY_SUBTYPE_DEFAULT :Int; 98 | /** 99 | * 1 Binary Function Type 100 | */ 101 | static var BSON_BINARY_SUBTYPE_FUNCTION :Int; 102 | /** 103 | * 2 Binary Byte Array Type 104 | */ 105 | static var BSON_BINARY_SUBTYPE_BYTE_ARRAY :Int; 106 | /** 107 | * 3 Binary UUID Type 108 | */ 109 | static var BSON_BINARY_SUBTYPE_UUID :Int; 110 | /** 111 | * 4 Binary MD5 Type 112 | */ 113 | static var BSON_BINARY_SUBTYPE_MD5 :Int; 114 | /** 115 | * 128 Binary User Defined Type 116 | */ 117 | static var BSON_BINARY_SUBTYPE_USER_DEFINED :Int; 118 | 119 | /** 120 | * Create a new BSON instance 121 | */ 122 | function new():Void; 123 | 124 | /** 125 | * Deserialize data as BSON. 126 | * Returns the deserialized Javascript Object. 127 | * @param p_buffer 128 | * @param p_options 129 | * @param p_is_array 130 | * @return 131 | */ 132 | @:overload(function (p_buffer:Buffer):Dynamic{}) 133 | @:overload(function (p_buffer:Buffer,p_options:BSONOption):Dynamic{}) 134 | function deserialize(p_buffer:Buffer,p_options:BSONOption,p_is_array:Bool):Dynamic; 135 | 136 | 137 | /** 138 | * Deserialize stream data as BSON documents. 139 | * Returns the next index in the buffer after deserialization x numbers of documents. 140 | * @param p_data 141 | * @param p_start_index 142 | * @param p_document_count 143 | * @param p_documents 144 | * @param p_document_start 145 | * @param p_options 146 | * @return 147 | */ 148 | @:overload(function (p_data:Dynamic, p_start_index:Int, p_document_count:Int, p_documents:Array, p_document_start :Int):Int { } ) 149 | function deserializeStream(p_data:Dynamic,p_start_index:Int,p_document_count:Int,p_documents:Array,p_document_start :Int,p_options:BSONOption):Int; 150 | 151 | /** 152 | * 153 | * @param p_object 154 | * @param p_check_keys 155 | * @param p_as_buffer 156 | * @param p_serialize_functions 157 | * @return 158 | */ 159 | @:overload(function (p_object : Dynamic, p_check_keys:Bool):Buffer{}) 160 | @:overload(function (p_object : Dynamic, p_check_keys:Bool, p_as_buffer:Bool):Buffer{}) 161 | function serialize(p_object : Dynamic, p_check_keys:Bool, p_as_buffer:Bool, p_serialize_functions:Bool):Buffer; 162 | 163 | /** 164 | * Calculate the bson size for a passed in Javascript object. 165 | * Returns the number of bytes the BSON object will take up. 166 | * @param p_object 167 | * @param p_serialize_functions 168 | * @return 169 | */ 170 | @:overload(function (p_object : Dynamic):Int{}) 171 | function calculateObjectSize(p_object : Dynamic, p_serialize_functions : Bool):Int; 172 | 173 | /** 174 | * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. 175 | * Returns the new write index in the Buffer. 176 | * @param p_object 177 | * @param p_check_keys 178 | * @param p_buffer 179 | * @param p_index 180 | * @param p_serialize_functions 181 | * @return 182 | */ 183 | function serializeWithBufferAndIndex(p_object : Dynamic, p_check_keys:Bool, p_buffer:Buffer, p_index:Int, p_serialize_functions:Bool):Int; 184 | 185 | /* 186 | BSON.calculateObjectSize 187 | BSON.serializeWithBufferAndIndex 188 | BSON.serialize 189 | BSON.deserializeStream 190 | BSON.deserialize 191 | //*/ 192 | } -------------------------------------------------------------------------------- /js/npm/mongodb/BatchWriteResult.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * ... 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("(require('mongodb').BatchWriteResult)") 8 | extern class BatchWriteResult 9 | { 10 | 11 | var ok : Int; // {boolean} did bulk operation correctly execute 12 | var nInserted : Int; // {number} number of inserted documents 13 | var nUpdated : Int; // {number} number of documents updated logically 14 | var nUpserted : Int; // {number} number of upserted documents 15 | var nModified : Int; // {number} number of documents updated physically on disk 16 | var nRemoved : Int; // { number } number of removed documents 17 | 18 | var getUpsertedIds : Dynamic; 19 | var getUpsertedIdAt : Dynamic; 20 | var getRawResponse : Dynamic; 21 | var hasWriteErrors : Dynamic; 22 | var getWriteErrorCount : Dynamic; 23 | var getWriteErrorAt : Dynamic; 24 | var getWriteErrors : Dynamic; 25 | var getWriteConcernError : Dynamic; 26 | 27 | 28 | } -------------------------------------------------------------------------------- /js/npm/mongodb/Binary.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | import js.node.Buffer; 3 | 4 | /** 5 | * A class representation of the BSON Binary type. 6 | * @author Eduardo Pons - eduardo@thelaborat.org 7 | */ 8 | @:native("(require('mongodb').Binary)") 9 | extern class Binary 10 | { 11 | 12 | /** 13 | * 0 Default BSON type 14 | */ 15 | static var SUBTYPE_DEFAULT :Int; 16 | 17 | /** 18 | * 1 Function BSON type 19 | */ 20 | static var SUBTYPE_FUNCTION :Int; 21 | 22 | /** 23 | * 2 Byte Array BSON type 24 | */ 25 | static var SUBTYPE_BYTE_ARRAY :Int; 26 | 27 | /** 28 | * 3 OLD UUID BSON type 29 | */ 30 | static var SUBTYPE_UUID_OLD :Int; 31 | 32 | /** 33 | * 4 UUID BSON type 34 | */ 35 | static var SUBTYPE_UUID :Int; 36 | 37 | /** 38 | * 5 MD5 BSON type 39 | */ 40 | static var SUBTYPE_MD5 :Int; 41 | 42 | /** 43 | * 128 User BSON type 44 | */ 45 | static var SUBTYPE_USER_DEFINED :Int; 46 | 47 | /** 48 | * Updates this binary with byte_value. 49 | * @param p_char 50 | */ 51 | function put(p_char:Int):Void; 52 | 53 | /** 54 | * Writes a buffer or string to the binary. 55 | * @param p_string 56 | * @param p_offset 57 | */ 58 | function write(p_string:String, p_offset:Int):Void; 59 | 60 | 61 | /** 62 | * Writes a buffer or string to the binary. 63 | * @param p_position 64 | * @param p_length 65 | * @return 66 | */ 67 | function read(p_position:Int, p_length:Int):Buffer; 68 | 69 | /** 70 | * Returns the value of this binary as a string. 71 | * @return 72 | */ 73 | function value():String; 74 | 75 | /** 76 | * The length of the binary. 77 | * @return 78 | */ 79 | function length():Int; 80 | 81 | 82 | } -------------------------------------------------------------------------------- /js/npm/mongodb/Code.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * A class representation of the BSON Code type. 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("(require('mongodb').Code)") 8 | extern class Code 9 | { 10 | 11 | /** 12 | * A class representation of the BSON Code type. 13 | * @param p_code 14 | * @param p_scope 15 | */ 16 | function new(p_code:String,p_scope:Dynamic):Void; 17 | 18 | 19 | } -------------------------------------------------------------------------------- /js/npm/mongodb/CursorStream.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | import js.node.events.EventEmitter; 3 | 4 | /** 5 | * Container class for ReadStreamEvent types. 6 | */ 7 | class CursorStreamEvent 8 | { 9 | /** 10 | * {function(item) { }} the data event triggers when a document is ready. 11 | */ 12 | static public var Data : String = "data"; 13 | /** 14 | * {function() {}} the close event triggers when the stream is closed. 15 | */ 16 | static public var Close : String = "close"; 17 | /** 18 | * {function(err) {}} the error event triggers if an error happens. 19 | */ 20 | static public var Error : String = "error"; 21 | } 22 | 23 | /** 24 | * Stream interface for a cursor. 25 | * @author Eduardo Pons - eduardo@thelaborat.org 26 | */ 27 | @:native("(require('mongodb').CursorStream)") 28 | extern class CursorStream implements Dynamic 29 | //extends EventEmitter 30 | { 31 | 32 | /** 33 | * Creates stream interface for the cursor. 34 | * @param p_cursor 35 | */ 36 | function new(p_cursor:MongoCursor):Void; 37 | 38 | 39 | } -------------------------------------------------------------------------------- /js/npm/mongodb/Double.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * A class representation of the BSON Double type. 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("(require('mongodb').Double)") 8 | extern class Double 9 | { 10 | 11 | /** 12 | * A class representation of the BSON Double type. 13 | * @param v 14 | */ 15 | function new(v:Float):Void; 16 | 17 | /** 18 | * Returns the wrapped double number. 19 | * @return 20 | */ 21 | function valueOf():Float; 22 | 23 | 24 | } -------------------------------------------------------------------------------- /js/npm/mongodb/Long.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * Defines a Long class for representing a 64-bit two’s-complement integer value, which faithfully simulates the behavior of a Java “Long”. This implementation is derived from LongLib in GWT. 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("(require('mongodb').Long)") 8 | extern class Long 9 | { 10 | 11 | var toInt : Dynamic; 12 | var toNumber : Dynamic; 13 | var toJSON : Dynamic; 14 | var toString : Dynamic; 15 | var getHighBits : Dynamic; 16 | var getLowBits : Dynamic; 17 | var getLowBitsUnsigned : Dynamic; 18 | var getNumBitsAbs : Dynamic; 19 | var isZero : Dynamic; 20 | var isNegative : Dynamic; 21 | var isOdd : Dynamic; 22 | var equals : Dynamic; 23 | var notEquals : Dynamic; 24 | var lessThan : Dynamic; 25 | var lessThanOrEqual : Dynamic; 26 | var greaterThan : Dynamic; 27 | var greaterThanOrEqual : Dynamic; 28 | var compare : Dynamic; 29 | var negate : Dynamic; 30 | var add : Dynamic; 31 | var subtract : Dynamic; 32 | var multiply : Dynamic; 33 | var div : Dynamic; 34 | var modulo : Dynamic; 35 | var not : Dynamic; 36 | var and : Dynamic; 37 | var or : Dynamic; 38 | var xor : Dynamic; 39 | var shiftLeft : Dynamic; 40 | var shiftRight : Dynamic; 41 | var shiftRightUnsigned : Dynamic; 42 | static var fromInt : Dynamic; 43 | static var fromNumber : Dynamic; 44 | static var fromBits : Dynamic; 45 | static var fromString : Dynamic; 46 | 47 | 48 | } -------------------------------------------------------------------------------- /js/npm/mongodb/MaxKey.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * A class representation of the BSON MaxKey type 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("(require('mongodb').MaxKey)") 8 | extern class MaxKey 9 | { 10 | 11 | /** 12 | * Creates a new MaxKey instance. 13 | */ 14 | function new():Void; 15 | 16 | 17 | } -------------------------------------------------------------------------------- /js/npm/mongodb/MinKey.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * A class representation of the BSON MinKey type 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("(require('mongodb').MinKey)") 8 | extern class MinKey 9 | { 10 | 11 | /** 12 | * Creates a new MaxKey instance. 13 | */ 14 | function new():Void; 15 | 16 | 17 | } -------------------------------------------------------------------------------- /js/npm/mongodb/MongoAdmin.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * Allows the user to access the admin functionality of MongoDB 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("require('mongodb').Admin") 8 | extern class MongoAdmin 9 | { 10 | var buildInfo : Dynamic; 11 | var serverStatus : Dynamic; 12 | var profilingLevel : Dynamic; 13 | var ping : Dynamic; 14 | var authenticate : Dynamic; 15 | var logout : Dynamic; 16 | var addUser : Dynamic; 17 | var removeUser : Dynamic; 18 | var setProfilingLevel : Dynamic; 19 | var profilingInfo : Dynamic; 20 | var command : Dynamic; 21 | var validateCollection : Dynamic; 22 | var listDatabases : Dynamic; 23 | var replSetGetStatus : Dynamic; 24 | 25 | } -------------------------------------------------------------------------------- /js/npm/mongodb/MongoClient.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | import js.Error; 3 | import js.node.events.EventEmitter; 4 | import js.Node; 5 | import js.html.Float32Array; 6 | import js.npm.mongodb.MongoDatabase; 7 | import js.npm.mongodb.MongoOption.MongoOption; 8 | import js.npm.mongodb.MongoOption.MongoServerOption; 9 | 10 | /** 11 | * 12 | */ 13 | @:native("(require('mongodb').MongoClient)") 14 | extern class MongoClient implements Dynamic 15 | //extends EventEmitter 16 | 17 | { 18 | /** 19 | * Creates a new MongoClient instance. 20 | */ 21 | @:overload(function(p_server:MongoServer):Void { }) 22 | function new(p_server : MongoServer, p_options:MongoOption); 23 | 24 | /** 25 | * Connect to MongoDB using a url as documented at 26 | * docs.mongodb.org/manual/reference/connection-string/ 27 | */ 28 | @:overload(function(p_url:String, p_callback:Error->MongoDatabase-> Void):Void { } ) 29 | static function connect(p_url:String, p_options:MongoOption, p_callback:Error->MongoDatabase-> Void):Void; 30 | 31 | 32 | 33 | /** 34 | * Connect to MongoDB using a url as documented at 35 | * docs.mongodb.org/manual/reference/connection-string/ 36 | * @param p_url 37 | * @param p_options 38 | * @param p_callback 39 | */ 40 | @:overload(function(p_url:String, p_callback:Error->MongoDatabase-> Void):Void { } ) 41 | @:native("connect") 42 | function Connect(p_url:String, p_options:MongoOption, p_callback:Error->MongoDatabase-> Void):Void; 43 | 44 | /** 45 | * Initialize the database connection. 46 | * @param p_callback 47 | */ 48 | function open(p_callback:Error->MongoDatabase-> Void):Void; 49 | 50 | /** 51 | * Close the current db connection, including all the child db instances. Emits close event if no callback is provided. 52 | * @param p_callback 53 | */ 54 | @:overload(function():Void{}) 55 | function close(p_callback:Error->Dynamic->Void):Void; 56 | 57 | /** 58 | * Create a new Db instance sharing the current socket connections. 59 | * @param name 60 | * @return 61 | */ 62 | function db(name:String):MongoDatabase; 63 | } -------------------------------------------------------------------------------- /js/npm/mongodb/MongoCollection.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | import js.npm.mongodb.MongoOption.MongoCollectionBuildOption; 3 | import js.npm.mongodb.MongoOption.MongoCollectionOption; 4 | 5 | /** 6 | * ... 7 | * @author Eduardo Pons - eduardo@thelaborat.org 8 | */ 9 | @:native("(require('mongodb').Collection)") 10 | extern class MongoCollection 11 | { 12 | 13 | 14 | /** 15 | * Create a new Collection instance (INTERNAL TYPE, do not instantiate directly) 16 | * @param p_db 17 | * @param p_name 18 | * @param p_pkfactory 19 | * @param p_options 20 | */ 21 | @:overload(function (p_db:MongoDatabase,p_name:String):Void{}) 22 | @:overload(function (p_db:MongoDatabase,p_name:String,p_pkfactory : ObjectID):Void{}) 23 | function new(p_db:MongoDatabase,p_name:String,p_pkfactory : ObjectID,p_options : MongoCollectionBuildOption):Void; 24 | 25 | 26 | function insert(obj:Dynamic, ?options:Dynamic) : js.Promise < Dynamic >; 27 | var insertMany : Dynamic; //3.2 28 | var remove : Dynamic; 29 | var rename : Dynamic; 30 | var save : Dynamic; 31 | var update : Dynamic; 32 | var distinct : Dynamic; 33 | var count : Dynamic; 34 | var drop : Dynamic; 35 | var findAndModify : Dynamic; 36 | var findAndRemove : Dynamic; 37 | var find : Dynamic; 38 | var findOne : Dynamic; 39 | var createIndex : Dynamic; 40 | var ensureIndex : Dynamic; 41 | var indexInformation : Dynamic; 42 | var dropIndex : Dynamic; 43 | var dropAllIndexes : Dynamic; 44 | var reIndex : Dynamic; 45 | var mapReduce : Dynamic; 46 | var group : Dynamic; 47 | var options : Dynamic; 48 | var isCapped : Dynamic; 49 | var indexExists : Dynamic; 50 | var geoNear : Dynamic; 51 | var geoHaystackSearch : Dynamic; 52 | var indexes : Dynamic; 53 | var aggregate : Dynamic; 54 | var stats : Dynamic; 55 | var initializeUnorderedBulkOp : Dynamic; 56 | var initializeOrderedBulkOp : Dynamic; 57 | var parallelCollectionScan : Dynamic; 58 | var insertOne : Dynamic; 59 | var updateOne : Dynamic; 60 | 61 | } 62 | -------------------------------------------------------------------------------- /js/npm/mongodb/MongoCursor.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | import js.npm.mongodb.MongoOption.MongoCursorOption; 3 | 4 | /** 5 | * ... 6 | * @author Eduardo Pons - eduardo@thelaborat.org 7 | */ 8 | @:native("(require('mongodb').Cursor)") 9 | extern class MongoCursor 10 | { 11 | /** 12 | * 0 Init state 13 | */ 14 | static var INIT :Int; 15 | 16 | /** 17 | * 1 Cursor open 18 | */ 19 | static var OPEN :Int; 20 | 21 | /** 22 | * 2 Cursor closed 23 | */ 24 | static var CLOSED :Int; 25 | 26 | /** 27 | * 3 Cursor performing a get more 28 | */ 29 | static var GET_MORE :Int; 30 | 31 | /** 32 | * Constructor for a cursor object that handles all the operations on query result using find. 33 | * This cursor object is unidirectional and cannot traverse backwards. 34 | * Clients should not be creating a cursor directly, but use find to acquire a cursor. (INTERNAL TYPE) 35 | */ 36 | @:overload(function (p_db:MongoDatabase,p_collection:MongoCollection,p_selector:Dynamic,p_fields:Dynamic):Void{}) 37 | function new(p_db:MongoDatabase, p_collection:MongoCollection, p_selector:Dynamic, p_fields:Dynamic, p_options:MongoCursorOption):Void; 38 | 39 | 40 | var rewind : Dynamic; 41 | 42 | 43 | var count : Dynamic; 44 | var sort : Dynamic; 45 | var limit : Dynamic; 46 | var maxTimeMS : Dynamic; 47 | var setReadPreference : Dynamic; 48 | var skip : Dynamic; 49 | var batchSize : Dynamic; 50 | var nextObject : Dynamic; 51 | var explain : Dynamic; 52 | var stream : Dynamic; 53 | var close : Dynamic; 54 | var isClosed : Dynamic; 55 | 56 | /** 57 | End of stream is signaled by a null passed in item 58 | */ 59 | function each ( func :/*err:*/ Dynamic -> /*item:*/ Dynamic -> Void ) : Void; 60 | function toArray( func :/*err:*/ Dynamic -> /*items:*/ Array -> Void ) : Dynamic; 61 | 62 | } 63 | -------------------------------------------------------------------------------- /js/npm/mongodb/MongoDatabase.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | import js.Error; 3 | import js.node.events.EventEmitter; 4 | import js.npm.mongodb.MongoOption.MongoAuthOption; 5 | import js.npm.mongodb.MongoOption.MongoCollectionFetchOption; 6 | import js.npm.mongodb.MongoOption.MongoCollectionOption; 7 | import js.npm.mongodb.MongoOption.MongoCommandOption; 8 | import js.npm.mongodb.MongoOption.MongoCursorOption; 9 | import js.npm.mongodb.MongoOption.MongoDatabaseOption; 10 | import js.npm.mongodb.MongoOption.MongoIndexOption; 11 | import js.npm.mongodb.MongoOption.MongoStatsOption; 12 | import js.npm.mongodb.MongoOption.MongoUserOption; 13 | 14 | /** 15 | * ... 16 | * @author Eduardo Pons - eduardo@thelaborat.org 17 | */ 18 | @:native("require('mongodb').Db") 19 | extern class MongoDatabase implements Dynamic 20 | //extends EventEmitter 21 | { 22 | /** 23 | * ‘mongodb://localhost:27017/default’ Default URL 24 | */ 25 | static var DEFAULT_URL:String; 26 | 27 | /** 28 | * Create a new Db instance. 29 | */ 30 | @:overload(function(p_name:String,p_server:MongoServer):Void{}) 31 | function new(p_name:String, p_server:MongoServer, p_options:MongoDatabaseOption):Void; 32 | 33 | /** 34 | * Initialize the database connection. 35 | * @param p_callback 36 | */ 37 | function open(p_callback:Error->MongoDatabase-> Void):Void; 38 | 39 | /** 40 | * Create a new Db instance sharing the current socket connections. 41 | * @param p_name 42 | * @return 43 | */ 44 | function db(p_name:String):MongoDatabase; 45 | 46 | /** 47 | * Close the current db connection, including all the child db instances. Emits close event if no callback is provided. 48 | * @param p_force 49 | * @param p_callback 50 | */ 51 | @:overload(function():Void{}) 52 | @:overload(function(p_callback : Error -> Dynamic -> Void):Void{}) 53 | function close(p_force:Bool, p_callback : Error -> Dynamic -> Void):Void; 54 | 55 | /** 56 | * Access the Admin database 57 | */ 58 | @:overload(function():Void{}) 59 | function admin(p_callback : Dynamic -> Void):MongoDatabase; 60 | 61 | /** 62 | * Returns a cursor to all the collection information. 63 | * @param p_name 64 | * @param p_callback 65 | */ 66 | @:overload(function(p_callback : Error -> Dynamic ->Void):MongoCursor { } ) 67 | function collectionsInfo(p_name:String, p_callback : Error -> Dynamic ->Void):MongoCursor; 68 | 69 | /** 70 | * Get the list of all collection names for the specified db 71 | * @param p_name 72 | * @param p_options 73 | * @param p_callback 74 | * @return 75 | */ 76 | @:overload(function (p_callback:Error->Array->Void):Array { } ) 77 | @:overload(function (p_name:String, p_callback:Error->Array->Void):Array { } ) 78 | function collectionNames(p_name:String, p_options : MongoDatabaseOption, p_callback:Error->Array->Void):Array; 79 | 80 | /** 81 | * Fetch a specific collection (containing the actual collection information). 82 | * If the application does not use strict mode you can can use it without a callback in the following way. 83 | * var collection = db.collection(‘mycollection’); 84 | * @param p_name 85 | * @param p_options 86 | * @param p_callback 87 | */ 88 | @:overload(function (p_name:String ):MongoCollection{}) 89 | @:overload(function (p_name:String,p_callback:Error->MongoCollection->Void):MongoCollection{}) 90 | function collection(p_name:String, p_options : MongoCollectionFetchOption, p_callback:Error->MongoCollection->Void):MongoCollection; 91 | 92 | /** 93 | * Fetch all collections for the current db. 94 | * @param p_callback 95 | */ 96 | function collections(p_callback:Error->Array->Void):Void; 97 | 98 | /** 99 | * Evaluate javascript on the server. 100 | * @param p_code 101 | * @param p_parameters 102 | * @param p_option 103 | * @param p_callback 104 | */ 105 | @:overload(function (p_code : String,p_callback:Error->Dynamic->Void):Void{}) 106 | @:overload(function (p_code : String,p_parameters : Dynamic,p_callback:Error->Dynamic->Void):Void{}) 107 | function eval(p_code : String,p_parameters : Dynamic,p_option : MongoOption,p_callback:Error->Dynamic->Void):Void; 108 | 109 | /** 110 | * Dereference a dbref, against a db 111 | * @param p_database_ref 112 | * @param p_callback 113 | */ 114 | function dereference(p_database_ref : MongoDatabaseRef, p_callback : Error->Bool->Void):Void; 115 | 116 | /** 117 | * Logout user from server, fire off on all connections and remove all auth info 118 | * @param p_callback 119 | */ 120 | function logout(p_callback:Error->Dynamic->Void):Void; 121 | 122 | /** 123 | * Authenticate a user against the server. authMechanism Options 124 | * @param p_username 125 | * @param p_password 126 | * @param p_options 127 | * @param p_callback 128 | */ 129 | @:overload(function (p_username:String,p_password:String,p_callback:Error->Bool->Void):Void{}) 130 | function authenticate(p_username:String,p_password:String,p_options:MongoAuthOption,p_callback:Error->Bool->Void):Void; 131 | 132 | 133 | /** 134 | * Add a user to the database. 135 | * @param p_username 136 | * @param p_password 137 | * @param p_options 138 | * @param p_callback 139 | */ 140 | @:overload(function (p_username:String,p_password:String,p_callback:Error->Dynamic->Void):Void{}) 141 | function addUser(p_username:String, p_password:String, p_options:MongoUserOption, p_callback:Error->Dynamic->Void):Void; 142 | 143 | /** 144 | * Remove a user from a database 145 | * @param p_username 146 | * @param p_options 147 | * @param p_callback 148 | */ 149 | @:overload(function (p_username:String,p_callback:Error->Bool->Void):Void{}) 150 | function removeUser(p_username:String, p_options:MongoUserOption, p_callback:Error->Bool->Void):Void; 151 | 152 | /** 153 | * Creates a collection on a server pre-allocating space, need to create f.ex capped collections. 154 | * @param p_name 155 | * @param p_options 156 | * @param p_callback 157 | */ 158 | @:overload(function (p_name:String, p_callback:Error->MongoCollection->Void):Void{}) 159 | function createCollection(p_name:String, p_options:MongoCollectionOption, p_callback:Error->MongoCollection->Void):Void; 160 | 161 | /** 162 | * Execute a command hash against MongoDB. This lets you acess any commands not available through the api on the server. 163 | * @param p_selector 164 | * @param p_options 165 | * @param p_callback 166 | */ 167 | @:overload(function (p_selector:Dynamic,p_callback:Error->Dynamic->Void):Void{}) 168 | function command(p_selector:Dynamic,p_options:MongoCommandOption,p_callback:Error->Dynamic->Void):Void; 169 | 170 | //Drop a collection from the database, removing it permanently. New accesses will create a new collection. 171 | function dropCollection(p_name:String, p_callback:Error->Bool->Void):Void; 172 | 173 | /** 174 | * Rename a collection. 175 | * @param p_from 176 | * @param p_to 177 | * @param p_options 178 | * @param p_callback 179 | */ 180 | @:overload(function (p_from : String, p_to:String, p_callback:Error->MongoCollection->Void):Void{}) 181 | function renameCollection(p_from : String, p_to:String, p_options:MongoCollectionOption, p_callback:Error->MongoCollection->Void):Void; 182 | 183 | /** 184 | * Creates an index on the collection. 185 | * @param p_collection 186 | * @param p_field_or_spec 187 | * @param p_options 188 | * @param p_callback 189 | */ 190 | @:overload(function (p_collection_name:String, p_field_or_spec:Dynamic,p_callback:Error->Dynamic->Void):Void{}) 191 | function createIndex(p_collection_name:String, p_field_or_spec:Dynamic,p_options:MongoIndexOption, p_callback:Error->Dynamic->Void):Void; 192 | 193 | /** 194 | * Ensures that an index exists, if it does not it creates it 195 | * @param p_collection 196 | * @param p_field_or_spec 197 | * @param p_options 198 | * @param p_callback 199 | */ 200 | @:overload(function (p_collection_name:String, p_field_or_spec:Dynamic,p_callback:Error->Dynamic->Void):Void{}) 201 | function ensureIndex(p_collection_name:String, p_field_or_spec:Dynamic, p_options:MongoIndexOption, p_callback:Error->Dynamic->Void):Void; 202 | 203 | 204 | /** 205 | * Reindex all indexes on the collection 206 | * Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections. 207 | * @param p_collection_name 208 | * @param p_callback 209 | */ 210 | function reIndex(p_collection_name:String,p_callback:Error->Bool->Void):Void; 211 | 212 | 213 | /** 214 | * Retrieves this collections index info. 215 | * @param p_collection_name 216 | * @param p_options 217 | * @param p_callback 218 | */ 219 | @:overload(function (p_collection_name:String,p_callback:Error->Dynamic->Void):Void{}) 220 | function indexInformation(p_collection_name:String,p_options:MongoIndexOption,p_callback:Error->Dynamic->Void):Void; 221 | 222 | /** 223 | * Drop an index on a collection. 224 | * @param p_collection_name 225 | * @param p_index_name 226 | * @param p_callback 227 | */ 228 | function dropIndex(p_collection_name:String,p_index_name:String,p_callback:Error->Bool->Void):Void; 229 | 230 | 231 | /** 232 | * Returns the information available on allocated cursors. 233 | * TODO: trace(callback 'infor' parameter) 234 | * @param p_options 235 | * @param p_callback 236 | */ 237 | @:overload(function (p_callback:Error->Dynamic->Void):Void{}) 238 | function cursorInfo(p_options : MongoCursorOption, p_callback:Error->Dynamic->Void):Void; 239 | 240 | /** 241 | * Drop a database. 242 | * @param p_callback 243 | */ 244 | function dropDatabase(p_callback:Error->Bool->Void):Void; 245 | 246 | /** 247 | * Get all the db statistics. 248 | * @param p_options 249 | * @param p_callback 250 | */ 251 | @:overload(function (p_callback:Error->Dynamic->Void):Void{}) 252 | function stats(p_options:MongoStatsOption,p_callback:Error->Dynamic->Void):Void; 253 | 254 | } 255 | -------------------------------------------------------------------------------- /js/npm/mongodb/MongoDatabaseRef.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * A class representation of the BSON DBRef type. 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("(require('mongodb').DBRef)") 8 | extern class MongoDatabaseRef 9 | { 10 | 11 | /** 12 | * Creates a new MongoDatabaseRef 13 | * @param p_namespace 14 | * @param p_oid 15 | * @param p_database_name 16 | */ 17 | @:overload(function(p_namespace:String, p_oid : ObjectID) :Void { } ) 18 | function new(p_namespace:String, p_oid : ObjectID, p_database_name:String) :Void; 19 | 20 | } -------------------------------------------------------------------------------- /js/npm/mongodb/MongoGrid.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * A class representation of a simple Grid interface. 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("require('mongodb').Grid") 8 | extern class MongoGrid 9 | { 10 | 11 | /** 12 | * Creates a new Grid. 13 | * @param p_database 14 | * @param p_fs_name 15 | */ 16 | function new(p_database:MongoDatabase,p_fs_name:String):Void; 17 | 18 | var put : Dynamic; 19 | var get : Dynamic; 20 | var delete : Dynamic; 21 | 22 | 23 | } -------------------------------------------------------------------------------- /js/npm/mongodb/MongoGridStore.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * A class representation of a simple Grid interface. 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("require('mongodb').GridStore") 8 | extern class MongoGridStore 9 | { 10 | 11 | /** 12 | * ‘fs’ The collection to be used for holding the files and chunks collection. 13 | */ 14 | static var DEFAULT_ROOT_COLLECTION : String; 15 | /** 16 | * ‘binary/octet-stream’ Default file mime type 17 | */ 18 | static var DEFAULT_CONTENT_TYPE : String; 19 | /** 20 | * 0 Seek mode where the given length is absolute. 21 | */ 22 | static var IO_SEEK_SET : Int; 23 | /** 24 | * 1 Seek mode where the given length is an offset to the current read/write head. 25 | */ 26 | static var IO_SEEK_CUR : Int; 27 | /** 28 | * 2 Seek mode where the given length is an offset to the end of the file. 29 | */ 30 | static var IO_SEEK_END : Int; 31 | 32 | 33 | /** 34 | * The current chunksize of the file. 35 | */ 36 | var chunkSize : Int; 37 | 38 | /** 39 | * The md5 checksum for this file. 40 | */ 41 | var md5 : Int; 42 | 43 | var open : Dynamic; 44 | var writeFile : Dynamic; 45 | var close : Dynamic; 46 | var chunkCollection : Dynamic; 47 | var unlink : Dynamic; 48 | var collection : Dynamic; 49 | var readlines : Dynamic; 50 | var rewind : Dynamic; 51 | var read : Dynamic; 52 | var tell : Dynamic; 53 | var seek : Dynamic; 54 | var eof : Dynamic; 55 | var getc : Dynamic; 56 | var puts : Dynamic; 57 | var stream : Dynamic; 58 | static var exist : Dynamic; 59 | static var list : Dynamic; 60 | //static var read : Dynamic; 61 | //static var readlines : Dynamic; 62 | //static var unlink : Dynamic; 63 | var write : Dynamic; 64 | 65 | } -------------------------------------------------------------------------------- /js/npm/mongodb/MongoServer.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | import js.npm.mongodb.MongoOption.MongoLogger; 3 | import js.npm.mongodb.MongoOption.MongoServerOption; 4 | 5 | 6 | 7 | 8 | 9 | 10 | /** 11 | * Class representing a single MongoDB Server connection 12 | * @author Eduardo Pons - eduardo@thelaborat.org 13 | */ 14 | @:native("require('mongodb').Server") 15 | extern class MongoServer 16 | { 17 | 18 | /** 19 | * Creates a new MongoServer instance. 20 | * @param p_host the server host 21 | * @param p_port the server port 22 | * @param p_options optional options for insert command 23 | */ 24 | @:overload(function(p_host:String, p_port:Int):Void { } ) 25 | function new(p_host : String, p_port : Int, p_options : MongoServerOption) : Void; 26 | 27 | /** 28 | * Assigns a replica set to this server. 29 | * @param p_replset 30 | */ 31 | function assignReplicaSet(p_replset : Dynamic):Void; 32 | 33 | /** 34 | * Takes needed options from 'replset' and overwrites our own options. 35 | * @param p_replset 36 | */ 37 | function inheritReplSetOptionsFrom(p_replset : Dynamic):Void; 38 | 39 | /** 40 | * 41 | */ 42 | var connected : Bool; 43 | } -------------------------------------------------------------------------------- /js/npm/mongodb/Mongos.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | import js.npm.mongodb.MongoOption.MongoMongosOption; 3 | 4 | 5 | /** 6 | * Mongos constructor provides a connection to a mongos proxy including failover to additional servers 7 | * @author Eduardo Pons - eduardo@thelaborat.org 8 | */ 9 | @:native("require('mongodb').Mongos") 10 | extern class Mongos 11 | { 12 | 13 | /** 14 | * Mongos constructor provides a connection to a mongos proxy including failover to additional servers 15 | */ 16 | @:overload(function(p_list:Array):Void {}) 17 | function new(p_list : Array,p_options:MongoMongosOption):Void; 18 | 19 | } -------------------------------------------------------------------------------- /js/npm/mongodb/ObjectID.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * Native ObjectID instance. 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("require('mongodb').ObjectID") 8 | extern class ObjectID 9 | { 10 | 11 | /** 12 | * Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. 13 | * @param p_time 14 | * @return 15 | */ 16 | static function createFromTime(p_time:Int):ObjectID; 17 | 18 | /** 19 | * Creates an ObjectID from a hex string representation of an ObjectID. 20 | * @param p_hex 21 | * @return 22 | */ 23 | static function createFromHexString(p_hex:String):ObjectID; 24 | 25 | /** 26 | * Checks if a value is a valid bson ObjectId 27 | * @param p_id 28 | * @return 29 | */ 30 | static function isValid(p_id:Dynamic):Bool; 31 | 32 | /** 33 | * Create a new ObjectID instance. id (string) – Can be a 24 byte hex string, 12 byte binary string or a Number. 34 | */ 35 | @:overload(function():Void{}) 36 | function new(p_id:Dynamic) :Void; 37 | 38 | /** 39 | * Return the ObjectID id as a 24 byte hex string representation 40 | * @return 41 | */ 42 | function toHexString():String; 43 | 44 | /** 45 | * Compares the equality of this ObjectID with otherID. 46 | * @param p_op 47 | * @return 48 | */ 49 | function equals(p_op : ObjectID):Bool; 50 | 51 | /** 52 | * Returns the generation date (accurate up to the second) that this ID was generated. 53 | * @return 54 | */ 55 | function getTimestamp():Dynamic; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /js/npm/mongodb/OrderedBulkOperation.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * ... 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("(require('mongodb').OrderedBulkOperation)") 8 | extern class OrderedBulkOperation 9 | { 10 | 11 | var update : Dynamic; 12 | var updateOne : Dynamic; 13 | var replaceOne : Dynamic; 14 | var upsert : Dynamic; 15 | var removeOne : Dynamic; 16 | var remove : Dynamic; 17 | var insert : Dynamic; 18 | var find : Dynamic; 19 | var execute : Dynamic; 20 | 21 | 22 | } -------------------------------------------------------------------------------- /js/npm/mongodb/ReadPreference.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * A class representation of the Read Preference. 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("(require('mongodb').ReadPreference)") 8 | extern class ReadPreference 9 | { 10 | /** 11 | * Read from primary only. All operations produce an error (throw an exception where applicable) if primary is unavailable. Cannot be combined with tags (This is the default.). 12 | */ 13 | static var PRIMARY :String; 14 | 15 | /** 16 | * Read from primary if available, otherwise a secondary. 17 | */ 18 | static var PRIMARY_PREFERRED :String; 19 | 20 | /** 21 | * Read from secondary if available, otherwise error. 22 | */ 23 | static var SECONDARY :String; 24 | 25 | /** 26 | * Read from a secondary if available, otherwise read from the primary. 27 | */ 28 | static var SECONDARY_PREFERRED :String; 29 | 30 | /** 31 | * All modes read from among the nearest candidates, but unlike other modes, NEAREST will include both the primary and all secondaries in the random selection. 32 | */ 33 | static var NEAREST :String; 34 | 35 | /** 36 | * 37 | * @param p_type 38 | * @param p_tags 39 | */ 40 | function new(p_type:String,p_tags:Dynamic); 41 | } -------------------------------------------------------------------------------- /js/npm/mongodb/ReadStream.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | import js.node.events.EventEmitter; 3 | 4 | /** 5 | * Container class for ReadStreamEvent types. 6 | */ 7 | class ReadStreamEvent 8 | { 9 | /** 10 | * {function(item) { }} the data event triggers when a document is ready. 11 | */ 12 | static public var Data : String = "data"; 13 | /** 14 | * {function() {}} the end event triggers when there is no more documents available. 15 | */ 16 | static public var End : String = "end"; 17 | /** 18 | * {function() {}} the close event triggers when the stream is closed. 19 | */ 20 | static public var Close : String = "close"; 21 | /** 22 | * {function(err) {}} the error event triggers if an error happens. 23 | */ 24 | static public var Error : String = "error"; 25 | } 26 | 27 | /** 28 | * Stream interface for a file. 29 | * @author Eduardo Pons - eduardo@thelaborat.org 30 | */ 31 | @:native("(require('mongodb').ReadStream)") 32 | extern class ReadStream implements Dynamic 33 | //extends EventEmitter 34 | { 35 | 36 | /** 37 | * Creates stream interface for the file. 38 | * @param p_autoclose 39 | * @param p_gridstore 40 | */ 41 | function new(p_autoclose:Bool, p_gridstore:MongoGridStore):Void; 42 | 43 | 44 | } -------------------------------------------------------------------------------- /js/npm/mongodb/ReplSetServers.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | import js.node.http.Server as HTTPServer; 3 | import js.npm.mongodb.MongoOption.MongoReplSetOption; 4 | import js.npm.mongodb.MongoOption.MongoServerOption; 5 | 6 | /** 7 | * Set of Replica Servers. 8 | * @author Eduardo Pons - eduardo@thelaborat.org 9 | */ 10 | @:native("require('mongodb').ReplSetServers") 11 | extern class ReplSetServers 12 | { 13 | 14 | /** 15 | * ReplSet constructor provides replicaset functionality 16 | */ 17 | @:overload(function(p_list:Array):Void{}) 18 | function new(p_list : Array,p_option:MongoReplSetOption); 19 | 20 | /** 21 | * Creates a new server for the replset based on host. 22 | * @param p_host 23 | * @param p_replset 24 | * @return 25 | */ 26 | function createServer(p_host : String,p_replset : ReplSetServers):HTTPServer; 27 | } -------------------------------------------------------------------------------- /js/npm/mongodb/Symbol.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * A class representation of the BSON Symbol type. 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("(require('mongodb').Symbol)") 8 | extern class Symbol 9 | { 10 | 11 | /** 12 | * A class representation of the BSON Symbol type. 13 | * @param v 14 | */ 15 | function new(v:String):Void; 16 | 17 | /** 18 | * Access the wrapped string value. 19 | * @return 20 | */ 21 | function valueOf():String; 22 | 23 | 24 | } -------------------------------------------------------------------------------- /js/npm/mongodb/Timestamp.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * Defines a Timestamp class for representing a 64-bit two’s-complement integer value, which faithfully simulates the behavior of a Java “Timestamp”. This implementation is derived from TimestampLib in GWT. 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("(require('mongodb').Timestamp)") 8 | extern class Timestamp 9 | { 10 | 11 | var toInt : Dynamic; 12 | var toNumber : Dynamic; 13 | var toJSON : Dynamic; 14 | var toString : Dynamic; 15 | var getHighBits : Dynamic; 16 | var getLowBits : Dynamic; 17 | var getLowBitsUnsigned : Dynamic; 18 | var getNumBitsAbs : Dynamic; 19 | var isZero : Dynamic; 20 | var isNegative : Dynamic; 21 | var isOdd : Dynamic; 22 | var equals : Dynamic; 23 | var notEquals : Dynamic; 24 | var lessThan : Dynamic; 25 | var lessThanOrEqual : Dynamic; 26 | var greaterThan : Dynamic; 27 | var greaterThanOrEqual : Dynamic; 28 | var compare : Dynamic; 29 | var negate : Dynamic; 30 | var add : Dynamic; 31 | var subtract : Dynamic; 32 | var multiply : Dynamic; 33 | var div : Dynamic; 34 | var modulo : Dynamic; 35 | var not : Dynamic; 36 | var and : Dynamic; 37 | var or : Dynamic; 38 | var xor : Dynamic; 39 | var shiftLeft : Dynamic; 40 | var shiftRight : Dynamic; 41 | var shiftRightUnsigned : Dynamic; 42 | static var fromInt : Dynamic; 43 | static var fromNumber : Dynamic; 44 | static var fromBits : Dynamic; 45 | static var fromString : Dynamic; 46 | 47 | 48 | } -------------------------------------------------------------------------------- /js/npm/mongodb/UnorderedBulkOperation.hx: -------------------------------------------------------------------------------- 1 | package js.npm.mongodb; 2 | 3 | /** 4 | * ... 5 | * @author Eduardo Pons - eduardo@thelaborat.org 6 | */ 7 | @:native("(require('mongodb').UnorderedBulkOperation)") 8 | extern class UnorderedBulkOperation 9 | { 10 | 11 | var update : Dynamic; 12 | var updateOne : Dynamic; 13 | var replaceOne : Dynamic; 14 | var upsert : Dynamic; 15 | var removeOne : Dynamic; 16 | var remove : Dynamic; 17 | var insert : Dynamic; 18 | var find : Dynamic; 19 | var execute : Dynamic; 20 | 21 | } -------------------------------------------------------------------------------- /js/npm/msgpack/MsgPackLite.hx: -------------------------------------------------------------------------------- 1 | package js.npm.msgpack; 2 | 3 | #if nodejs 4 | import js.node.Buffer; 5 | import js.node.stream.Transform; 6 | #end 7 | 8 | @:jsRequire("msgpack-lite") 9 | extern class MsgPackLite 10 | { 11 | #if nodejs 12 | public static function encode(o :Dynamic) :Buffer; 13 | public static function decode(b :Buffer) :T; 14 | public static function createEncodeStream() :js.node.stream.Transform; 15 | #else 16 | public static function encode(o :Dynamic) :Dynamic; 17 | public static function decode(b :Dynamic) :T; 18 | #end 19 | } -------------------------------------------------------------------------------- /js/npm/node_static/Server.hx: -------------------------------------------------------------------------------- 1 | package js.npm.node_static; 2 | import js.node.http.IncomingMessage; 3 | import js.node.http.ServerResponse; 4 | 5 | /** 6 | * Creation options for node-static server 7 | */ 8 | extern class NodeStaticServerOption 9 | { 10 | var cache : Int; 11 | var headers : Dynamic; 12 | var indexFile : String; 13 | var serverInfo : String; 14 | var gzip : Bool; 15 | } 16 | 17 | /** 18 | * Externs for the 'node-static' library. 19 | * @author Eduardo Pons - eduardo@thelaborat.org 20 | */ 21 | @:native("(require('node-static').Server)") 22 | extern class Server 23 | { 24 | 25 | /** 26 | * CTOR 27 | * @param p_path 28 | * @param p_options 29 | */ 30 | function new(p_path:String, ?p_options:NodeStaticServerOption); 31 | 32 | /** 33 | * Serves the files. 34 | * @param p_request 35 | * @param p_response 36 | * @param p_callback 37 | */ 38 | @:overload(function (p_request:IncomingMessage, p_response:ServerResponse):Void{}) 39 | function serve(p_request:IncomingMessage, p_response:ServerResponse, p_callback:Error->Dynamic->Void):Void; 40 | 41 | /** 42 | * Serves a directory. 43 | * @param p_pathname 44 | * @param p_request 45 | * @param p_response 46 | * @param p_finish 47 | */ 48 | function serveDir(p_pathname : String, p_request : IncomingMessage, p_response:ServerResponse, p_finish : Int->Dynamic->Void):Void; 49 | 50 | /** 51 | * Serves a file. 52 | * @param p_pathname 53 | * @param p_status 54 | * @param p_headers 55 | * @param p_request 56 | * @param p_response 57 | */ 58 | function serveFile(p_pathname : String, p_status:Int, p_headers : Dynamic, p_request : IncomingMessage, p_response:ServerResponse):Void; 59 | } -------------------------------------------------------------------------------- /js/npm/nodegraph/ReactNodeGraph.hx: -------------------------------------------------------------------------------- 1 | package js.npm.nodegraph; 2 | 3 | import react.ReactComponent; 4 | 5 | @:jsRequire('react-node-graph') 6 | extern class ReactNodeGraph extends react.ReactComponent { } 7 | 8 | -------------------------------------------------------------------------------- /js/npm/pageres/Pageres.hx: -------------------------------------------------------------------------------- 1 | package js.npm.pageres; 2 | 3 | import js.Promise; 4 | import js.node.stream.Readable; 5 | 6 | typedef PageresOpts = { 7 | ?delay :Float, 8 | ?timeout :Float, 9 | ?crop :Bool, 10 | ?filename :String, 11 | ?script :String 12 | } 13 | 14 | @:jsRequire('pageres') 15 | extern class Pageres extends js.node.events.EventEmitter 16 | { 17 | public function new(?opts :PageresOpts) :Void; 18 | 19 | public function run() :Promise>; 20 | public function dest(d :String) :Pageres; 21 | public function src(url :String, ?sizes :Array, ?opts :PageresOpts) :Pageres; 22 | } -------------------------------------------------------------------------------- /js/npm/parseduration/ParseDuration.hx: -------------------------------------------------------------------------------- 1 | package js.npm.parseduration; 2 | 3 | import haxe.extern.EitherType; 4 | 5 | // https://www.npmjs.com/package/parse-duration 6 | @:jsRequire("parse-duration") 7 | extern class ParseDuration 8 | { 9 | @:selfCall 10 | static function parse(t :String) :EitherType; 11 | } 12 | -------------------------------------------------------------------------------- /js/npm/pem/Pem.hx: -------------------------------------------------------------------------------- 1 | package js.npm.pem; 2 | 3 | import js.Error; 4 | 5 | typedef PemCreateCertificationOptions = { 6 | @:optional var serviceKey :String; 7 | @:optional var serviceKeyPassword :String; 8 | @:optional var serviceCertificate :String; 9 | @:optional var serial :String; 10 | @:optional var selfSigned :Bool; 11 | @:optional var days :Int; 12 | @:optional var extFile :String; 13 | @:optional var config :String; 14 | } 15 | 16 | typedef PemKeys ={ 17 | var serviceKey :String; 18 | var certificate :String; 19 | } 20 | 21 | @:jsRequire("pem") 22 | extern class Pem 23 | { 24 | static function createCertificate(opts : PemCreateCertificationOptions, cb :Null->PemKeys->Void) :Void; 25 | } 26 | -------------------------------------------------------------------------------- /js/npm/pkgcloud/PkgCloud.hx: -------------------------------------------------------------------------------- 1 | package js.npm.pkgcloud; 2 | 3 | import haxe.extern.EitherType; 4 | 5 | import js.Node; 6 | import js.Error; 7 | import js.node.stream.Writable; 8 | import js.node.stream.Readable; 9 | 10 | @:enum 11 | abstract ProviderType(String) { 12 | var amazon = 'amazon'; 13 | var google = 'google'; 14 | //More to come 15 | } 16 | 17 | //https://github.com/pkgcloud/pkgcloud/blob/master/docs/providers/amazon.md#using-compute 18 | //https://github.com/pkgcloud/pkgcloud/blob/master/lib/pkgcloud/amazon/client.js 19 | typedef ClientOptionsAmazon = {>ProviderCredentials, 20 | var keyId :String; 21 | var key :String; 22 | var region :String; 23 | @:optional var securityGroup :String; 24 | @:optional var securityGroupId :String; 25 | @:optional var serversUrl :String; 26 | } 27 | 28 | typedef ComputeServerCreateOptions = {} 29 | 30 | typedef ComputeServerCreateOptionsAmazon = {>ComputeServerCreateOptions, 31 | @:optional var name :String; 32 | @:optional var image :Dynamic; 33 | @:optional var flavor :Dynamic; 34 | } 35 | 36 | @:enum 37 | abstract PkgCloudComputeStatus(String) { 38 | var error = 'ERROR'; 39 | var provisioning = 'PROVISIONING'; 40 | var reboot = 'REBOOT'; 41 | var running = 'RUNNING'; 42 | var stopped = 'STOPPED'; 43 | var terminated = 'TERMINATED'; 44 | var unknown = 'UNKNOWN'; 45 | var updating = 'UPDATING'; 46 | } 47 | 48 | typedef PkgCloudServer = { 49 | var id :String; 50 | var name :String; 51 | var status :PkgCloudComputeStatus; 52 | var addresses :Dynamic; 53 | var imageId :String; 54 | } 55 | 56 | typedef PkgCloudServerAws = {>PkgCloudServer, 57 | var imageId :String; 58 | var launchTime :String; //Format example: Mon Jan 04 2016 10:05:07 GMT-0800 (PST) 59 | var flavorId :String; 60 | var original :Dynamic; 61 | } 62 | 63 | typedef Image = { 64 | var name :String; 65 | } 66 | 67 | typedef ComputeClient = { 68 | function getServers(cb :Null->Array->Void) :Void; 69 | function createServer(options :ComputeServerCreateOptions, cb :Null->PkgCloudServer->Void) :Void; 70 | function destroyServer(serverId :String, cb :Null->PkgCloudServer->Void) :Void; 71 | function getServer(serverId :String, cb :Null->PkgCloudServer->Void) :Void; 72 | function rebootServer(serverId :String, cb :Null->PkgCloudServer->Void) :Void; 73 | function getImages(cb :Null->Array->Void) :Void; 74 | } 75 | 76 | typedef Container = { 77 | var name :String; 78 | function create(options :Dynamic, cb :Null->Container->Void) :Void; 79 | function refresh(cb :Null->Container->Void) :Void; 80 | function destroy(cb :Null->Void) :Void; 81 | function upload(file :String, local :Dynamic, options :Dynamic, cb :Null->Void) :IWritable; 82 | function getFiles(cb :Null->Array->Void) :Void; 83 | function removeFile(file :File, ?cb :Null->Void) :Void; 84 | } 85 | 86 | typedef File = { 87 | var name :String; 88 | var fullPath :String; 89 | var containerName :String; 90 | function remove(cb :Null->Void) :Void; 91 | function download(options :Dynamic, ?cb :Null->Void) :IReadable; 92 | } 93 | 94 | typedef StorageClient = { 95 | function getContainers(cb :Error->Array->Void) :Void; 96 | function createContainer(options :Dynamic, cb :Null->Container->Void) :Void; 97 | function destroyContainer(containerName :String, cb :Null->Void) :Void; 98 | function getContainer(containerName :String, cb :Null->Container->Void) :Void; 99 | 100 | function upload(options :Dynamic) :IWritable; 101 | function download(options :Dynamic, ?cb :Null->Void) :IReadable; 102 | @:overload(function(container :EitherType, options :Dynamic, cb :Null->Array->Void):Void {}) 103 | function getFiles(container :Container, cb :Null->Array->Void) :Void; 104 | function getFile(container :Container, fileName :String, cb :Null->File->Void) :Void; 105 | function removeFile(container :Container, file :File, ?cb :Null->Void) :Void; 106 | } 107 | 108 | typedef Credentials = { 109 | } 110 | 111 | typedef ProviderCredentials = { >Credentials, 112 | @:optional 113 | var provider :ProviderType; 114 | } 115 | 116 | typedef ProviderCredentialsLocal = { >ProviderCredentials, 117 | var baseLocalPath :String; 118 | } 119 | 120 | typedef ProviderLocal = { 121 | function createClient(credentials :ProviderCredentialsLocal) :T; 122 | } 123 | 124 | typedef ClientCreator = { 125 | function createClient(credentials :Credentials) :T; 126 | } 127 | 128 | typedef ProviderClientCreator = { 129 | function createClient(credentials :ProviderCredentials) :T; 130 | } 131 | 132 | typedef Provider = { 133 | var compute :ClientCreator; 134 | var storage :ClientCreator; 135 | //Add more here as needed. 136 | } 137 | 138 | typedef Google = { 139 | var storage :ClientCreator; 140 | } 141 | 142 | typedef Providers = {> Iterable, 143 | var amazon :Provider; 144 | var azure :Provider; 145 | var digitalocean :Provider; 146 | var google :Provider; 147 | var local :Provider; 148 | } 149 | 150 | @:jsRequire('pkgcloud') 151 | extern class PkgCloud extends js.node.events.EventEmitter 152 | { 153 | static public var providers :Providers; 154 | static public var compute :ClientCreator; 155 | static public var storage :ClientCreator; 156 | } -------------------------------------------------------------------------------- /js/npm/prettyms/PrettyMs.hx: -------------------------------------------------------------------------------- 1 | package js.npm.prettyms; 2 | 3 | @:jsRequire("pretty-ms") 4 | extern class PrettyMs 5 | { 6 | @:selfCall 7 | public static function pretty(ms :Float) :String; 8 | } 9 | -------------------------------------------------------------------------------- /js/npm/prometheus/Prometheus.hx: -------------------------------------------------------------------------------- 1 | package js.npm.prometheus; 2 | 3 | import haxe.extern.Rest; 4 | 5 | typedef PrometheusCollectionArgs = { 6 | ?registry :PrometheusRegistry, 7 | ?timeout :Int, 8 | } 9 | 10 | // https://www.npmjs.com/package/redis-dump 11 | @:jsRequire("prom-client") 12 | extern class PrometheusClient implements Dynamic 13 | { 14 | static var register :PrometheusRegistry; 15 | static function collectDefaultMetrics(?args :PrometheusCollectionArgs) :Void; 16 | 17 | static function linearBuckets(start :Float, interval :Float, count :Int) :Array; 18 | static function exponentialBuckets(start :Float, factor :Float, count :Int) :Array; 19 | 20 | static var contentType :String; 21 | } 22 | 23 | @:jsRequire("prom-client", "Registry") 24 | extern class PrometheusRegistry 25 | { 26 | public function new() :Void; 27 | 28 | var contentType :String; 29 | function metrics() :Dynamic; 30 | } 31 | 32 | typedef BaseConfig = { 33 | var help : String; 34 | @:optional var labelNames : Array; 35 | var name : String; 36 | } 37 | 38 | extern class PrometheusBase 39 | { 40 | function reset() :Void; 41 | function labels(values:Rest) :T; 42 | } 43 | 44 | extern class PrometheusBaseWithTimer 45 | extends PrometheusBase 46 | { 47 | function startTimer(?labels :Dynamic) :Void->Void; 48 | } 49 | 50 | @:jsRequire("prom-client", "Counter") 51 | extern class PrometheusCounter extends PrometheusBase 52 | { 53 | public function new(config :BaseConfig) :Void; 54 | 55 | @:overload(function(labels :Dynamic, ?amount :Float) : Void {}) 56 | function inc(?amount :Float) :Void; 57 | } 58 | 59 | @:jsRequire("prom-client", "Gauge") 60 | extern class PrometheusGauge extends PrometheusBaseWithTimer 61 | { 62 | public function new(config :BaseConfig) :Void; 63 | 64 | @:overload(function(labels :Dynamic, ?amount :Float) : Void {}) 65 | function inc(?amount :Float) :Void; 66 | 67 | @:overload(function(labels :Dynamic, ?amount :Float) : Void {}) 68 | function dec(?amount :Float) :Void; 69 | 70 | @:overload(function(labels :Dynamic, amount :Float) : Void {}) 71 | function set(amount :Float) :Void; 72 | 73 | function setToCurrentTime() :Void; 74 | } 75 | 76 | typedef SummaryConfig = { >BaseConfig, 77 | var percentiles :Array; 78 | } 79 | 80 | @:jsRequire("prom-client", "Summary") 81 | extern class PrometheusSummary extends PrometheusBaseWithTimer 82 | { 83 | function new(config :SummaryConfig) :Void; 84 | 85 | @:overload(function(labels :Dynamic, val :Float) : Void {}) 86 | function observe(val :Float) :Void; 87 | } 88 | 89 | typedef HistogramConfig = { >BaseConfig, 90 | var buckets :Array; 91 | } 92 | 93 | @:jsRequire("prom-client", "Histogram") 94 | extern class PrometheusHistogram extends PrometheusBaseWithTimer 95 | { 96 | function new(config :HistogramConfig) :Void; 97 | 98 | @:overload(function(labels :Dynamic, val :Float) : Void {}) 99 | function observe(val :Float) :Void; 100 | } -------------------------------------------------------------------------------- /js/npm/radium/Radium.hx: -------------------------------------------------------------------------------- 1 | package js.npm.radium; 2 | 3 | @:jsRequire("radium") 4 | extern class Radium 5 | { 6 | } 7 | 8 | -------------------------------------------------------------------------------- /js/npm/randomsentence/RandomSentence.hx: -------------------------------------------------------------------------------- 1 | package js.npm.randomsentence; 2 | 3 | @:jsRequire('random-sentence') 4 | extern class RandomSentence 5 | { 6 | @:selfCall function new() :Void; 7 | 8 | @:selfCall static function generate(?opts :{min:Int,max:Int}) :String; 9 | } -------------------------------------------------------------------------------- /js/npm/reactdnd/ReactDnD.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reactdnd; 2 | /** 3 | * http://react-dnd.github.io/react-dnd/docs-overview.html 4 | */ 5 | 6 | import haxe.extern.EitherType; 7 | 8 | import react.ReactComponent; 9 | 10 | typedef XY={x:Float,y:Float}; 11 | 12 | typedef DragTargetType=EitherTypeEitherType>,Array>>; 13 | 14 | @:jsRequire('react-dnd') 15 | extern class ReactDnD 16 | { 17 | public static function DragSource(type :DragTargetType, spec: DragSourceSpec, collect :CollectDragSource) :Class->Class; 18 | public static function DropTarget(type :DragTargetType, spec: DropTargetSpec, collect :CollectDropTarget) :Class->Class; 19 | public static function DragDropContext(contextClass :Class) :Class->Class; 20 | public static function DragLayer(collect :CollectDragLayer ,?options :Dynamic) :Class->Class; 21 | } 22 | 23 | typedef DragSourceSpec = 24 | { 25 | // DraggedItemProps is the minimal props 26 | function beginDrag(props :SourceProps, monitor :DragSourceMonitor, component :ReactComponent) :DraggedItemProps; 27 | @:optional function endDrag(props :SourceProps, monitor :DragSourceMonitor, component :ReactComponent) :Void; 28 | @:optional function canDrag(props :SourceProps, monitor :DragSourceMonitor) :Bool; 29 | @:optional function isDragging(props :SourceProps, monitor :DragSourceMonitor) :Bool; 30 | } 31 | 32 | //http://react-dnd.github.io/react-dnd/docs-drop-target.html 33 | typedef DropTargetSpec = 34 | { 35 | /** 36 | * If you return an object, it is going to become the drop result and 37 | * will be available to the drag source in its endDrag method as 38 | * monitor.getDropResult() 39 | */ 40 | @:optional function drop(props :DraggedItemProps, monitor :DropTargetMonitor, component :Dynamic) :Null; 41 | @:optional function hover(props :DraggedItemProps, monitor :DropTargetMonitor, component :Dynamic) :Void; 42 | @:optional function canDrop(props :DraggedItemProps, monitor :DropTargetMonitor) :Bool; 43 | } 44 | 45 | typedef DragSourceMonitor = { 46 | function canDrag() :Bool; 47 | function isDragging() :Bool; 48 | function getItemType() :String; 49 | function getItem() :DraggedItemProps; 50 | function getDropResult() :Dynamic; 51 | function didDrop() :Bool; 52 | function getInitialClientOffset() :XY; 53 | function getInitialSourceClientOffset() :XY; 54 | function getClientOffset() :XY; 55 | function getDifferenceFromInitialOffset() :XY; 56 | function getSourceClientOffset() :XY; 57 | } 58 | 59 | typedef DropTargetMonitor = { 60 | function canDrop() :Bool; 61 | function isOver(?opts :{ shallow: Bool }) :Bool; 62 | function getItemType() :String; 63 | function getItem() :DraggedItemProps; 64 | function getDropResult() :DropResult; 65 | function didDrop() :Bool; 66 | function getInitialClientOffset() :XY; 67 | function getInitialSourceClientOffset() :XY; 68 | function getClientOffset() :XY; 69 | function getDifferenceFromInitialOffset() :XY; 70 | function getSourceClientOffset() :XY; 71 | } 72 | 73 | typedef DragLayerMonitor = { 74 | function isDragging() :Bool; 75 | function getItemType() :String; 76 | function getItem() :DraggedItemProps; 77 | function getInitialClientOffset() :XY; 78 | function getInitialSourceClientOffset() :XY; 79 | function getClientOffset() :XY; 80 | function getDifferenceFromInitialOffset() :XY; 81 | function getSourceClientOffset() :XY; 82 | } 83 | 84 | typedef ElementOrNode=Dynamic; 85 | 86 | typedef DragSourceConnector = { 87 | function dragSource() :ElementOrNode->?Dynamic->ReactElement; 88 | function dragPreview() :ElementOrNode->?Dynamic->ReactElement; 89 | } 90 | 91 | typedef DropTargetConnector = { 92 | function dropTarget() :ElementOrNode->?Dynamic->ReactElement; 93 | } 94 | 95 | /* 96 | * Specifies which props to inject into your component. 97 | * It should return a plain object of the props to inject into your component. 98 | */ 99 | typedef CollectDragSource = DragSourceConnector->DragSourceMonitor->CollectedProps; 100 | typedef CollectDropTarget = DropTargetConnector->DropTargetMonitor->CollectedProps; 101 | typedef CollectDragLayer = DragLayerMonitor->CollectedProps; 102 | 103 | @:jsRequire('react-dnd-html5-backend') 104 | extern class HTML5Backend {} 105 | 106 | @:jsRequire('react-dnd', 'DragDropContextProvider') 107 | extern class DragDropContextProvider extends react.ReactComponent { } 108 | 109 | @:jsRequire('react-dnd', 'DragDropContext') 110 | extern class DragDropContext extends react.ReactComponent { } 111 | -------------------------------------------------------------------------------- /js/npm/reactgridlayout/ReactGridLayout.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reactgridlayout; 2 | 3 | /** https://github.com/STRML/react-grid-layout#responsive-usage */ 4 | 5 | typedef LayoutData = { 6 | @:optional var i :String; 7 | @:optional var x :Float; 8 | @:optional var y :Float; 9 | @:optional var w :Float; 10 | @:optional var h :Float; 11 | @:optional var minW :Float; 12 | @:optional var maxW :Float; 13 | @:optional var minH :Float; 14 | @:optional var maxH :Float; 15 | @:optional var isDraggable :Bool; 16 | @:optional var isResizable :Bool; 17 | } 18 | 19 | @:jsRequire('react-grid-layout') 20 | extern class ReactGridLayout extends react.ReactComponent { } 21 | 22 | @:jsRequire('react-grid-layout', 'Responsive') 23 | extern class ResponsiveReactGridLayout extends ReactGridLayout {} 24 | 25 | 26 | @:jsRequire('react-grid-layout', 'WidthProvider') 27 | extern class ReactGridWidthProvider extends ReactGridLayout 28 | { 29 | @:selfCall 30 | public function new(cls :Class) :Void; 31 | } 32 | 33 | // class ReactGridWidthProviderImpl 34 | // { 35 | // public static var ResponsiveReactGridLayout :Class = cast new ReactGridWidthProvider(ReactGridResponsive); 36 | // } 37 | -------------------------------------------------------------------------------- /js/npm/reactinfinite/Infinite.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reactinfinite; 2 | 3 | @:jsRequire('react-infinite') 4 | extern class Infinite extends react.ReactComponent { } -------------------------------------------------------------------------------- /js/npm/reactjsonviewer/ReactJsonViewer.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reactjsonviewer; 2 | 3 | /** https://github.com/nsisodiya/react-json-viewer */ 4 | 5 | @:jsRequire('react-json-viewer') 6 | extern class ReactJsonViewer extends react.ReactComponent { } 7 | -------------------------------------------------------------------------------- /js/npm/reactlineto/LineTo.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reactlineto; 2 | 3 | @:jsRequire('react-lineto', 'default') 4 | extern class LineTo extends react.ReactComponent {} 5 | 6 | @:jsRequire('react-lineto', 'SteppedLine') 7 | extern class SteppedLine extends react.ReactComponent { } 8 | 9 | @:jsRequire('react-lineto', 'SteppedLineTo') 10 | extern class SteppedLineTo extends react.ReactComponent { } 11 | 12 | @:jsRequire('react-lineto', 'Line') 13 | extern class Line extends react.ReactComponent { } 14 | -------------------------------------------------------------------------------- /js/npm/reactlist/ReactList.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reactlist; 2 | 3 | @:jsRequire('react-list') 4 | extern class ReactList extends react.ReactComponent { } -------------------------------------------------------------------------------- /js/npm/reactsvg/ReactSvg.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reactsvg; 2 | 3 | import react.ReactComponent; 4 | 5 | @:jsRequire('react-svg') 6 | extern class ReactSvg extends ReactComponent {} 7 | -------------------------------------------------------------------------------- /js/npm/reacttable/ReactTable.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reacttable; 2 | 3 | @:jsRequire('react-table', 'default') 4 | extern class ReactTable extends react.ReactComponent {} -------------------------------------------------------------------------------- /js/npm/reacttapeventplugin/ReactTapEventPlugin.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reacttapeventplugin; 2 | 3 | @:jsRequire('react-tap-event-plugin') 4 | extern class ReactTapEventPlugin 5 | { 6 | @:selfCall 7 | public function new():Void; 8 | 9 | @:selfCall 10 | public function call():Void; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /js/npm/reactvirtualized/AutoSizer.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reactvirtualized; 2 | 3 | @:jsRequire('react-virtualized','AutoSizer') 4 | extern class AutoSizer extends react.ReactComponent { } -------------------------------------------------------------------------------- /js/npm/reactvirtualized/InfiniteLoader.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reactvirtualized; 2 | 3 | @:jsRequire('react-virtualized','InfiniteLoader') 4 | extern class InfiniteLoader extends react.ReactComponent { } -------------------------------------------------------------------------------- /js/npm/reactvirtualized/List.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reactvirtualized; 2 | 3 | @:jsRequire('react-virtualized','List') 4 | extern class List extends react.ReactComponent { } -------------------------------------------------------------------------------- /js/npm/redis/RedisClient.hx: -------------------------------------------------------------------------------- 1 | package js.npm.redis; 2 | 3 | import js.Node; 4 | import js.node.events.EventEmitter; 5 | import js.Error; 6 | 7 | typedef Channel = String; 8 | typedef ChannelCount = Int; 9 | typedef IntegerReply = Error->Int->Void; 10 | typedef BooleanReply = Error->Bool->Void; 11 | typedef StatusReply = Error->String->Void; 12 | typedef SubscribeReply = Channel->ChannelCount->Void; 13 | typedef MessageReply = Channel->String->Void; 14 | typedef BulkReply = Error->Dynamic->Void; 15 | typedef MultiReply = Error->Array->Void; 16 | typedef MultiCommand = Array; 17 | 18 | typedef Multi = { 19 | function exec(cb :MultiReply) :Void; 20 | } 21 | 22 | @:enum abstract RedisEvent(Event) to Event { 23 | var Ready : RedisEventVoid> = "ready"; 24 | var Connect : RedisEventVoid> = "connect"; 25 | var Reconnecting : RedisEvent<{delay:Int,attempt:Int}->Void> = "reconnecting"; 26 | var Error : RedisEventVoid> = "error"; 27 | var End : RedisEventVoid> = "end"; 28 | var Drain : RedisEventVoid> = "drain"; 29 | var Warning : RedisEventVoid> = "warning"; 30 | var Idle : RedisEventVoid> = "idle"; 31 | var Message : RedisEvent = "message"; 32 | var PMessage : RedisEvent = "pmessage"; 33 | var Subscribe : RedisEvent = "subscribe"; 34 | var PSubscribe : RedisEvent = "psubscribe"; 35 | var Unsubscribe : RedisEvent = "unsubscribe"; 36 | var PUnsubscribe : RedisEvent = "punsubscribe"; 37 | } 38 | 39 | @:jsRequire('redis') 40 | extern class RedisClient extends js.node.events.EventEmitter 41 | { 42 | public static function createClient(?port :Int, ?address :String, ?options :Dynamic):RedisClient; 43 | public static function print(?arg1 :Dynamic, ?arg2 :Dynamic, ?arg3 :Dynamic, ?arg4 :Dynamic):Void; 44 | 45 | public var connection_options :{host:String, port:Int}; 46 | 47 | /** Forcibly close the connection to the Redis server. Note that this does not wait until all replies have been parsed. */ 48 | public function end(flush :Bool):Void; 49 | /** Exit cleanly. */ 50 | public function quit():Void; 51 | public function info(cb:BulkReply):Void; 52 | public function save(cb:StatusReply):Void; 53 | public function bgsave(cb:StatusReply):Void; 54 | public function lastsave(cb:IntegerReply):Void; 55 | public function unref():Void; 56 | 57 | // all 58 | public function exists(k:String,cb:IntegerReply):Void; 59 | public function del(k:String,cb:IntegerReply):Void; 60 | public function type(k:String,cb:StatusReply):Void; 61 | public function keys(pattern:String,cb:MultiReply):Void; 62 | public function randomkey(k:String,cb:StatusReply):Void; 63 | public function rename(k:String,nk:String,cb:StatusReply):Void; 64 | public function renamenx(k:String,nk:String,cb:StatusReply):Void; 65 | public function dbsize(cb:IntegerReply):Void; 66 | public function expire(k:String,secs:Int,cb:IntegerReply):Void; 67 | public function ttl(k:String,cb:IntegerReply):Void; 68 | public function select(index:Int,cb:StatusReply):Void; 69 | public function move(k:String,index:Int,cb:IntegerReply):Void; 70 | public function flushdb(cb:StatusReply):Void; 71 | public function flushall(cb:StatusReply):Void; 72 | 73 | // strings 74 | public function set(k:String,v:String,cb:BooleanReply):Void; 75 | public function get(k:String,cb:StatusReply):Void; 76 | public function incr(k:String,cb:IntegerReply):Void; 77 | public function incrby(k:String,by:Int,cb:IntegerReply):Void; 78 | public function decr(k:String,cb:IntegerReply):Void; 79 | public function decrby(k:String,by:Int,cb:IntegerReply):Void; 80 | public function setnx(k:String,v:String,cb:BooleanReply):Void; 81 | public function mset(ks:Array,cb:BooleanReply):Void; 82 | public function msetnx(ks:Array,cb:BooleanReply):Void; 83 | public function mget(ks:Array,cb:Error->Array->Void):Void; 84 | public function getset(k:String,v:String,cb:StatusReply):Void; 85 | public function append(k:String,v:String,cb:IntegerReply):Void; 86 | public function substr(k:String,s:Int,e:Int,cb:StatusReply):Void; 87 | public function setex(k:String,t:Int,v:Dynamic,cb:StatusReply):Void; 88 | 89 | // lists 90 | @:overload(function(args:Array, cb:IntegerReply):Void {}) 91 | public function lpush(k:String,v:String,cb:IntegerReply):Void; 92 | public function rpush(k:String,v:String,cb:IntegerReply):Void; 93 | public function llen(k:String,cb:IntegerReply):Void; 94 | public function lrange(k:String,s:Int,e:Int,cb:MultiReply):Void; 95 | public function ltrim(k:String,s:Int,e:Int,cb:StatusReply):Void; 96 | public function lindex(l:String,i:Int,cb:BulkReply):Void; 97 | public function lset(k:String,i:Int,v:String,cb:StatusReply):Void; 98 | public function lrem(k:String,c:Int,v:String,cb:IntegerReply):Void; 99 | public function lpop(k:String,cb:MultiReply):Void; 100 | public function rpop(k:String,cb:MultiReply):Void; 101 | public function blpop(k:String,s:Int,cb:MultiReply):Void; 102 | public function brpop(k:String,s:Int,cb:MultiReply):Void; 103 | public function rpoplpush(sk:String,dk:String,cb:BulkReply):Void; 104 | 105 | // sets 106 | @:overload(function(args:Array, cb:IntegerReply):Void {}) 107 | public function sadd(k:String,v:String,cb:IntegerReply):Void; 108 | public function srem(k:String,v:String,cb:IntegerReply):Void; 109 | @:overload(function(k:String,count:Int,cb:BulkReply):Void {}) 110 | public function spop(k:String,cb:BulkReply):Void; 111 | public function smove(sk:String,dk:String,member:String,cb:IntegerReply):Void; 112 | public function scard(k:String,cb:IntegerReply):Void; 113 | public function sismember(k:String,m:String,cb:IntegerReply):Void; 114 | public function sinter(k1:String,k2:String,cb:MultiReply):Void; 115 | public function sinterstore(dst:String,k1:String,k2:String,cb:StatusReply):Void; 116 | public function sunion(k1:String,k2:String,cb:MultiReply):Void; 117 | public function sunionstore(dst:String,k1:String,k2:String,cb:StatusReply):Void; 118 | public function sdiff(k1:String,k2:String,cb:MultiReply):Void; 119 | public function sdiffstore(dst:String,k1:String,k2:String,cb:StatusReply):Void; 120 | public function smembers(k:String,cb:MultiReply):Void; 121 | public function srandmember(k:String,cb:BulkReply):Void; 122 | 123 | // hash 124 | @:overload(function(args:Array, cb:IntegerReply):Void {}) 125 | public function hset(k:String,f:String,v:String,cb:IntegerReply):Void; 126 | public function hget(k:String,f:String,cb:BulkReply):Void; 127 | public function hsetnx(k:String,f:String,v:String,cb:IntegerReply):Void; 128 | @:overload(function(k:String,f:Dynamic,cb:StatusReply):Void {}) 129 | public function hmset(k:String, f:Array,cb:StatusReply):Void; 130 | public function hmget(k:Array,cb:MultiReply):Void; 131 | public function hincrby(k:String,f:String,v:Int,cb:IntegerReply):Void; 132 | public function hexists(k:String,f:String,cb:IntegerReply):Void; 133 | public function hdel(k:String,f:String,cb:IntegerReply):Void; 134 | public function hlen(k:String,cb:IntegerReply):Void; 135 | public function hkeys(k:String,cb:MultiReply):Void; 136 | public function hvals(k:String,cb:MultiReply):Void; 137 | public function hgetall(k:String,cb:MultiReply):Void; 138 | 139 | // sorted sets 140 | public function zadd(k:String,s:Int,m:String,cb:IntegerReply):Void; 141 | public function zrem(k:String,m:String,cb:IntegerReply):Void; 142 | public function zincrby(k:String,i:Int,m:String,cb:IntegerReply):Void; 143 | public function zrank(k:String,m:String,cb:BulkReply):Void; 144 | public function zrankrev(k:String,m:String,cb:BulkReply):Void; 145 | public function zrange(k:String,s:Int,e:Int,cb:MultiReply):Void; 146 | public function zrevrange(k:String,s:Int,e:Int,cb:MultiReply):Void; 147 | public function zrangebyscore(k:String,min:Int,max:Int,cb:MultiReply):Void; 148 | public function zremrangebyrank(k:String,s:Int,e:Int,cb:IntegerReply):Void; 149 | public function zremrangebyscore(k:String,min:Int,max:Int,cb:IntegerReply):Void; 150 | public function zcard(k:String,cb:IntegerReply):Void; 151 | public function zscore(k:String,e:String,cb:BulkReply):Void; 152 | public function zunionstore(prms:Array,cb:IntegerReply):Void; 153 | public function zinterstore(prms:Array,cb:IntegerReply):Void; 154 | public function sort(prms:Array,cb:MultiReply):Void; 155 | 156 | // pubsub 157 | public function subscribe(c:Channel):Void; 158 | public function unsubscribe(c:Channel):Void; 159 | public function psubscribe(c:Channel):Void; 160 | public function punsubscribe(c:Channel):Void; 161 | public function publish(c:Channel,m:String):Void; 162 | 163 | // Misc 164 | public function multi(?prms:Array):Multi; 165 | public function eval(prms:MultiCommand,cb:Error->Dynamic->Void):Void; 166 | public function evalsha(prms:MultiCommand,cb:Error->Dynamic->Void):Void; 167 | 168 | private function new(); 169 | } 170 | -------------------------------------------------------------------------------- /js/npm/redisdump/RedisDump.hx: -------------------------------------------------------------------------------- 1 | package js.npm.redisdump; 2 | 3 | // https://www.npmjs.com/package/redis-dump 4 | @:jsRequire("redis-dump") 5 | extern class RedisDump 6 | { 7 | @:selfCall 8 | public static function dump(query :Dynamic, cb :js.Error->Dynamic->Void) :Void; 9 | } 10 | -------------------------------------------------------------------------------- /js/npm/redismock/RedisClientMock.hx: -------------------------------------------------------------------------------- 1 | package js.npm.redismock; 2 | 3 | @:jsRequire("redis-mock") 4 | extern class RedisClientMock 5 | { 6 | public static function createClient():js.npm.redis.RedisClient; 7 | } -------------------------------------------------------------------------------- /js/npm/reduxlogger/ReduxLogger.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reduxlogger; 2 | 3 | typedef IMiddleware = Dynamic; 4 | 5 | @:jsRequire('redux-logger') 6 | extern class ReduxLogger 7 | { 8 | public static function createLogger(?opts :Dynamic) :IMiddleware; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /js/npm/reduxpersist/ReduxPersist.hx: -------------------------------------------------------------------------------- 1 | package js.npm.reduxpersist; 2 | 3 | @:jsRequire('redux-persist') 4 | extern class ReduxPersist 5 | { 6 | public static function persistStore() :Dynamic; 7 | public static function persistReducer(opts :Dynamic, reducer :Dynamic) :Dynamic; 8 | } 9 | 10 | @:jsRequire('redux-persist/integration/react') 11 | extern class PersistGate extends react.ReactComponent { } 12 | 13 | 14 | @:jsRequire('redux-persist/lib/storage') 15 | extern class ReduxPersistStorage{ } 16 | 17 | -------------------------------------------------------------------------------- /js/npm/request/Request.hx: -------------------------------------------------------------------------------- 1 | package js.npm.request; 2 | 3 | import js.node.Stream; 4 | import js.node.stream.Readable; 5 | import js.node.stream.Writable; 6 | 7 | #if (haxe_ver >= 4) 8 | import js.lib.Error; 9 | #else 10 | import js.Error; 11 | #end 12 | 13 | typedef HttpResponse = { 14 | var statusCode :Int; 15 | } 16 | typedef Body=String; 17 | 18 | @:jsRequire("request") 19 | extern class Request 20 | { 21 | @:selfCall public static function request(urlOrParams :Dynamic, ?cb :Null->Null->Null->Void) :IStream; 22 | public static function post(urlOrParams :Dynamic, ?cb :Null->Null->Null->Void) :IWritable; 23 | public static function get(urlOrParams :Dynamic, ?cb :Null->Null->Null->Void) :IReadable; 24 | } 25 | -------------------------------------------------------------------------------- /js/npm/rsmq/Rsmq.hx: -------------------------------------------------------------------------------- 1 | package js.npm.rsmq; 2 | 3 | /* https://github.com/smrchy/rsmq */ 4 | 5 | import js.npm.redis.RedisClient; 6 | 7 | import js.Error; 8 | 9 | typedef RsmqConstructorOptions = { 10 | @:optional var host :String; 11 | @:optional var port :Int; 12 | @:optional var ns :String; 13 | @:optional var client :RedisClient; 14 | @:optional var options :Dynamic; 15 | } 16 | 17 | typedef RsmqCreateQueueOptions = { 18 | var qname :String; 19 | @:optional var vt :Float; 20 | @:optional var delay :Float; 21 | @:optional var maxSize :Int; 22 | } 23 | 24 | typedef RsmqSendMessageOptions = { 25 | var qname :String; 26 | var message :T; 27 | @:optional var delay :Float; 28 | } 29 | 30 | typedef RsmqRecieveMessageOptions = { 31 | var qname :String; 32 | } 33 | 34 | typedef RsmqDeleteMessageOptions = { 35 | var qname :String; 36 | var id :RsmqMessageId; 37 | } 38 | 39 | typedef RsmqMessageId=String; 40 | 41 | typedef RsmqResponse=Int; 42 | 43 | typedef RsmqMessage = { 44 | var id :RsmqMessageId; 45 | var message :T; 46 | var sent :Float; 47 | var fr :Float; 48 | var rc :Int; 49 | } 50 | 51 | @:jsRequire("rsmq") 52 | extern class Rsmq 53 | { 54 | public function new(?options :RsmqConstructorOptions) :Void; 55 | public function createQueue(options :RsmqCreateQueueOptions, cb :Null->RsmqResponse->Void) :Void; 56 | public function sendMessage(options :RsmqSendMessageOptions, cb :Null->RsmqMessageId->Void) :Void; 57 | public function receiveMessage(options :RsmqRecieveMessageOptions, cb :Null->RsmqMessage->Void) :Void; 58 | public function deleteMessage(options :RsmqDeleteMessageOptions, cb :Null->RsmqResponse->Void) :Void; 59 | 60 | public function listQueues(cb :Null->Array->Void) :Void; 61 | public function quit() :Void; 62 | } -------------------------------------------------------------------------------- /js/npm/send/Send.hx: -------------------------------------------------------------------------------- 1 | package js.npm.send; 2 | import js.node.fs.WriteStream; 3 | import js.node.http.IncomingMessage; 4 | 5 | /** 6 | * Describes the options allowed to the 'send' method. 7 | */ 8 | extern class SendOption 9 | { 10 | /** 11 | * Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot ("."). Note this check is done on the path itself without checking if the path actually exists on the disk. If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny"). 12 | * 'allow' No special treatment for dotfiles. 13 | * 'deny' Send a 403 for any request for a dotfile. 14 | * 'ignore' Pretend like the dotfile does not exist and 404. 15 | * The default value is similar to 'ignore', with the exception that this default will not ignore the files within a directory that begins with a dot, for backward-compatibility. 16 | */ 17 | var dotfiles : String; 18 | 19 | /** 20 | * Enable or disable etag generation, defaults to true. 21 | */ 22 | var etag : Bool; 23 | 24 | /** 25 | * If a given file doesn't exist, try appending one of the given extensions, in the given order. By default, this is disabled (set to false). An example value that will serve extension-less HTML files: ['html', 'htm']. This is skipped if the requested file already has an extension. 26 | */ 27 | var extensions : Dynamic; 28 | 29 | /** 30 | * By default send supports "index.html" files, to disable this set false or to supply a new index pass a string or an array in preferred order. 31 | */ 32 | var index : String; 33 | 34 | /** 35 | * Enable or disable Last-Modified header, defaults to true. Uses the file system's last modified value. 36 | */ 37 | var lastModified : Bool; 38 | 39 | /** 40 | * Provide a max-age in milliseconds for http caching, defaults to 0. This can also be a string accepted by the ms module. 41 | */ 42 | var maxAge : Int; 43 | 44 | /** 45 | * Serve files relative to path. 46 | */ 47 | var root : String; 48 | } 49 | 50 | 51 | /** 52 | * Class that describes a static file send stream using the Http Server's request. 53 | * @author Eduardo Pons - eduardo@thelaborat.org 54 | */ 55 | class Send 56 | { 57 | 58 | static var m_stream : IncomingMessage-> String->SendOption->IncomingMessage; 59 | 60 | /** 61 | * Process the Http request to serve static files. 62 | * @param p_request 63 | * @param p_path 64 | * @param p_options 65 | * @return 66 | */ 67 | static public function send(p_request:IncomingMessage, p_path:String, p_options : SendOption) : IncomingMessage 68 | { 69 | if (m_stream == null) m_stream = cast Node.require("send"); 70 | var fn : Dynamic = m_stream; 71 | return (p_options != null) ? fn(p_request, p_path, p_options) : fn(p_request, p_path); 72 | } 73 | 74 | } -------------------------------------------------------------------------------- /js/npm/shortid/ShortId.hx: -------------------------------------------------------------------------------- 1 | package js.npm.shortid; 2 | 3 | @:jsRequire("shortid") 4 | extern class ShortId 5 | { 6 | public static function characters(chars: String): Void; 7 | public static function generate() :String; 8 | public static function isValid(id: String): Bool; 9 | public static function seed(value: Int): Void; 10 | public static function worker(id: Int): Void; 11 | } -------------------------------------------------------------------------------- /js/npm/simulateevent/SimulateEvent.hx: -------------------------------------------------------------------------------- 1 | package js.npm.simulateevent; 2 | 3 | import js.html.DOMElement; 4 | import js.html.Event; 5 | 6 | @:jsRequire("simulate-event") 7 | extern class SimulateEvent 8 | { 9 | public static function simulate(element :DOMElement, event :String, ?options :Dynamic) :Void; 10 | public static function generate(event :String, ?options :Dynamic) :Event; 11 | } -------------------------------------------------------------------------------- /js/npm/sourcemapsupport/SourceMapSupport.hx: -------------------------------------------------------------------------------- 1 | package js.npm.sourcemapsupport; 2 | 3 | @:jsRequire("source-map-support") 4 | extern class SourceMapSupport 5 | { 6 | public static function install(?opts :Dynamic) :Void; 7 | 8 | private static function __init__() : Void untyped 9 | { 10 | var SourceMapSupport = Node.require('source-map-support'); 11 | // https://github.com/evanw/node-source-map-support/issues/40 12 | SourceMapSupport.install({handleUncaughtExceptions: false}); 13 | // http://stackoverflow.com/questions/33778714/haxe-nodejs-debugging-source-mapping 14 | haxe.CallStack.wrapCallSite = untyped __js__("require('source-map-support').wrapCallSite"); 15 | } 16 | } -------------------------------------------------------------------------------- /js/npm/ssh2/Ssh.hx: -------------------------------------------------------------------------------- 1 | package js.npm.ssh2; 2 | 3 | import js.Error; 4 | import js.node.events.EventEmitter.Event; 5 | import js.node.stream.Readable; 6 | import js.node.stream.Writable; 7 | import js.node.stream.Duplex; 8 | 9 | typedef ConnectOptions = { 10 | var host :String; 11 | @:optional var port :Int; 12 | var username :String; 13 | @:optional var privateKey :String; 14 | @:optional var password :String; 15 | } 16 | 17 | typedef WriteStreamOptions = { 18 | @:optional var flags :String; 19 | @:optional var encoding :String; 20 | @:optional var mode :Int; 21 | } 22 | 23 | typedef ReadStreamOptions = {>WriteStreamOptions, 24 | @:optional var autoclose :Bool; 25 | @:optional var start :Int; 26 | @:optional var end :Int; 27 | } 28 | 29 | typedef FileAttributes = { 30 | var mode :Int; 31 | var uid :Int; 32 | var gid :Int; 33 | var size :Int; 34 | var atime :Int; 35 | var mtime :Int; 36 | } 37 | 38 | typedef SshFile = { 39 | var filename :String; 40 | var longname :String; 41 | var attrs :FileAttributes; 42 | } 43 | 44 | typedef SshSession=Dynamic; 45 | 46 | @:enum abstract SshConnectionEvent(Event) to Event 47 | { 48 | var Authentication : SshConnectionEventVoid> = 'authentication'; 49 | var Ready : SshConnectionEventVoid> = 'ready'; 50 | var Session : SshConnectionEvent<(Void->SshSession)->Void->Bool> = 'session'; 51 | var Continue : SshConnectionEventVoid> = 'continue'; 52 | var Error : SshConnectionEventVoid> = 'error'; 53 | var End : SshConnectionEventVoid> = 'end'; 54 | var Close : SshConnectionEventVoid> = 'close'; 55 | } 56 | 57 | @:enum abstract SshClientEvent(Event) to Event 58 | { 59 | var Banner : SshClientEventString->Void> = 'banner'; 60 | var Ready : SshClientEventVoid> = 'ready'; 61 | var TcpConnection : SshClientEventDynamic->Dynamic->Void> = 'tcp connection'; 62 | var X11 : SshClientEventDynamic->Dynamic->Void> = 'x11'; 63 | var Continue : SshClientEventVoid> = 'continue'; 64 | var Error : SshClientEventVoid> = 'error'; 65 | var End : SshClientEventVoid> = 'end'; 66 | var Close : SshClientEventVoid> = 'close'; 67 | } 68 | 69 | @:enum abstract SshExecEvent(Event) to Event 70 | { 71 | var Ready : SshExecEventVoid> = 'ready'; 72 | } 73 | 74 | @:enum abstract SshChannelEvent(Event) to Event 75 | { 76 | var Close : SshChannelEventString->Void> = 'close'; 77 | } 78 | 79 | @:jsRequire("ssh2") 80 | extern class SshClient extends js.node.events.EventEmitter 81 | { 82 | public var stderr :js.node.events.EventEmitter; 83 | public var stdout :js.node.events.EventEmitter; 84 | public function new() :Void; 85 | public function exec(command :String, cb :Null->Null->Void) :Bool; 86 | public function shell(cb :Null->Null->Void) :Void; 87 | public function connect(options :ConnectOptions) :Void; 88 | public function sftp(cb :Error->SFTPStream->Void) :Bool; 89 | public function end() :Void; 90 | } 91 | 92 | /* https://github.com/mscdex/ssh2-streams/blob/master/SFTPStream.md */ 93 | extern class SFTPStream extends js.node.events.EventEmitter 94 | { 95 | public function readdir(dir :String, cb :Null->Null>->Void) :Bool; 96 | public function writeFile(path :String, data :IReadable, options :Dynamic, cb :Null->Null->Void) :Bool; 97 | public function fastPut(from :String, to :String, options :Dynamic, cb :Null->Void) :Bool; 98 | @:overload(function(remotePath :String):IWritable {}) 99 | public function createWriteStream(remotePath :String, ?options :WriteStreamOptions) :IWritable; 100 | public function createReadStream(remotePath :String, ?options :ReadStreamOptions) :IReadable; 101 | @:overload(function(remotePath :String, cb :Null->Void):Bool {}) 102 | public function mkdir(remotePath :String, ?attr :FileAttributes, cb :Null->Void) :Bool; 103 | } 104 | 105 | extern class ExecStream extends Duplex 106 | { 107 | public var stderr :IReadable; 108 | } -------------------------------------------------------------------------------- /js/npm/streamifier/Streamifier.hx: -------------------------------------------------------------------------------- 1 | package js.npm.streamifier; 2 | 3 | import js.node.stream.Readable; 4 | 5 | @:jsRequire('streamifier') 6 | extern class Streamifier 7 | { 8 | public static function createReadStream(obj :Dynamic, ?options :ReadableNewOptions) :IReadable; 9 | } -------------------------------------------------------------------------------- /js/npm/tarfs/TarFs.hx: -------------------------------------------------------------------------------- 1 | package js.npm.tarfs; 2 | 3 | /** 4 | * https://github.com/mafintosh/tar-fs 5 | */ 6 | 7 | import js.Error; 8 | import js.node.stream.Readable; 9 | import js.node.stream.Writable; 10 | 11 | typedef TarFsOptions = { 12 | @:optional var ignore :String->Bool; 13 | @:optional var entries :Array; 14 | @:optional var map :String->String; 15 | @:optional var mapStream :IReadable->String->IReadable; 16 | @:optional var dmode :Int; 17 | @:optional var fmode :Int; 18 | @:optional var strict :Bool; 19 | @:optional var dereference :Bool; 20 | } 21 | 22 | @:jsRequire('tar-fs') 23 | extern class TarFs extends js.node.events.EventEmitter 24 | { 25 | inline public static var EVENT_FINISH = 'finish'; 26 | 27 | public static function pack(directory :String, ?options :TarFsOptions) :IReadable; 28 | public static function extract(directory :String) :IWritable; 29 | } -------------------------------------------------------------------------------- /js/npm/targz/TarGz.hx: -------------------------------------------------------------------------------- 1 | package js.npm.targz; 2 | 3 | /** 4 | * https://github.com/alanhoff/node-tar.gz 5 | */ 6 | 7 | import js.Error; 8 | import js.node.stream.Readable; 9 | import js.node.stream.Writable; 10 | 11 | typedef ZLibOptions = {//https://goo.gl/R40wrD 12 | @:optional var level :Int; 13 | @:optional var memLevel :Int; 14 | } 15 | 16 | typedef TarOptions = {//https://goo.gl/bqklaR 17 | @:optional var path :String; 18 | @:optional var strip :Int; 19 | @:optional var fromBase :Bool; 20 | } 21 | 22 | @:jsRequire("tar.gz") 23 | extern class TarGz extends js.node.events.EventEmitter 24 | { 25 | public function new(?zlibOptions :ZLibOptions, ?tarOptions :TarOptions); 26 | public function createReadStream(directory :String) :IReadable; 27 | public function createWriteStream(directory :String) :IWritable; 28 | public function createParseStream() :IWritable; 29 | public function compress(sourceDir :String, targetFilePath :String, ?cb :Null->Void) :js.Promise; 30 | public function extract(sourceFilePath :String, targetDir :String, ?cb :Null->Void) :js.Promise; 31 | } -------------------------------------------------------------------------------- /js/npm/tarstream/TarStream.hx: -------------------------------------------------------------------------------- 1 | package js.npm.tarstream; 2 | 3 | /** 4 | * https://www.npmjs.com/package/tar-stream 5 | */ 6 | 7 | import haxe.extern.EitherType; 8 | 9 | import js.Error; 10 | import js.node.Buffer; 11 | import js.node.events.EventEmitter.Event; 12 | import js.node.stream.Readable; 13 | import js.node.stream.Writable; 14 | import js.node.stream.Duplex; 15 | 16 | @:enum 17 | abstract TarPackEntryType(String) { 18 | var file = 'file'; 19 | var link = 'link'; 20 | var symlink = 'symlink'; 21 | var directory = 'directory'; 22 | var block_device = 'block-device'; 23 | var character_device = 'character-device'; 24 | var fifo = 'fifo'; 25 | var contiguous_file = 'contiguous-file '; 26 | } 27 | 28 | typedef TarPackHeader = { 29 | var name :String; 30 | @:optional var size :Int; 31 | @:optional var mtime :Date; 32 | @:optional var mode :Int; 33 | @:optional var type :TarPackEntryType; 34 | @:optional var linkname :String; 35 | @:optional var uid :Int; 36 | @:optional var gid :Int; 37 | @:optional var uname :String; 38 | @:optional var gname :String; 39 | @:optional var devmajor :Int; 40 | @:optional var devminor :Int; 41 | } 42 | 43 | @:enum abstract TarExtractEvent(Event) to Event { 44 | var Entry : TarExtractEventIReadable->(Void->Void)->Void> = "entry"; 45 | var Finish : TarExtractEventVoid> = "finish"; 46 | } 47 | 48 | @:jsRequire('tar-stream') 49 | extern class TarStream 50 | { 51 | public static function pack() :TarPack; 52 | public static function extract() :Duplex; 53 | } 54 | 55 | extern class TarPack extends Readable 56 | { 57 | @:overload(function(opts :TarPackHeader, cb :Null->Void):IWritable {}) 58 | public function entry(opts :TarPackHeader, val :EitherType) :Void; 59 | public function finalize() :Void; 60 | } -------------------------------------------------------------------------------- /js/npm/uuid/NodeUuid.hx: -------------------------------------------------------------------------------- 1 | package js.npm.uuid; 2 | 3 | @:jsRequire('uuid') 4 | extern class NodeUuid 5 | { 6 | public static function v1() :String; 7 | public static function v4() :String; 8 | } 9 | -------------------------------------------------------------------------------- /js/npm/vagrant/Vagrant.hx: -------------------------------------------------------------------------------- 1 | package js.npm.vagrant; 2 | 3 | import js.Error; 4 | 5 | @:enum 6 | abstract VagrantMachineStatus(String) { 7 | var NotCreated = "not created"; 8 | var Running = "running"; 9 | var PowerOff = "poweroff"; 10 | var Aborted = "aborted"; 11 | var Saved = "saved"; 12 | } 13 | 14 | typedef VagrantStatusResult = { 15 | var status :VagrantMachineStatus; 16 | var provider :String; 17 | } 18 | 19 | extern class VagrantMachine extends js.node.events.EventEmitter 20 | { 21 | public function init(args :Array, cb :Error->Dynamic->Void) :Void; 22 | public function up(cb :Error->Dynamic->Void) :Void; 23 | public function status(cb :Error->Dynamic->Void) :Void; 24 | public function sshConfig(cb :Error->{port :Int,hostname:String,user:String,private_key:String}->Void) :Void; 25 | public function suspend(cb :Error->Dynamic->Void) :Void; 26 | public function resume(cb :Error->Dynamic->Void) :Void; 27 | public function halt(cb :Error->Dynamic->Void) :Void; 28 | public function destroy(cb :Error->Dynamic->Void) :Void; 29 | } 30 | 31 | @:jsRequire("node-vagrant") 32 | extern class Vagrant extends js.node.events.EventEmitter 33 | { 34 | public static function version(cb :Error->String->Void) :Void; 35 | public static function create(args :{cwd:String, env: Dynamic}) :VagrantMachine; 36 | public static function globalStatus(cb :Error->Dynamic->Void) :Void; 37 | } -------------------------------------------------------------------------------- /js/npm/watchr/Watchr.hx: -------------------------------------------------------------------------------- 1 | package js.npm.watchr; 2 | 3 | //https://github.com/bevry/watchr 4 | 5 | import js.Error; 6 | 7 | typedef WatchErr=Dynamic; 8 | 9 | typedef FilePath=String; 10 | typedef FileCurrentStat=Dynamic; 11 | typedef FilePreviousStat=FileCurrentStat; 12 | 13 | @:enum 14 | abstract ChangeType(String) { 15 | var Update = 'update'; 16 | var Create = 'create'; 17 | var Delete = 'delete'; 18 | } 19 | 20 | typedef WatcherInstance = { 21 | var path :String; 22 | } 23 | 24 | typedef Watcher = { 25 | function close () :Void; 26 | } 27 | 28 | typedef Listeners = { 29 | @:optional var log :Int->Void; 30 | @:optional var error :WatchErr->Void; 31 | @:optional var watching :WatchErr->WatcherInstance->Bool->Void; 32 | @:optional var change :ChangeType->FilePath->FileCurrentStat->FilePreviousStat->Void; 33 | } 34 | 35 | typedef WatchrConfig = { 36 | @:optional var path :String; 37 | @:optional var paths :Array; 38 | @:optional var listener :Void->Void; 39 | @:optional var listeners :Listeners; 40 | @:optional var next :WatchErr->Array->Void; 41 | @:optional var stat :Dynamic; 42 | @:optional var interval :Int; 43 | @:optional var persistent :Bool; 44 | @:optional var catchupDelay :Int; 45 | @:optional var preferredMethods :Array; 46 | @:optional var followLinks :Bool; 47 | @:optional var ignorePaths :Bool; 48 | @:optional var ignoreHiddenFiles :Bool; 49 | @:optional var ignoreCustomPatterns :Bool; 50 | } 51 | 52 | @:jsRequire("watchr") 53 | extern class Watchr extends js.node.events.EventEmitter 54 | { 55 | public static function watch(config :WatchrConfig):Void; 56 | } 57 | 58 | class WatchrEvents 59 | { 60 | inline public static var LOG = 'log'; 61 | inline public static var ERROR = 'error'; 62 | inline public static var WATCHING = 'watching'; 63 | inline public static var CHANGE = 'change'; 64 | } -------------------------------------------------------------------------------- /js/npm/ws/WebSocket.hx: -------------------------------------------------------------------------------- 1 | package js.npm.ws; 2 | import js.Error; 3 | import js.node.events.EventEmitter; 4 | import js.node.http.IncomingMessage; 5 | 6 | /** 7 | * 8 | */ 9 | @:enum abstract WebSocketEvent(Event) to Event 10 | { 11 | /** 12 | * function (error) { } 13 | * If the client emits an error, this event is emitted (errors from the underlying net.Socket are forwarded here). 14 | */ 15 | var Error : WebSocketEventVoid> = "error"; 16 | 17 | /** 18 | * function (code, message) { } 19 | * Is emitted when the connection is closed. code is defined in the WebSocket specification. 20 | * The close event is also emitted when then underlying net.Socket closes the connection (end or close). 21 | */ 22 | var Close : WebSocketEventString->Void> = "close"; 23 | 24 | 25 | /** 26 | * function () { } 27 | * Emitted when the connection is established. 28 | */ 29 | var Open : WebSocketEventVoid> = "open"; 30 | 31 | /** 32 | * function (data, flags) { } 33 | * Is emitted when data is received. flags is an object with member binary. 34 | */ 35 | var Message : WebSocketEventDynamic->Void> = "message"; 36 | 37 | /** 38 | * function (data, flags) { } 39 | * Is emitted when a ping is received. flags is an object with member binary. 40 | */ 41 | var Ping : WebSocketEventDynamic->Void> = "ping"; 42 | 43 | /** 44 | * function (data, flags) { } 45 | * Is emitted when a pong is received. flags is an object with member binary. 46 | */ 47 | var Pong : WebSocketEventDynamic->Void> = "pong"; 48 | 49 | } 50 | 51 | class WebSocketReadyState 52 | { 53 | static var Connecting : String = "CONNECTING"; 54 | static var Open : String = "OPEN"; 55 | static var Closing : String = "CLOSING"; 56 | static var Closed : String = "CLOSED"; 57 | } 58 | 59 | extern class WebSocketOption 60 | { 61 | var protocol : String; 62 | 63 | var agent : Dynamic; 64 | 65 | var headers : Dynamic; 66 | 67 | var protocolVersion : Dynamic; 68 | 69 | var host : String; 70 | 71 | var origin : String; 72 | 73 | var pfx : Dynamic; 74 | 75 | var key : Dynamic; 76 | 77 | var passphrase : String; 78 | 79 | var cert : Dynamic; 80 | 81 | var ca : Array; 82 | 83 | var ciphers : String; 84 | 85 | var rejectUnauthorized : Bool; 86 | } 87 | 88 | /** 89 | * Flag instance received on 'message' event. 90 | */ 91 | extern class WebSocketMessageFlag 92 | { 93 | /** 94 | * will be set if a binary data is received 95 | */ 96 | var binary : Bool; 97 | 98 | /** 99 | * will be set if the data was masked 100 | */ 101 | var masked :Bool; 102 | } 103 | 104 | /** 105 | * ws: a node.js websocket library 106 | * https://github.com/einaros/ws 107 | * @author Eduardo Pons - eduardo@thelaborat.org 108 | */ 109 | @:jsRequire("ws") 110 | extern class WebSocket extends EventEmitter 111 | { 112 | static var CONNECTING : Dynamic; 113 | 114 | static var OPEN : Dynamic; 115 | 116 | static var CLOSING : Dynamic; 117 | 118 | static var CLOSED : Dynamic; 119 | 120 | /** 121 | * Received bytes count. 122 | */ 123 | var bytesReceived : Int; 124 | 125 | /** 126 | * Possible states are WebSocket.CONNECTING, WebSocket.OPEN, WebSocket.CLOSING, WebSocket.CLOSED. 127 | */ 128 | var readyState : String; 129 | 130 | /** 131 | * The WebSocket protocol version used for this connection, 8, 13 or hixie-76 (the latter only for server clients). 132 | */ 133 | var protocolVersion : String; 134 | 135 | /** 136 | * The URL of the WebSocket server (only for clients) 137 | */ 138 | var url : String; 139 | 140 | /** 141 | * Describes the feature of the used protocol version. 142 | * E.g. supports.binary is a boolean that describes if the connection supports binary messages. 143 | */ 144 | var supports : Dynamic; 145 | 146 | /** 147 | * upgradeReq is the original request object 148 | */ 149 | var upgradeReq : IncomingMessage; 150 | 151 | /** 152 | * Creates a new WebSocket. 153 | * Instantiating with an address creates a new WebSocket client object. 154 | * If address is an Array (request, socket, rest), it is instantiated as a Server client (e.g. called from the ws.Server). 155 | * @param p_url 156 | */ 157 | @:overload(function(p_address:String):Void{}) 158 | function new(p_address:String,p_options : WebSocketOption); 159 | 160 | /** 161 | * Sends data through the connection. options can be an object with members mask and binary. The optional callback is executed after the send completes. 162 | * Setting mask, will cause the data to be masked according to the websocket protocol. The same option applies for text data. 163 | * @param p_data 164 | * @param p_options 165 | * @param p_callback 166 | */ 167 | @:overload(function (p_data : Dynamic):Void { } ) 168 | @:overload(function (p_data : Dynamic, p_options : WebSocketMessageFlag):Void{}) 169 | function send(p_data : Dynamic, p_options : WebSocketMessageFlag,p_callback:Dynamic):Void; 170 | 171 | 172 | /** 173 | * Gracefully closes the connection, after sending a description message 174 | * @param p_code 175 | * @param p_data 176 | */ 177 | @:overload(function():Void{}) 178 | @:overload(function(p_code:Int):Void{}) 179 | function close(p_code:Int, p_data : Dynamic):Void; 180 | 181 | /** 182 | * Pause the client stream 183 | */ 184 | function pause():Void; 185 | 186 | /** 187 | * Sends a ping. data is sent, options is an object with members mask and binary. dontFailWhenClosed indicates whether or not to throw if the connection isnt open. 188 | * @param p_data 189 | * @param p_options 190 | * @param p_dontFailWhenClosed 191 | */ 192 | @:overload(function():Void{}) 193 | @:overload(function(p_data:Dynamic):Void{}) 194 | @:overload(function(p_data:Dynamic, p_options:WebSocketMessageFlag):Void{}) 195 | function ping(p_data:Dynamic, p_options:WebSocketMessageFlag, p_dontFailWhenClosed:Bool):Void; 196 | 197 | /** 198 | * Sends a pong. data is sent, options is an object with members mask and binary. dontFailWhenClosed indicates whether or not to throw if the connection isnt open. 199 | * @param p_data 200 | * @param p_options 201 | * @param p_dontFailWhenClosed 202 | */ 203 | @:overload(function():Void{}) 204 | @:overload(function(p_data:Dynamic):Void{}) 205 | @:overload(function(p_data:Dynamic, p_options:WebSocketMessageFlag):Void{}) 206 | function pong(p_data:Dynamic, p_options:WebSocketMessageFlag, p_dontFailWhenClosed:Bool):Void; 207 | 208 | /** 209 | * Resume the client stream 210 | */ 211 | function resume():Void; 212 | 213 | /** 214 | * Streams data through calls to a user supplied function. options can be an object with members mask and binary. callback is executed on successive ticks of which send is function (data, final). 215 | * @param p_options 216 | * @param p_callback 217 | */ 218 | @:overload(function(p_callback:Dynamic):Void { } ) 219 | function stream(p_options : WebSocketMessageFlag, p_callback:Dynamic):Void; 220 | 221 | /** 222 | * Immediately shuts down the connection 223 | */ 224 | function terminate():Void; 225 | 226 | /** 227 | * Emulates the W3C Browser based WebSocket interface using function members. 228 | */ 229 | var onopen : Void->Void; 230 | 231 | /** 232 | * Emulates the W3C Browser based WebSocket interface using function members. 233 | */ 234 | var onerror : Error->Void; 235 | 236 | /** 237 | * Emulates the W3C Browser based WebSocket interface using function members. 238 | */ 239 | var onclose : Int->String->Void; 240 | 241 | /** 242 | * Emulates the W3C Browser based WebSocket interface using function members. 243 | */ 244 | var onmessage : Dynamic->WebSocketMessageFlag->Void; 245 | 246 | /** 247 | * Emulates the W3C Browser based WebSocket interface using addEventListener. 248 | * @param p_event 249 | * @param p_listener 250 | */ 251 | function addEventListener(p_event : String, p_listener : Dynamic):Void; 252 | 253 | } 254 | -------------------------------------------------------------------------------- /js/npm/ws/WebSocketServer.hx: -------------------------------------------------------------------------------- 1 | package js.npm.ws; 2 | import haxe.ds.ObjectMap; 3 | import js.node.events.EventEmitter; 4 | import js.node.http.Server; 5 | import js.node.http.IncomingMessage; 6 | import js.node.net.Socket; 7 | 8 | @:enum abstract WebSocketServerEvent(Event) to Event 9 | { 10 | /** 11 | * function (error) { } 12 | * If the underlying server emits an error, it will be forwarded here. 13 | */ 14 | var Error : WebSocketServerEventVoid> = "error"; 15 | 16 | /** 17 | * function (headers) { } 18 | * Emitted with the object of HTTP headers that are going to be written to the Stream as part of the handshake. 19 | */ 20 | var Headers : WebSocketServerEventVoid> = "headers"; 21 | 22 | /** 23 | * function (socket) { } 24 | * When a new WebSocket connection is established. socket is an object of type ws.WebSocket. 25 | */ 26 | var Connection : WebSocketServerEventIncomingMessage->Void> = "connection"; 27 | } 28 | 29 | /** 30 | * 31 | */ 32 | typedef WebSocketServerOption = { 33 | /** 34 | * 35 | */ 36 | @:optional var host : String; 37 | 38 | /** 39 | * 40 | */ 41 | @:optional var port : Int; 42 | 43 | /** 44 | * 45 | */ 46 | @:optional var server : Server; 47 | 48 | /** 49 | * 50 | */ 51 | @:optional var verifyClient : Dynamic; 52 | 53 | /** 54 | * 55 | */ 56 | @:optional var path : String; 57 | 58 | /** 59 | * 60 | */ 61 | @:optional var noServer : Bool; 62 | 63 | /** 64 | * 65 | */ 66 | @:optional var disableHixie : Bool; 67 | 68 | /** 69 | * 70 | */ 71 | @:optional var clientTracking : Bool; 72 | } 73 | 74 | /** 75 | * ... 76 | * @author Eduardo Pons - eduardo@thelaborat.org 77 | */ 78 | @:jsRequire("ws", "Server") 79 | extern class WebSocketServer extends EventEmitter 80 | { 81 | 82 | public var clients : Array; 83 | 84 | /** 85 | * Construct a new server object. 86 | * Either port or server must be provided, otherwise you might enable noServer if you want to pass the requests directly. 87 | * Please note that the callback is only used when you supply the a port number in the options. 88 | * @param p_options 89 | * @param p_callback 90 | */ 91 | @:overload(function(p_options:WebSocketServerOption):Void{}) 92 | public function new(p_options:WebSocketServerOption, p_callback : Dynamic); 93 | 94 | /** 95 | * Close the server and terminate all clients 96 | * @param p_code 97 | * @param p_data 98 | */ 99 | @:overload(function():Void{}) 100 | @:overload(function(p_code:Int):Void{}) 101 | function close(p_code:Int, p_data : Dynamic):Void; 102 | 103 | /** 104 | * Handles a HTTP Upgrade request. request is an instance of http.ServerRequest, socket is an instance of net.Socket. 105 | * When the Upgrade was successfully, the callback will be called with a ws.WebSocket object as parameter. 106 | * @param p_request 107 | * @param p_socket 108 | * @param p_upgradeHead 109 | * @param p_callback 110 | */ 111 | function handleUpgrade(p_request : IncomingMessage, p_socket : Socket, p_upgradeHead : Dynamic, p_callback : WebSocket -> Void):Void; 112 | } 113 | --------------------------------------------------------------------------------