Commit Graph

115 Commits

Author SHA1 Message Date
Rogier Schouten
b5acb56359 Improve Node dgram signatures. 2014-07-08 11:58:21 +02:00
Basarat Ali Syed
ca0287488c Merge pull request #2309 from johnnycrab/master
node.js crypto: Changed HMAC and Hash params to `any`
2014-07-02 23:09:00 +10:00
Rogier Schouten
c64855dc68 CI build fix 2014-06-25 14:10:15 +02:00
Rogier Schouten
c7f95e49fa Add missing callback parameter to dgram.Socket.bind() and update dgram.Socket.send() 2014-06-25 14:04:13 +02:00
Jonathan Pirnay
14af5ff768 Fix: Substitute any with Buffer 2014-06-19 12:17:48 +02:00
Jonathan Pirnay
ff66b8c00a Changes agreed on in
https://github.com/borisyankov/DefinitelyTyped/pull/2309/files#r13778987

moved `createDecipher` function out of the cipher-interface
2014-06-19 12:15:28 +02:00
Jonathan Pirnay
4a5d9c48f0 Merge remote-tracking branch 'upstream/master' 2014-06-19 12:03:54 +02:00
Bart van der Schoor
3d64ea7395 added missing urls to some authors
fixed node urls
2014-06-18 23:31:35 +02:00
Bart van der Schoor
1d345f6c14 cleaned-up headers 2014-06-18 23:31:11 +02:00
Bart van der Schoor
7a6925d958 node fs.utimes methods also accept Date's 2014-06-16 10:07:54 +02:00
Jonathan Pirnay
b07a83f244 Changed HMAC and Hash params to any, as Buffers are also allowed / returned. 2014-06-09 22:39:35 +02:00
Horiuchi_H
a176899858 add semicolon 2014-06-05 15:54:40 +09:00
basarat
dd5499cc0d feat(nodejs) added stronger typing for http status codes 2014-05-23 20:08:56 +10:00
Colin Snover
1789164e95 Add test of ClientRequest#setNoDelay interface
Uses an invalid address as request address to avoid actual HTTP requests (since it is not necessary to make a real request to test this interface).
2014-05-16 12:46:14 -05:00
Colin Snover
9f5a5ab394 Fix bad signature of ClientRequest#setNoDelay
`noDelay` argument should be boolean, not Function
2014-05-16 12:25:08 -05:00
Jonathan Pirnay
b2866f5402 [bugfix] Moved INSPECT_MAX_BYTES to the buffer module.
From the [docs](http://nodejs.org/api/buffer.html#buffer_buffer_inspect_max_bytes):

"Note that this is a property on the buffer module returned by `require('buffer')`, not on the Buffer global, or a buffer instance."
2014-05-08 16:21:02 +02:00
Jonathan Pirnay
34ec78f7a3 Added toJSON() and INSPECT_MAX_BYTES to NodeBuffer interface
See docs: http://nodejs.org/api/buffer.html#buffer_buffer_inspect_max_bytes

Added to the NodeBuffer interface for now (marked as deprecated), as the interface Buffer extends NodeBuffer
2014-05-08 15:46:30 +02:00
Paul Loyd
25a3c76b44 node: move Node* to NodeJS module 2014-04-28 18:32:37 +02:00
Paul Loyd
c52e7bdf63 node: now modules depend on stream.* when possible 2014-04-28 18:32:37 +02:00
Paul Loyd
d100d104c6 node: now modules depend on events.EventEmitter, not NodeEventEmitter 2014-04-28 18:32:36 +02:00
Paul Loyd
c40cc2df89 node: rename ErrnoException to NodeErrnoException 2014-04-28 18:32:36 +02:00
Paul Loyd
1d451a05e1 node: NodeBuffer -> Buffer. Mark NodeBuffer as deprecated 2014-04-28 18:32:36 +02:00
Robert Knight
1c5ed81577 Export Node functions for creating decipher correctly
* createDecipher() and createDecipheriv() are functions
   in the crypto module, not methods of the Cipher interface.

 * Add pbkdf2Sync() decl
2014-04-18 21:18:09 +01:00
John Purcell
325d35130f Merge branch master into listen_bug 2014-04-01 08:21:11 -04:00
Masahiro Wakame
a4ceaf4d42 Merge pull request #1880 from jpmoodlerooms/node_crypto
Update crypto.Hmac.update and crypto.Hmac.digest methods to the correct signature
2014-04-01 10:27:08 +09:00
Bart van der Schoor
2fdba9cbbe add hash/path to both Url & UrlOptions 2014-03-31 21:21:42 +02:00
Bart van der Schoor
12766b5357 added hash & path to node's UrlOptions 2014-03-31 18:22:26 +02:00
Bart van der Schoor
d70401ed4d fixed realpathsync again 2014-03-31 17:33:29 +02:00
Bart van der Schoor
c45713047f Revert "Merge pull request #1931 from yortus/node-express-referenceable-types"
This reverts commit 0bfcda81b4, reversing
changes made to 2c52e529f9.
2014-03-31 17:31:31 +02:00
vvakame
2aabba9905 Improvement node.d.ts typings 2014-04-01 00:04:35 +09:00
Troy Gerwien
cbd13655e5 add hash to NodeJs.Url.Url 2014-03-31 22:20:09 +08:00
yortus
69bd32f4c1 pure internal modules + external shim
- The top-level modules Express and NodeJs are now 'pure' ie
non-instantiated, due to removal of all vars, functions, and classes
- Where the above change breaks existing typings which access types via
external module references, a shim has been added to make this continue
working unchanged
- A single namespace _ExternalShim_ is added but this can be reused
across all typings that need shimming
2014-03-31 15:18:53 +08:00
yortus
6a320ef211 EventEmitter can be new()d 2014-03-31 11:10:37 +08:00
Troy Gerwien
c2b67de6aa Fixed assert, added comments, rechecked all
- Added comments explaining the rationale/method of exposing into both
'type' and 'member' declaration spaces (see TLR 2.3) with example
- Made the pattern consistent in both definition files
- Fixed "assert" by adding 'export function Assert...'
- Triple-checked with DT tests and additional tests
2014-03-30 21:56:50 +08:00
Troy Gerwien
6f472b8f09 WIP: all passing (bar assert) but needs more...
Need to remove superfluous typings - eg NodeJs.QueryString.escape should
not be valid
2014-03-30 10:05:57 +08:00
Troy Gerwien
368266b684 var-interface-module pattern now consistent
Everything (in both node and express) now follows the pattern:
```
declare module "external-name" {
import _ = InternalName.InnerName;
export = _;
}
declare module InternalName {
export var InnerName: InnerName;
export interface InnerName {
// functions and vars in here
}
export module InnerName {
// Must be non-instantiated - so only interfaces and modules in here
}
}

```
2014-03-29 21:21:41 +08:00
Troy Gerwien
a7829a1fd9 referenceable types throughout node and express
All node modules and classes can be referenced by type name. External
module support remains unchanged, but now static type information is
available for all node modules and types without needing to go through
the external module definitions.

Similar for express.
2014-03-28 22:32:20 +08:00
John Purcell
cb01abe1b2 Return correct type from .listen() and .close(), expose .address() on http.Server 2014-03-26 14:54:22 -04:00
troy_paypac
1fd18add08 internal module defns for node and express 2014-03-26 15:04:06 +08:00
Paul Loyd
0cdeaaa3a7 node: rename http.NodeAgent to http.Agent and net.NodeSocket to net.Socket 2014-03-22 21:29:50 +04:00
John Purcell
941d790d6f Update crypto.Hmac.update and crypto.Hmac.digest methods to the correct signature 2014-03-19 16:53:31 -04:00
Paul Loyd
e3b9fef277 node: fix signatures of readFile* 2014-03-17 14:55:17 +04:00
vvakame
adb74d94ce Suppress warnings aboud node.d.ts 2014-02-26 09:54:15 +09:00
John Vilk
87ac1b3421 [Node] Updating stream interfaces and removing redundant interfaces.
We duplicated the EventEmitter and Stream interfaces in the "event" module, so I removed the redundant interface definitions.

I have updated the ReadableStream/WritableStream interfaces in accordance with the current documentation:
http://nodejs.org/api/stream.html

I added class definitions for Writable/Transform/Duplex/PassThrough in 'event'. These classes are described in the following Node documentation:
http://nodejs.org/api/stream.html#stream_api_for_stream_implementors

As a result of these changes, I needed to slightly alter other typings to refer to the new interface name. This was unavoidable; I had to rename the `EventEmitter` interface to `NodeEventEmitter` to avoid clashing with the `events.EventEmitter` class that implements `NodeEventEmitter`.
2014-02-05 14:28:10 -05:00
John Vilk
4f20894ed5 [Node] Fixing WritableStream.write and WritableStream.end.
Documentation for WritableStream.write:
http://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback

There's no 'fd' argument; that might have been a typo.

You can call `write` in the following ways:
* write(data: Buffer)
* write(data: Buffer, cb: Function)
* write(data: String)
* write(data: String, cb: Function)
* write(data: String, encoding: String)
* write(data: String, encoding: String, cb: Function)

The same goes to `end`, except `end` can be called with no arguments, too.
2014-01-30 21:18:22 -05:00
Bartvds
1c1a37c1e4 removed utf-8 BOM marker
for consistency
2014-01-24 18:51:21 +01:00
Bartvds
5d95684e19 added/fixed headers k-n
https://github.com/borisyankov/DefinitelyTyped/issues/1570
2014-01-24 01:19:01 +01:00
John Vilk
cddd0b7aab [Node] Node attaches errno information to some exceptions.
This is valuable information for Node applications that need to figure out why a particular system call failed.

Note that errno can either be a string or a number, which is why I have typed it as 'any'.

While this is undocumented, it is tested:
Code property: https://github.com/joyent/node/blob/v0.10.23-release/test/simple/test-fs-open.js#L34
Errno property [string]: https://github.com/joyent/node/blob/v0.10.23-release/test/internet/test-dns.js#L148
Errno property [number]: https://github.com/joyent/node/blob/v0.10.23-release/test/simple/test-domain-implicit-fs.js#L43
Syscall property: https://github.com/joyent/node/blob/v0.10.23-release/test/simple/test-stdout-close-catch.js#L38
Path property (I can’t find a test, but many examples have this line): https://github.com/joyent/node/blob/v0.10.23-release/deps/npm/node_modules/fstream-npm/example/bundle.js#L6

..and well supported in the code for all platforms (this is where I got the name 'ErrnoException' from):
*nix: https://github.com/joyent/node/blob/v0.10.23-release/src/node.cc#L719
Windows: https://github.com/joyent/node/blob/v0.10.23-release/src/node.cc#L856

Unfortunately, while every errno exception is guaranteed to have the ‘errno’ and ‘code’ properties (see the logic in the source code in node.cc), there is no hard guarantee that particular library functions will always pass an ErrnoException to the callback. I cannot find a counterexample at this moment, though. Since we can’t have union types in TypeScript, I simply made all of the properties on ErrnoException optional as a compromise.

I am only adding modifications to the fs module, which definitely throws ErrnoExceptions. But according to the examples above, other modules (e.g. dns) also pass errno information back to applications. People familiar with those other modules can update their typings to reference this interface when applicable; I lack the experience with those modules to update their typings.

Further proof:
```javascript
$ node
> var fs = require('fs');
undefined
> fs.open('doesntexistlol', 'r', function(e) { console.log(Object.keys(e)); console.log(e.code); console.log(e.errno); console.log(e.path); });
undefined
> [ 'errno', 'code', 'path' ]
ENOENT
34
doesntexistlol
```
2013-12-17 16:36:08 -05:00
John Vilk
f1c040b378 [Node] Removing incorrect typing for buffer.INSPECT_MAX_BYTES.
From http://nodejs.org/api/buffer.html#buffer_buffer_inspect_max_bytes:

"...this is a property on the buffer module returned by require('buffer'), not on the Buffer global, or a buffer instance."

The Node typings do not have a notion of a buffer module, and introducing one would be more work than might be useful. It contains a reference to `Buffer` and `SlowBuffer`, which are currently defined as variables in the typings. I believe I would need
 to redefine these in the module definition.

If anyone has any ideas for how to efficiently restructure this, let me know.
2013-12-12 14:41:23 -05:00
Paul Loyd
20065c967a Rename Timer to NodeTimer 2013-12-08 12:44:52 +04:00