update
This commit is contained in:
parent
91d7f583e2
commit
dd35e5d7d2
20
dist/dockersock.classes.dockersock.d.ts
vendored
20
dist/dockersock.classes.dockersock.d.ts
vendored
@ -1,4 +1,3 @@
|
|||||||
/// <reference types="request" />
|
|
||||||
/// <reference types="q" />
|
/// <reference types="q" />
|
||||||
import "typings-global";
|
import "typings-global";
|
||||||
import * as plugins from "./dockersock.plugins";
|
import * as plugins from "./dockersock.plugins";
|
||||||
@ -6,7 +5,7 @@ import { Observable } from "rxjs";
|
|||||||
import { Objectmap } from 'lik';
|
import { Objectmap } from 'lik';
|
||||||
export declare class Dockersock {
|
export declare class Dockersock {
|
||||||
sockPath: string;
|
sockPath: string;
|
||||||
requestObjectmap: Objectmap<plugins.request.Request>;
|
requestObjectmap: Objectmap<any>;
|
||||||
constructor(pathArg?: string);
|
constructor(pathArg?: string);
|
||||||
auth(userArg: string, passArg: string): plugins.q.Promise<{}>;
|
auth(userArg: string, passArg: string): plugins.q.Promise<{}>;
|
||||||
listContainers(): plugins.q.Promise<{}>;
|
listContainers(): plugins.q.Promise<{}>;
|
||||||
@ -27,7 +26,24 @@ export declare class Dockersock {
|
|||||||
* gets you an observable that reports changes in the docker infrastructure
|
* gets you an observable that reports changes in the docker infrastructure
|
||||||
*/
|
*/
|
||||||
getChangeObservable(): Observable<{}>;
|
getChangeObservable(): Observable<{}>;
|
||||||
|
/**
|
||||||
|
* fire a request
|
||||||
|
* @param methodArg
|
||||||
|
* @param routeArg
|
||||||
|
* @param queryArg
|
||||||
|
* @param dataArg
|
||||||
|
*/
|
||||||
request(methodArg: string, routeArg: string, queryArg?: string, dataArg?: {}): plugins.q.Promise<{}>;
|
request(methodArg: string, routeArg: string, queryArg?: string, dataArg?: {}): plugins.q.Promise<{}>;
|
||||||
|
/**
|
||||||
|
* fire a streaming request
|
||||||
|
* @param methodArg
|
||||||
|
* @param routeArg
|
||||||
|
* @param queryArg
|
||||||
|
* @param dataArg
|
||||||
|
*/
|
||||||
requestStream(methodArg: string, routeArg: string, queryArg?: string, dataArg?: {}): plugins.q.Promise<{}>;
|
requestStream(methodArg: string, routeArg: string, queryArg?: string, dataArg?: {}): plugins.q.Promise<{}>;
|
||||||
|
/**
|
||||||
|
* end all currently streaming requests
|
||||||
|
*/
|
||||||
endRequests(): void;
|
endRequests(): void;
|
||||||
}
|
}
|
||||||
|
19
dist/dockersock.classes.dockersock.js
vendored
19
dist/dockersock.classes.dockersock.js
vendored
File diff suppressed because one or more lines are too long
@ -6,7 +6,7 @@
|
|||||||
"npmdocker":{
|
"npmdocker":{
|
||||||
"baseImage":"hosttoday/ht-docker-node:npmci",
|
"baseImage":"hosttoday/ht-docker-node:npmci",
|
||||||
"command":"(npmci command yarn global add npmts) && npmts",
|
"command":"(npmci command yarn global add npmts) && npmts",
|
||||||
"dockerSock":"true"
|
"dockerSock": true
|
||||||
},
|
},
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"globalNpmTools": [
|
"globalNpmTools": [
|
||||||
|
13
package.json
13
package.json
@ -5,7 +5,7 @@
|
|||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npmdocker"
|
"test": "(npmts --notest && npmdocker)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -26,16 +26,15 @@
|
|||||||
"homepage": "https://gitlab.com/pushrocks/dockersock#README",
|
"homepage": "https://gitlab.com/pushrocks/dockersock#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/q": "1.x.x",
|
"@types/q": "1.x.x",
|
||||||
"@types/request": "0.x.x",
|
"beautylog": "^6.1.10",
|
||||||
"beautylog": "^6.1.5",
|
"lik": "^1.0.38",
|
||||||
"lik": "^1.0.27",
|
|
||||||
"q": "^1.5.0",
|
"q": "^1.5.0",
|
||||||
"request": "^2.81.0",
|
"request": "^2.81.0",
|
||||||
"rxjs": "^5.2.0",
|
"rxjs": "^5.4.2",
|
||||||
"typings-global": "^1.0.14"
|
"typings-global": "^1.0.19"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"observable-to-promise": "^0.5.0",
|
"observable-to-promise": "^0.5.0",
|
||||||
"tapbundle": "^1.0.5"
|
"tapbundle": "^1.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
test/test.ts
26
test/test.ts
@ -8,29 +8,27 @@ let testDockersock: Dockersock;
|
|||||||
tap.test("should create a new Dockersock instance", async () => {
|
tap.test("should create a new Dockersock instance", async () => {
|
||||||
testDockersock = new Dockersock();
|
testDockersock = new Dockersock();
|
||||||
return expect(testDockersock).to.be.instanceof(Dockersock);
|
return expect(testDockersock).to.be.instanceof(Dockersock);
|
||||||
}).catch(tap.threw);
|
})
|
||||||
|
|
||||||
tap.test("should list containers", async () => {
|
tap.test("should list containers", async () => {
|
||||||
await testDockersock.listContainers()
|
let data = await testDockersock.listContainers()
|
||||||
.then(async (dataArg) => {
|
console.log(data)
|
||||||
console.log(dataArg);
|
})
|
||||||
});
|
|
||||||
}).catch(tap.threw);
|
|
||||||
|
|
||||||
tap.test("should list detailed containers", async () => {
|
tap.test("should list detailed containers", async () => {
|
||||||
await testDockersock.listContainersDetailed()
|
let data = await testDockersock.listContainersDetailed()
|
||||||
.then(async (dataArg) => {
|
console.log(data)
|
||||||
console.log(dataArg);
|
})
|
||||||
});
|
|
||||||
}).catch(tap.threw);
|
|
||||||
|
|
||||||
tap.test("should pull an image from imagetag", async () => {
|
tap.test("should pull an image from imagetag", async () => {
|
||||||
await testDockersock.pullImage("hosttoday/ht-docker-node:npmci")
|
await testDockersock.pullImage("hosttoday/ht-docker-node:npmci")
|
||||||
}).catch(tap.threw);
|
})
|
||||||
|
|
||||||
/*tap.test("should return a change Objservable", async () => {
|
tap.test("should return a change Objservable", async () => {
|
||||||
let myObservable = testDockersock.getChangeObservable();
|
let myObservable = testDockersock.getChangeObservable();
|
||||||
testDockersock.endRequests();
|
testDockersock.endRequests();
|
||||||
let testPromise = observableToPromise(myObservable)
|
let testPromise = observableToPromise(myObservable)
|
||||||
return await expect(testPromise).to.eventually.be.fulfilled
|
return await expect(testPromise).to.eventually.be.fulfilled
|
||||||
}).catch(tap.threw);*/
|
})
|
||||||
|
|
||||||
|
tap.start()
|
||||||
|
@ -160,6 +160,15 @@ export class Dockersock {
|
|||||||
});
|
});
|
||||||
return changeObservable;
|
return changeObservable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fire a request
|
||||||
|
* @param methodArg
|
||||||
|
* @param routeArg
|
||||||
|
* @param queryArg
|
||||||
|
* @param dataArg
|
||||||
|
*/
|
||||||
request (methodArg: string, routeArg: string, queryArg: string = "", dataArg = {}) {
|
request (methodArg: string, routeArg: string, queryArg: string = "", dataArg = {}) {
|
||||||
let done = plugins.q.defer();
|
let done = plugins.q.defer();
|
||||||
let jsonArg: string = JSON.stringify(dataArg);
|
let jsonArg: string = JSON.stringify(dataArg);
|
||||||
@ -187,6 +196,14 @@ export class Dockersock {
|
|||||||
});
|
});
|
||||||
return done.promise;
|
return done.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fire a streaming request
|
||||||
|
* @param methodArg
|
||||||
|
* @param routeArg
|
||||||
|
* @param queryArg
|
||||||
|
* @param dataArg
|
||||||
|
*/
|
||||||
requestStream (methodArg: string, routeArg: string, queryArg: string = "", dataArg = {}) {
|
requestStream (methodArg: string, routeArg: string, queryArg: string = "", dataArg = {}) {
|
||||||
let done = plugins.q.defer();
|
let done = plugins.q.defer();
|
||||||
let jsonArg: string = JSON.stringify(dataArg);
|
let jsonArg: string = JSON.stringify(dataArg);
|
||||||
@ -231,7 +248,9 @@ export class Dockersock {
|
|||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* end all currently streaming requests
|
||||||
|
*/
|
||||||
endRequests () {
|
endRequests () {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.requestObjectmap.forEach((itemArg: plugins.request.Request) => {
|
this.requestObjectmap.forEach((itemArg: plugins.request.Request) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user