From a09fe35882c6d6bef4e0f3d0eab8aa47e0d04a58 Mon Sep 17 00:00:00 2001 From: Adrien Castex Date: Mon, 10 Jul 2017 14:24:25 +0200 Subject: [PATCH] Modified the class name from '_PhysicalFileSystemResource' into 'PhysicalFileSystemResource' --- .../v2/instances/PhysicalFileSystem.d.ts | 8 ++++---- lib/manager/v2/instances/PhysicalFileSystem.js | 18 +++++++++--------- lib/server/commands/Propfind.js | 8 +++++--- lib/server/commands/Proppatch.js | 2 +- lib/server/v2/commands/Propfind.js | 8 +++++--- lib/server/v2/commands/Proppatch.js | 2 +- lib/server/v2/webDAVServer/BeforeAfter.d.ts | 4 +--- lib/server/v2/webDAVServer/WebDAVServer.d.ts | 2 +- lib/server/v2/webDAVServer/WebDAVServer.js | 2 +- src/manager/v2/instances/PhysicalFileSystem.ts | 18 +++++++++--------- src/server/webDAVServer/BeforeAfter.ts | 2 +- 11 files changed, 38 insertions(+), 36 deletions(-) diff --git a/lib/manager/v2/instances/PhysicalFileSystem.d.ts b/lib/manager/v2/instances/PhysicalFileSystem.d.ts index 7f627131..e853dcf4 100644 --- a/lib/manager/v2/instances/PhysicalFileSystem.d.ts +++ b/lib/manager/v2/instances/PhysicalFileSystem.d.ts @@ -2,10 +2,10 @@ import { LocalPropertyManager, LastModifiedDateInfo, FileSystemSerializer, OpenWriteStreamInfo, PropertyManagerInfo, OpenReadStreamInfo, IPropertyManager, LocalLockManager, CreationDateInfo, LockManagerInfo, SimpleCallback, ReturnCallback, ResourceType, ILockManager, ReadDirInfo, CreateInfo, DeleteInfo, FileSystem, SizeInfo, MoveInfo, TypeInfo } from '../fileSystem/export'; import { Readable, Writable } from 'stream'; import { Path } from '../Path'; -export declare class _PhysicalFileSystemResource { +export declare class PhysicalFileSystemResource { props: LocalPropertyManager; locks: LocalLockManager; - constructor(data?: _PhysicalFileSystemResource); + constructor(data?: PhysicalFileSystemResource); } export declare class PhysicalSerializer implements FileSystemSerializer { uid(): string; @@ -15,12 +15,12 @@ export declare class PhysicalSerializer implements FileSystemSerializer { export declare class PhysicalFileSystem extends FileSystem { rootPath: string; resources: { - [path: string]: _PhysicalFileSystemResource; + [path: string]: PhysicalFileSystemResource; }; constructor(rootPath: string); protected getRealPath(path: Path): { realPath: string; - resource: _PhysicalFileSystemResource; + resource: PhysicalFileSystemResource; }; protected _create(path: Path, ctx: CreateInfo, _callback: SimpleCallback): void; protected _delete(path: Path, ctx: DeleteInfo, _callback: SimpleCallback): void; diff --git a/lib/manager/v2/instances/PhysicalFileSystem.js b/lib/manager/v2/instances/PhysicalFileSystem.js index 709fe83c..7871d4f1 100644 --- a/lib/manager/v2/instances/PhysicalFileSystem.js +++ b/lib/manager/v2/instances/PhysicalFileSystem.js @@ -14,8 +14,8 @@ var export_1 = require("../fileSystem/export"); var path_1 = require("path"); var Errors_1 = require("../../../Errors"); var fs = require("fs"); -var _PhysicalFileSystemResource = (function () { - function _PhysicalFileSystemResource(data) { +var PhysicalFileSystemResource = (function () { + function PhysicalFileSystemResource(data) { if (!data) { this.props = new export_1.LocalPropertyManager(); this.locks = new export_1.LocalLockManager(); @@ -26,9 +26,9 @@ var _PhysicalFileSystemResource = (function () { this.locks = new export_1.LocalLockManager(); } } - return _PhysicalFileSystemResource; + return PhysicalFileSystemResource; }()); -exports._PhysicalFileSystemResource = _PhysicalFileSystemResource; +exports.PhysicalFileSystemResource = PhysicalFileSystemResource; var PhysicalSerializer = (function () { function PhysicalSerializer() { } @@ -55,7 +55,7 @@ var PhysicalFileSystem = (function (_super) { var _this = _super.call(this, new PhysicalSerializer()) || this; _this.rootPath = rootPath; _this.resources = { - '/': new _PhysicalFileSystemResource() + '/': new PhysicalFileSystemResource() }; return _this; } @@ -71,7 +71,7 @@ var PhysicalFileSystem = (function (_super) { var realPath = this.getRealPath(path).realPath; var callback = function (e) { if (!e) - _this.resources[path.toString()] = new _PhysicalFileSystemResource(); + _this.resources[path.toString()] = new PhysicalFileSystemResource(); else if (e) e = Errors_1.Errors.ResourceAlreadyExists; _callback(e); @@ -115,7 +115,7 @@ var PhysicalFileSystem = (function (_super) { if (e) return callback(Errors_1.Errors.ResourceNotFound); if (!resource) - _this.resources[path.toString()] = new _PhysicalFileSystemResource(); + _this.resources[path.toString()] = new PhysicalFileSystemResource(); callback(null, fs.createWriteStream(null, { fd: fd })); }); }; @@ -159,7 +159,7 @@ var PhysicalFileSystem = (function (_super) { PhysicalFileSystem.prototype._lockManager = function (path, ctx, callback) { var resource = this.resources[path.toString()]; if (!resource) { - resource = new _PhysicalFileSystemResource(); + resource = new PhysicalFileSystemResource(); this.resources[path.toString()] = resource; } callback(null, resource.locks); @@ -167,7 +167,7 @@ var PhysicalFileSystem = (function (_super) { PhysicalFileSystem.prototype._propertyManager = function (path, ctx, callback) { var resource = this.resources[path.toString()]; if (!resource) { - resource = new _PhysicalFileSystemResource(); + resource = new PhysicalFileSystemResource(); this.resources[path.toString()] = resource; } callback(null, resource.props); diff --git a/lib/server/commands/Propfind.js b/lib/server/commands/Propfind.js index e00d9e3a..5229f80f 100644 --- a/lib/server/commands/Propfind.js +++ b/lib/server/commands/Propfind.js @@ -184,9 +184,11 @@ function method(arg, callback) { var propstatError = response.ele('D:propstat'); var prop_2 = propstatError.ele('D:prop'); propstatError.ele('D:status').add(propstatStatus(WebDAVRequest_1.HTTPCodes.NotFound)); - for (var i = 0; i < reqBody.leftElements.length; ++i) - if (reqBody.leftElements[i]) - prop_2.ele(reqBody.leftElements[i].name); + for (var _i = 0, _a = reqBody.leftElements; _i < _a.length; _i++) { + var el = _a[_i]; + if (el) + prop_2.ele(el.name); + } } callback(); } diff --git a/lib/server/commands/Proppatch.js b/lib/server/commands/Proppatch.js index 5f99f6da..083cdc33 100644 --- a/lib/server/commands/Proppatch.js +++ b/lib/server/commands/Proppatch.js @@ -49,7 +49,7 @@ function method(arg, callback) { arg.invokeEvent(eventName, r, el); notify_1(el, e); }) - .done(function () { return finalize_1(); }); + .done(function (_) { return finalize_1(); }); }); }; execute('DAV:set', 'setProperty', function (el, callback) { diff --git a/lib/server/v2/commands/Propfind.js b/lib/server/v2/commands/Propfind.js index fd594c5a..1906be2d 100644 --- a/lib/server/v2/commands/Propfind.js +++ b/lib/server/v2/commands/Propfind.js @@ -160,9 +160,11 @@ var default_1 = (function () { var propstatError = response.ele('D:propstat'); var prop_2 = propstatError.ele('D:prop'); propstatError.ele('D:status').add(propstatStatus(WebDAVRequest_1.HTTPCodes.NotFound)); - for (var i = 0; i < reqBody.leftElements.length; ++i) - if (reqBody.leftElements[i]) - prop_2.ele(reqBody.leftElements[i].name); + for (var _i = 0, _a = reqBody.leftElements; _i < _a.length; _i++) { + var el = _a[_i]; + if (el) + prop_2.ele(el.name); + } } callback(); } diff --git a/lib/server/v2/commands/Proppatch.js b/lib/server/v2/commands/Proppatch.js index d494c6ea..25400a33 100644 --- a/lib/server/v2/commands/Proppatch.js +++ b/lib/server/v2/commands/Proppatch.js @@ -82,7 +82,7 @@ var default_1 = (function () { if (el.type === 'element') notify_1(el, e); }) - .done(function () { return finalize_1(); }); + .done(function (_) { return finalize_1(); }); }); }; r.fs.isLocked(ctx, r.path, function (e, locked) { diff --git a/lib/server/v2/webDAVServer/BeforeAfter.d.ts b/lib/server/v2/webDAVServer/BeforeAfter.d.ts index 7b9b1469..139c7d6b 100644 --- a/lib/server/v2/webDAVServer/BeforeAfter.d.ts +++ b/lib/server/v2/webDAVServer/BeforeAfter.d.ts @@ -1,6 +1,4 @@ import { HTTPRequestContext } from '../WebDAVRequest'; -export interface RequestListener { - (ctx: HTTPRequestContext, next: () => void): void; -} +export declare type RequestListener = (ctx: HTTPRequestContext, next: () => void) => void; export declare function invokeBeforeRequest(base: HTTPRequestContext, callback: any): void; export declare function invokeAfterRequest(base: HTTPRequestContext, callback: any): void; diff --git a/lib/server/v2/webDAVServer/WebDAVServer.d.ts b/lib/server/v2/webDAVServer/WebDAVServer.d.ts index 3e91c38c..233b9c20 100644 --- a/lib/server/v2/webDAVServer/WebDAVServer.d.ts +++ b/lib/server/v2/webDAVServer/WebDAVServer.d.ts @@ -1,6 +1,6 @@ /// -import { WebDAVServerOptions } from '../WebDAVServerOptions'; import { ExternalRequestContext, RequestContextExternalOptions, RequestContext } from '../RequestContext'; +import { WebDAVServerOptions } from '../WebDAVServerOptions'; import { HTTPMethod } from '../WebDAVRequest'; import { HTTPAuthentication } from '../../../user/v2/authentication/HTTPAuthentication'; import { PrivilegeManager } from '../../../user/v2/privilege/PrivilegeManager'; diff --git a/lib/server/v2/webDAVServer/WebDAVServer.js b/lib/server/v2/webDAVServer/WebDAVServer.js index cb8078a4..6f2a9454 100644 --- a/lib/server/v2/webDAVServer/WebDAVServer.js +++ b/lib/server/v2/webDAVServer/WebDAVServer.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var WebDAVServerOptions_1 = require("../WebDAVServerOptions"); var RequestContext_1 = require("../RequestContext"); +var WebDAVServerOptions_1 = require("../WebDAVServerOptions"); var Commands_1 = require("../commands/Commands"); var Path_1 = require("../../../manager/v2/Path"); var persistence = require("./Persistence"); diff --git a/src/manager/v2/instances/PhysicalFileSystem.ts b/src/manager/v2/instances/PhysicalFileSystem.ts index 18f96375..478ace6a 100644 --- a/src/manager/v2/instances/PhysicalFileSystem.ts +++ b/src/manager/v2/instances/PhysicalFileSystem.ts @@ -27,12 +27,12 @@ import { Errors } from '../../../Errors' import { Path } from '../Path' import * as fs from 'fs' -export class _PhysicalFileSystemResource +export class PhysicalFileSystemResource { props : LocalPropertyManager locks : LocalLockManager - constructor(data ?: _PhysicalFileSystemResource) + constructor(data ?: PhysicalFileSystemResource) { if(!data) { @@ -41,7 +41,7 @@ export class _PhysicalFileSystemResource } else { - const rs = data as _PhysicalFileSystemResource; + const rs = data as PhysicalFileSystemResource; this.props = new LocalPropertyManager(rs.props); this.locks = new LocalLockManager(); } @@ -74,7 +74,7 @@ export class PhysicalSerializer implements FileSystemSerializer export class PhysicalFileSystem extends FileSystem { resources : { - [path : string] : _PhysicalFileSystemResource + [path : string] : PhysicalFileSystemResource } constructor(public rootPath : string) @@ -82,7 +82,7 @@ export class PhysicalFileSystem extends FileSystem super(new PhysicalSerializer()); this.resources = { - '/': new _PhysicalFileSystemResource() + '/': new PhysicalFileSystemResource() }; } @@ -102,7 +102,7 @@ export class PhysicalFileSystem extends FileSystem const callback = (e) => { if(!e) - this.resources[path.toString()] = new _PhysicalFileSystemResource(); + this.resources[path.toString()] = new PhysicalFileSystemResource(); else if(e) e = Errors.ResourceAlreadyExists; @@ -158,7 +158,7 @@ export class PhysicalFileSystem extends FileSystem return callback(Errors.ResourceNotFound); if(!resource) - this.resources[path.toString()] = new _PhysicalFileSystemResource(); + this.resources[path.toString()] = new PhysicalFileSystemResource(); callback(null, fs.createWriteStream(null, { fd })); }) @@ -218,7 +218,7 @@ export class PhysicalFileSystem extends FileSystem let resource = this.resources[path.toString()]; if(!resource) { - resource = new _PhysicalFileSystemResource(); + resource = new PhysicalFileSystemResource(); this.resources[path.toString()] = resource; } @@ -230,7 +230,7 @@ export class PhysicalFileSystem extends FileSystem let resource = this.resources[path.toString()]; if(!resource) { - resource = new _PhysicalFileSystemResource(); + resource = new PhysicalFileSystemResource(); this.resources[path.toString()] = resource; } diff --git a/src/server/webDAVServer/BeforeAfter.ts b/src/server/webDAVServer/BeforeAfter.ts index 5a18621e..a8349a42 100644 --- a/src/server/webDAVServer/BeforeAfter.ts +++ b/src/server/webDAVServer/BeforeAfter.ts @@ -46,4 +46,4 @@ export function invokeBeforeRequest(base : MethodCallArgs, callback) export function invokeAfterRequest(base : MethodCallArgs, callback) { invokeBARequest(this.afterManagers, base, callback); -} \ No newline at end of file +}