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" />
|
||||
import "typings-global";
|
||||
import * as plugins from "./dockersock.plugins";
|
||||
@ -6,7 +5,7 @@ import { Observable } from "rxjs";
|
||||
import { Objectmap } from 'lik';
|
||||
export declare class Dockersock {
|
||||
sockPath: string;
|
||||
requestObjectmap: Objectmap<plugins.request.Request>;
|
||||
requestObjectmap: Objectmap<any>;
|
||||
constructor(pathArg?: string);
|
||||
auth(userArg: string, passArg: string): 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
|
||||
*/
|
||||
getChangeObservable(): Observable<{}>;
|
||||
/**
|
||||
* fire a request
|
||||
* @param methodArg
|
||||
* @param routeArg
|
||||
* @param queryArg
|
||||
* @param dataArg
|
||||
*/
|
||||
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<{}>;
|
||||
/**
|
||||
* end all currently streaming requests
|
||||
*/
|
||||
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":{
|
||||
"baseImage":"hosttoday/ht-docker-node:npmci",
|
||||
"command":"(npmci command yarn global add npmts) && npmts",
|
||||
"dockerSock":"true"
|
||||
"dockerSock": true
|
||||
},
|
||||
"npmci": {
|
||||
"globalNpmTools": [
|
||||
|
13
package.json
13
package.json
@ -5,7 +5,7 @@
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "npmdocker"
|
||||
"test": "(npmts --notest && npmdocker)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -26,16 +26,15 @@
|
||||
"homepage": "https://gitlab.com/pushrocks/dockersock#README",
|
||||
"dependencies": {
|
||||
"@types/q": "1.x.x",
|
||||
"@types/request": "0.x.x",
|
||||
"beautylog": "^6.1.5",
|
||||
"lik": "^1.0.27",
|
||||
"beautylog": "^6.1.10",
|
||||
"lik": "^1.0.38",
|
||||
"q": "^1.5.0",
|
||||
"request": "^2.81.0",
|
||||
"rxjs": "^5.2.0",
|
||||
"typings-global": "^1.0.14"
|
||||
"rxjs": "^5.4.2",
|
||||
"typings-global": "^1.0.19"
|
||||
},
|
||||
"devDependencies": {
|
||||
"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 () => {
|
||||
testDockersock = new Dockersock();
|
||||
return expect(testDockersock).to.be.instanceof(Dockersock);
|
||||
}).catch(tap.threw);
|
||||
})
|
||||
|
||||
tap.test("should list containers", async () => {
|
||||
await testDockersock.listContainers()
|
||||
.then(async (dataArg) => {
|
||||
console.log(dataArg);
|
||||
});
|
||||
}).catch(tap.threw);
|
||||
let data = await testDockersock.listContainers()
|
||||
console.log(data)
|
||||
})
|
||||
|
||||
tap.test("should list detailed containers", async () => {
|
||||
await testDockersock.listContainersDetailed()
|
||||
.then(async (dataArg) => {
|
||||
console.log(dataArg);
|
||||
});
|
||||
}).catch(tap.threw);
|
||||
let data = await testDockersock.listContainersDetailed()
|
||||
console.log(data)
|
||||
})
|
||||
|
||||
tap.test("should pull an image from imagetag", async () => {
|
||||
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();
|
||||
testDockersock.endRequests();
|
||||
let testPromise = observableToPromise(myObservable)
|
||||
return await expect(testPromise).to.eventually.be.fulfilled
|
||||
}).catch(tap.threw);*/
|
||||
})
|
||||
|
||||
tap.start()
|
||||
|
@ -160,6 +160,15 @@ export class Dockersock {
|
||||
});
|
||||
return changeObservable;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* fire a request
|
||||
* @param methodArg
|
||||
* @param routeArg
|
||||
* @param queryArg
|
||||
* @param dataArg
|
||||
*/
|
||||
request (methodArg: string, routeArg: string, queryArg: string = "", dataArg = {}) {
|
||||
let done = plugins.q.defer();
|
||||
let jsonArg: string = JSON.stringify(dataArg);
|
||||
@ -187,6 +196,14 @@ export class Dockersock {
|
||||
});
|
||||
return done.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* fire a streaming request
|
||||
* @param methodArg
|
||||
* @param routeArg
|
||||
* @param queryArg
|
||||
* @param dataArg
|
||||
*/
|
||||
requestStream (methodArg: string, routeArg: string, queryArg: string = "", dataArg = {}) {
|
||||
let done = plugins.q.defer();
|
||||
let jsonArg: string = JSON.stringify(dataArg);
|
||||
@ -231,7 +248,9 @@ export class Dockersock {
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* end all currently streaming requests
|
||||
*/
|
||||
endRequests () {
|
||||
setTimeout(() => {
|
||||
this.requestObjectmap.forEach((itemArg: plugins.request.Request) => {
|
||||
|
Loading…
Reference in New Issue
Block a user