Skip to content

Commit

Permalink
Use long.js dependency in tests, reference types instead of paths in …
Browse files Browse the repository at this point in the history
….d.ts see #503
  • Loading branch information
dcodeIO committed Dec 2, 2016
1 parent 23d6643 commit 96fa07a
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 70 deletions.
1 change: 1 addition & 0 deletions .zuul.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ browsers:
version: [8.1, 9.0, latest]
scripts:
- scripts/polyfill.js
- node_modules/long/dist/long.js
tunnel:
type: ngrok
proto: tcp
2 changes: 1 addition & 1 deletion dist/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/protobuf.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/protobuf.min.js.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions scripts/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ var fs = require("fs"),
var dir = path.join(__dirname, "..", "types");

var header = [
'/// <reference path="../node_modules/@types/node/index.d.ts" />',
'/// <reference path="../node_modules/@types/long/index.d.ts" />',
'/// <reference types="node" />',
'/// <reference types="long" />',
"",
"/*",
" * protobuf.js v" + pkg.version + " TypeScript definitions",
Expand Down
102 changes: 36 additions & 66 deletions types/protobuf.js.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// <reference path="../node_modules/@types/node/index.d.ts" />
/// <reference path="../node_modules/@types/long/index.d.ts" />
/// <reference types="node" />
/// <reference types="long" />

/*
* protobuf.js v6.0.1 TypeScript definitions
* Generated Thu, 01 Dec 2016 15:54:46 UTC
* Generated Fri, 02 Dec 2016 12:20:52 UTC
*/
declare module protobuf {

Expand Down Expand Up @@ -1619,6 +1619,29 @@ declare module protobuf {
*/
var Long: (() => any);

/**
* Converts a number or long to an 8 characters long hash string.
* @param {Long|number} value Value to convert
* @returns {string} Hash
*/
function longToHash(value: (Long|number)): string;

/**
* Converts an 8 characters long hash string to a long or number.
* @param {string} hash Hash
* @param {boolean} [unsigned=false] Whether unsigned or not
* @returns {Long|number} Original value
*/
function longFromHash(hash: string, unsigned?: boolean): (Long|number);

/**
* Tests if two possibly long values are not equal.
* @param {number|Long} a First value
* @param {number|Long} b Second value
* @returns {boolean} `true` if not equal
*/
function longNeq(a: (number|Long), b: (number|Long)): boolean;

/**
* Tests if the specified value is a string.
* @memberof util
Expand Down Expand Up @@ -1693,29 +1716,6 @@ declare module protobuf {
*/
function resolvePath(originPath: string, importPath: string, alreadyNormalized?: boolean): string;

/**
* Converts a number or long to an 8 characters long hash string.
* @param {Long|number} value Value to convert
* @returns {string} Hash
*/
function longToHash(value: (Long|number)): string;

/**
* Converts an 8 characters long hash string to a long or number.
* @param {string} hash Hash
* @param {boolean} [unsigned=false] Whether unsigned or not
* @returns {Long|number} Original value
*/
function longFromHash(hash: string, unsigned?: boolean): (Long|number);

/**
* Tests if two possibly long values are not equal.
* @param {number|Long} a First value
* @param {number|Long} b Second value
* @returns {boolean} `true` if not equal
*/
function longNeq(a: (number|Long), b: (number|Long)): boolean;

/**
* Merges the properties of the source object into the destination object.
* @param {Object} dst Destination object
Expand All @@ -1742,54 +1742,24 @@ declare module protobuf {
}

/**
* Constructs a new verifier for the specified message type.
* @classdesc Runtime message verifier using code generation on top of reflection.
* @constructor
* @param {Type} type Message type
* Runtime message verifier using code generation on top of reflection.
* @namespace
*/
class Verifier {
/**
* Constructs a new verifier for the specified message type.
* @classdesc Runtime message verifier using code generation on top of reflection.
* @constructor
* @param {Type} type Message type
*/
constructor(type: Type);

/**
* Message type.
* @type {Type}
*/
type: Type;

/**
* Fields of this verifier's message type as an array for iteration.
* @name Verifier#fieldsArray
* @type {Field[]}
* @readonly
*/
fieldsArray: Field[];

/**
* Full name of this verifier's message type.
* @name Verifier#fullName
* @type {string}
* @readonly
*/
fullName: string;

module verifier {
/**
* Verifies a runtime message of this verifier's message type.
* Verifies a runtime message of `this` message type.
* @param {Prototype|Object} message Runtime message or plain object to verify
* @returns {?string} `null` if valid, otherwise the reason why it is not
* @this {Type}
*/
verify(message: (Prototype|Object)): string;
function fallback(message: (Prototype|Object)): string;

/**
* Generates a verifier specific to this verifier's message type.
* @returns {function} Verifier function with an identical signature to {@link Verifier#verify}
* Generates a verifier specific to the specified message type.
* @param {Type} mtype Message type
* @returns {util.CodegenAppender} Unscoped codegen instance
*/
generate(): (() => any);
function generate(mtype: Type): util.CodegenAppender;

}

Expand Down

0 comments on commit 96fa07a

Please sign in to comment.