nodecg-io-ahk
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -1,8 +0,9 @@ | ||
import { NodeCG } from "nodecg/types/server"; | ||
import { Logger } from "nodecg-io-core"; | ||
export declare class AHK { | ||
private nodecg; | ||
private logger; | ||
private readonly address; | ||
constructor(nodecg: NodeCG, host: string, port: number); | ||
constructor(logger: Logger, host: string, port: number); | ||
testConnection(): Promise<boolean>; | ||
sendCommand(command: string): Promise<void>; | ||
} | ||
//# sourceMappingURL=AHK.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AHK = void 0; | ||
const node_fetch_1 = require("node-fetch"); | ||
const tslib_1 = require("tslib"); | ||
const node_fetch_1 = (0, tslib_1.__importDefault)(require("node-fetch")); | ||
class AHK { | ||
constructor(nodecg, host, port) { | ||
this.nodecg = nodecg; | ||
constructor(logger, host, port) { | ||
this.logger = logger; | ||
this.address = `http://${host}:${port}`; | ||
} | ||
async testConnection() { | ||
const response = await node_fetch_1.default(`${this.address}/nodecg-io`, { method: "GET" }); | ||
const response = await (0, node_fetch_1.default)(`${this.address}/nodecg-io`, { method: "GET" }); | ||
return response.status === 404; | ||
@@ -16,6 +17,6 @@ } | ||
try { | ||
await node_fetch_1.default(`${this.address}/send/${command}`, { method: "GET" }); | ||
await (0, node_fetch_1.default)(`${this.address}/send/${command}`, { method: "GET" }); | ||
} | ||
catch (err) { | ||
this.nodecg.log.error(`Error while using the AHK Connector: ${err}`); | ||
this.logger.error(`Error while using the AHK Connector: ${err}`); | ||
} | ||
@@ -22,0 +23,0 @@ } |
import { AHK } from "./AHK"; | ||
export declare type AHKServiceClient = AHK; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -9,10 +9,10 @@ "use strict"; | ||
class AhkService extends nodecg_io_core_1.ServiceBundle { | ||
async validateConfig(config) { | ||
const ahk = new AHK_1.AHK(this.nodecg, config.host, config.port); | ||
async validateConfig(config, logger) { | ||
const ahk = new AHK_1.AHK(logger, config.host, config.port); | ||
await ahk.testConnection(); // Will throw an error if server doesn't exist. | ||
return nodecg_io_core_1.emptySuccess(); | ||
return (0, nodecg_io_core_1.emptySuccess)(); | ||
} | ||
async createClient(config) { | ||
const ahk = new AHK_1.AHK(this.nodecg, config.host, config.port); | ||
return nodecg_io_core_1.success(ahk); | ||
async createClient(config, logger) { | ||
const ahk = new AHK_1.AHK(logger, config.host, config.port); | ||
return (0, nodecg_io_core_1.success)(ahk); | ||
} | ||
@@ -19,0 +19,0 @@ stopClient() { |
{ | ||
"name": "nodecg-io-ahk", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Allows you to send commands to AutoHotkey.", | ||
"homepage": "https://nodecg.io/samples/ahk", | ||
"homepage": "https://nodecg.io/RELEASE/samples/ahk", | ||
"author": { | ||
@@ -14,3 +14,3 @@ "name": "derNiklaas", | ||
"url": "https://github.com/codeoverflow-org/nodecg-io.git", | ||
"directory": "nodecg-io-ahk" | ||
"directory": "services/nodecg-io-ahk" | ||
}, | ||
@@ -23,7 +23,2 @@ "files": [ | ||
], | ||
"scripts": { | ||
"build": "tsc -b", | ||
"watch": "tsc -b -w", | ||
"clean": "tsc -b --clean" | ||
}, | ||
"keywords": [ | ||
@@ -36,3 +31,3 @@ "nodecg-io", | ||
"bundleDependencies": { | ||
"nodecg-io-core": "^0.1.1" | ||
"nodecg-io-core": "^0.2.0" | ||
} | ||
@@ -42,11 +37,11 @@ }, | ||
"devDependencies": { | ||
"@types/node": "^14.14.33", | ||
"@types/node-fetch": "^2.5.8", | ||
"nodecg": "^1.8.1", | ||
"typescript": "^4.2.3" | ||
"@types/node": "^16.11.7", | ||
"@types/node-fetch": "^2.5.10", | ||
"nodecg-types": "^1.8.3", | ||
"typescript": "^4.4.4" | ||
}, | ||
"dependencies": { | ||
"node-fetch": "^2.6.1", | ||
"nodecg-io-core": "^0.1.1" | ||
"node-fetch": "^2.6.5", | ||
"nodecg-io-core": "^0.2.0" | ||
} | ||
} |
{ | ||
"extends": "../tsconfig.common.json" | ||
"extends": "../../tsconfig.common.json", | ||
"references": [ | ||
{ | ||
"path": "../../nodecg-io-core" | ||
} | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
5187
79
1
+ Addedajv@8.17.1(transitive)
+ Addedfast-uri@3.0.5(transitive)
+ Addednodecg-io-core@0.2.0(transitive)
- Removedajv@7.2.4(transitive)
- Removednodecg-io-core@0.1.2(transitive)
- Removedpunycode@2.3.1(transitive)
- Removeduri-js@4.4.1(transitive)
Updatednode-fetch@^2.6.5
Updatednodecg-io-core@^0.2.0