From 5d93b860b47d277e8b964973d5b58fcd2dc7b148 Mon Sep 17 00:00:00 2001 From: Andrej Hazucha Date: Thu, 14 Jun 2018 14:18:56 +0200 Subject: [PATCH 1/2] Added TypeScript definition --- iis.d.ts | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 42 ++++++++++++++++++------------------ 2 files changed, 82 insertions(+), 21 deletions(-) create mode 100644 iis.d.ts diff --git a/iis.d.ts b/iis.d.ts new file mode 100644 index 0000000..4b858f4 --- /dev/null +++ b/iis.d.ts @@ -0,0 +1,61 @@ +declare interface Callback { + (error: Error, stdout: string, stderr: string): void; +} + +declare namespace IIS { + export function setDefaults(): void; + + export function createSite(options: { name?: string; protocol?: 'http' | string, host?: string, port?: number; }, cb: Callback): void; + + export function deleteSite(name: string, cb: Callback): void; + + + export function stopSite(name: string, cb: Callback): void; + + export function startSite(name: string, cb: Callback): void; + + /** + * Create app pool, also set app pool identity of object {name:,identity:} passed + * @param options + * @param cb + */ + export function createAppPool(options: { name: string; identity?: string; } | string, cb: Callback): void; + + export function recycleAppPool(name: string, cb: Callback): void; + + export function deleteAppPool(name: string, cb: Callback): void; + + export function stopAppPool(name: string, cb: Callback): void; + + export function mapAppPool(app_name: string, pool_name: string, cb: Callback): void; + + export function setAppPoolIdentity(pool_name: string, identity: string, cb: Callback): void; + + export function createAppFolder(options: { site?: string; virtual_path: string; physical_path: string; }, cb: Callback): void; + + export function unlockSection(section: string, cb: Callback): void; + + export function setWindowsAuthentication(appPath: string, enable: boolean, cb: Callback): void; + + export function setAnonymousAuthentication(appPath: string, enable: boolean, cb: Callback): void; + + export function list(type: string, cb: Callback): void; + + export function exists(type: string, name: string, cb?: (exits: boolean) => void): void; + + export function setFilePermissions(path: string, account: string, cb: Callback): void; + + /** + * Set the physical path web site maps to + * @param site_name + */ + export function setPhysicalPath(site_name: string, path: string, cb: Callback): void; + + /** + * Get the physical path web site maps to + * @param site_name + */ + export function getPhysicalPath(site_name: string, cb: Callback): void; +} + +export = IIS diff --git a/package.json b/package.json index 5fc794a..8a39caa 100644 --- a/package.json +++ b/package.json @@ -1,36 +1,36 @@ { - "name" : "iis", - "description" : "administer iis 7 on windows", + "name": "iis", + "description": "administer iis 7 on windows", "author": "Integrify Inc. ", - "maintainers": [ + "maintainers": [ "pdillon " - ], - "version" : "0.2.0", - "repository" : { - "type" : "git", - "url" : "https://github.com/Integrify/node-iis.git" + ], + "version": "0.2.0", + "repository": { + "type": "git", + "url": "https://github.com/Integrify/node-iis.git" }, - "main" : "iis.js", + "main": "iis.js", + "typings": "iis.d.ts", "scripts": { "test": "node tests/run.js" }, - "keywords" : [ + "keywords": [ "iis", "windows", "microsoft" ], - "directories" : { - "example" : "example" + "directories": { + "example": "example" }, - "dependencies" : { - "underscore" : "~1", - "xml2js" : "0.1.14" - + "dependencies": { + "underscore": "~1", + "xml2js": "0.1.14" }, - "devDependencies" : { - "async" : "0.1.x" + "devDependencies": { + "async": "0.1.x" }, - "engines" : { - "node" : ">=0.8.0" + "engines": { + "node": ">=0.8.0" } -} \ No newline at end of file +} From ec1befd4abb5ab7e88a2373df0bfc93b510fa848 Mon Sep 17 00:00:00 2001 From: Andrej Hazucha Date: Fri, 15 Jun 2018 15:47:52 +0200 Subject: [PATCH 2/2] Added deleteAppFolder function --- iis.d.ts | 2 ++ iis.js | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/iis.d.ts b/iis.d.ts index 4b858f4..242019b 100644 --- a/iis.d.ts +++ b/iis.d.ts @@ -33,6 +33,8 @@ declare namespace IIS { export function createAppFolder(options: { site?: string; virtual_path: string; physical_path: string; }, cb: Callback): void; + export function deleteAppFolder(options: { site?: string; virtual_path: string; }, cb: Callback): void; + export function unlockSection(section: string, cb: Callback): void; export function setWindowsAuthentication(appPath: string, enable: boolean, cb: Callback): void; diff --git a/iis.js b/iis.js index b813874..4241a8c 100644 --- a/iis.js +++ b/iis.js @@ -114,6 +114,18 @@ var IIS = function() { cb(err,"App " + (options.site || self.last_site) + '/' + options.virtual_path + " already exists"); }}); + }, + deleteAppFolder : function(options,cb) { + var self = this; + self.exists('app',(options.site || this.last_site) + '/' + options.virtual_path,function(err,tf) { + if (tf) { + var deleteapp_cmd = ' delete app "' + (options.site || self.last_site) + '/' + options.virtual_path + '"'; + exec(self.appcmd + deleteapp_cmd,cb); + } + else { + cb(err,"App " + (options.site || self.last_site) + '/' + options.virtual_path + " does not exist"); + }}); + }, unlockSection : function(section,cb) { var unlock_cmd = " unlock config /section:" + section;