Initial commit
This commit is contained in:
12
node_modules/jayson/promise/lib/client/browser/index.d.ts
generated
vendored
Normal file
12
node_modules/jayson/promise/lib/client/browser/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as jayson from '../../../..';
|
||||
|
||||
type PromiseClientBrowserCallServerFunction = (request:string) => Promise<string>;
|
||||
|
||||
declare class PromiseClientBrowser {
|
||||
constructor(callServer:PromiseClientBrowserCallServerFunction, options:jayson.ClientOptions);
|
||||
request(method:string, params:jayson.RequestParamsLike, id:jayson.JSONRPCIDLike | undefined, shouldCall:false): jayson.JSONRPCRequest;
|
||||
request(method:string, params:jayson.RequestParamsLike, id?:jayson.JSONRPCIDLike): Promise<jayson.JSONRPCResultLike>;
|
||||
request(method: Array<jayson.JSONRPCRequestLike>): Promise<jayson.JSONRPCResultLike>;
|
||||
}
|
||||
|
||||
export = PromiseClientBrowser;
|
||||
28
node_modules/jayson/promise/lib/client/browser/index.js
generated
vendored
Normal file
28
node_modules/jayson/promise/lib/client/browser/index.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
const ClientBrowser = require('../../../../lib/client/browser/index');
|
||||
const promiseUtils = require('../../utils');
|
||||
|
||||
/**
|
||||
* Constructor for a Jayson Promise Browser Client that does not depend any node.js core libraries
|
||||
* @class PromiseClientBrowser
|
||||
* @extends ClientBrowser
|
||||
* @return {PromiseClientBrowser}
|
||||
*/
|
||||
const PromiseClientBrowser = function(callServerPromise, options) {
|
||||
if(!(this instanceof PromiseClientBrowser)) {
|
||||
return new PromiseClientBrowser(callServerPromise, options);
|
||||
}
|
||||
|
||||
const callServer = function (request, callback) {
|
||||
callServerPromise(request).then(res => callback(null, res), err => callback(err));
|
||||
};
|
||||
|
||||
ClientBrowser.call(this, callServer, options);
|
||||
this.request = promiseUtils.wrapClientRequestMethod(this.request.bind(this));
|
||||
};
|
||||
|
||||
// let's hope this ancient method of inheriting works the way I remember it.
|
||||
PromiseClientBrowser.prototype = ClientBrowser.prototype;
|
||||
|
||||
module.exports = PromiseClientBrowser;
|
||||
23
node_modules/jayson/promise/lib/client/http.js
generated
vendored
Normal file
23
node_modules/jayson/promise/lib/client/http.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
const promisify = require('es6-promisify');
|
||||
const jayson = require('../../../');
|
||||
const promiseUtils = require('../utils');
|
||||
|
||||
/**
|
||||
* Constructor for a Jayson Promise Client Http
|
||||
* @see Client
|
||||
* @class PromiseClientHttp
|
||||
* @extends ClientHttp
|
||||
* @return {PromiseClientHttp}
|
||||
*/
|
||||
const PromiseClientHttp = function(options) {
|
||||
if(!(this instanceof PromiseClientHttp)) {
|
||||
return new PromiseClientHttp(options);
|
||||
}
|
||||
jayson.Client.http.apply(this, arguments);
|
||||
this.request = promiseUtils.wrapClientRequestMethod(this.request.bind(this));
|
||||
};
|
||||
require('util').inherits(PromiseClientHttp, jayson.Client.http);
|
||||
|
||||
module.exports = PromiseClientHttp;
|
||||
24
node_modules/jayson/promise/lib/client/https.js
generated
vendored
Normal file
24
node_modules/jayson/promise/lib/client/https.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
const promisify = require('es6-promisify');
|
||||
const jayson = require('../../../');
|
||||
const promiseUtils = require('../utils');
|
||||
|
||||
/**
|
||||
* Constructor for a Jayson Promise Client Http
|
||||
* @see Client
|
||||
* @class PromiseClientHttps
|
||||
* @extends ClientHttps
|
||||
* @return {PromiseClientHttps}
|
||||
*/
|
||||
const PromiseClientHttps = function(options) {
|
||||
if(!(this instanceof PromiseClientHttps)) {
|
||||
return new PromiseClientHttps(options);
|
||||
}
|
||||
jayson.Client.https.apply(this, arguments);
|
||||
this.request = promiseUtils.wrapClientRequestMethod(this.request.bind(this));
|
||||
};
|
||||
require('util').inherits(PromiseClientHttps, jayson.Client.https);
|
||||
|
||||
module.exports = PromiseClientHttps;
|
||||
|
||||
53
node_modules/jayson/promise/lib/client/index.js
generated
vendored
Normal file
53
node_modules/jayson/promise/lib/client/index.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
const promisify = require('es6-promisify');
|
||||
const jayson = require('../../../');
|
||||
const promiseUtils = require('../utils');
|
||||
|
||||
/**
|
||||
* Constructor for a Jayson Promise Client
|
||||
* @see Client
|
||||
* @class PromiseClient
|
||||
* @extends Client
|
||||
* @return {PromiseClient}
|
||||
*/
|
||||
const PromiseClient = function(server, options) {
|
||||
if(!(this instanceof PromiseClient)) {
|
||||
return new PromiseClient(server, options);
|
||||
}
|
||||
jayson.Client.apply(this, arguments);
|
||||
this.request = promiseUtils.wrapClientRequestMethod(this.request.bind(this));
|
||||
};
|
||||
require('util').inherits(PromiseClient, jayson.Client);
|
||||
|
||||
/**
|
||||
* @type PromiseClientHttp
|
||||
* @static
|
||||
*/
|
||||
PromiseClient.http = require('./http');
|
||||
|
||||
/**
|
||||
* @type PromiseClientHttps
|
||||
* @static
|
||||
*/
|
||||
PromiseClient.https = require('./https');
|
||||
|
||||
/**
|
||||
* @type PromiseClientTls
|
||||
* @static
|
||||
*/
|
||||
PromiseClient.tls = require('./tls');
|
||||
|
||||
/**
|
||||
* @type PromiseClientTcp
|
||||
* @static
|
||||
*/
|
||||
PromiseClient.tcp = require('./tcp');
|
||||
|
||||
/**
|
||||
* @type PromiseClientWebsocket
|
||||
* @static
|
||||
*/
|
||||
PromiseClient.websocket = require('./websocket');
|
||||
|
||||
module.exports = PromiseClient;
|
||||
23
node_modules/jayson/promise/lib/client/tcp.js
generated
vendored
Normal file
23
node_modules/jayson/promise/lib/client/tcp.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
const promisify = require('es6-promisify');
|
||||
const jayson = require('../../../');
|
||||
const promiseUtils = require('../utils');
|
||||
|
||||
/**
|
||||
* Constructor for a Jayson Promise Client Tcp
|
||||
* @see Client
|
||||
* @class PromiseClientTcp
|
||||
* @extends ClientTcp
|
||||
* @return {PromiseClientTcp}
|
||||
*/
|
||||
const PromiseClientTcp = function(options) {
|
||||
if(!(this instanceof PromiseClientTcp)) {
|
||||
return new PromiseClientTcp(options);
|
||||
}
|
||||
jayson.Client.tcp.apply(this, arguments);
|
||||
this.request = promiseUtils.wrapClientRequestMethod(this.request.bind(this));
|
||||
};
|
||||
require('util').inherits(PromiseClientTcp, jayson.Client.tcp);
|
||||
|
||||
module.exports = PromiseClientTcp;
|
||||
23
node_modules/jayson/promise/lib/client/tls.js
generated
vendored
Normal file
23
node_modules/jayson/promise/lib/client/tls.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
const promisify = require('es6-promisify');
|
||||
const jayson = require('../../../');
|
||||
const promiseUtils = require('../utils');
|
||||
|
||||
/**
|
||||
* Constructor for a Jayson Promise Client Tls
|
||||
* @see Client
|
||||
* @class PromiseClientTls
|
||||
* @extends ClientTls
|
||||
* @return {PromiseClientTls}
|
||||
*/
|
||||
const PromiseClientTls = function(options) {
|
||||
if(!(this instanceof PromiseClientTls)) {
|
||||
return new PromiseClientTls(options);
|
||||
}
|
||||
jayson.Client.tls.apply(this, arguments);
|
||||
this.request = promiseUtils.wrapClientRequestMethod(this.request.bind(this));
|
||||
};
|
||||
require('util').inherits(PromiseClientTls, jayson.Client.tls);
|
||||
|
||||
module.exports = PromiseClientTls;
|
||||
23
node_modules/jayson/promise/lib/client/websocket.js
generated
vendored
Normal file
23
node_modules/jayson/promise/lib/client/websocket.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
const promisify = require('es6-promisify');
|
||||
const jayson = require('../../../');
|
||||
const promiseUtils = require('../utils');
|
||||
|
||||
/**
|
||||
* Constructor for a Jayson Promise Client Websocket
|
||||
* @see Client
|
||||
* @class PromiseClientWebsocket
|
||||
* @extends ClientWebsocket
|
||||
* @return {PromiseClientWebsocket}
|
||||
*/
|
||||
const PromiseClientWebsocket = function(options) {
|
||||
if(!(this instanceof PromiseClientWebsocket)) {
|
||||
return new PromiseClientWebsocket(options);
|
||||
}
|
||||
jayson.Client.websocket.apply(this, arguments);
|
||||
this.request = promiseUtils.wrapClientRequestMethod(this.request.bind(this));
|
||||
};
|
||||
require('util').inherits(PromiseClientWebsocket, jayson.Client.websocket);
|
||||
|
||||
module.exports = PromiseClientWebsocket;
|
||||
Reference in New Issue
Block a user