Skip to content

Commit

Permalink
Changed the type of the 'path' argument of the methods in 'FileSystem…
Browse files Browse the repository at this point in the history
…', 'ContextualFileSystem' and 'Resource' from 'Path' to 'Path | string' to be more easy to use
  • Loading branch information
AdrienCastex committed Jun 28, 2017
1 parent 4d29192 commit 5c987c6
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 119 deletions.
88 changes: 44 additions & 44 deletions lib/manager/v2/fileSystem/ContextualFileSystem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,52 @@ export declare class ContextualFileSystem implements ISerializableFileSystem {
fs: FileSystem;
context: RequestContext;
constructor(fs: FileSystem, context: RequestContext);
resource(path: Path): Resource;
delete(path: Path, callback: SimpleCallback): void;
delete(path: Path, depth: number, callback: SimpleCallback): void;
openWriteStream(path: Path, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path, estimatedSize: number, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path, targetSource: boolean, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path, targetSource: boolean, estimatedSize: number, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path, mode: OpenWriteStreamMode, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path, mode: OpenWriteStreamMode, estimatedSize: number, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path, mode: OpenWriteStreamMode, targetSource: boolean, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path, mode: OpenWriteStreamMode, targetSource: boolean, estimatedSize: number, callback: Return2Callback<Writable, boolean>): void;
openReadStream(path: Path, callback: ReturnCallback<Readable>): void;
openReadStream(path: Path, estimatedSize: number, callback: ReturnCallback<Readable>): void;
openReadStream(path: Path, targetSource: boolean, callback: ReturnCallback<Readable>): void;
openReadStream(path: Path, targetSource: boolean, estimatedSize: number, callback: ReturnCallback<Readable>): void;
copy(pathFrom: Path, pathTo: Path, callback: ReturnCallback<boolean>): void;
copy(pathFrom: Path, pathTo: Path, depth: number, callback: ReturnCallback<boolean>): void;
copy(pathFrom: Path, pathTo: Path, overwrite: boolean, callback: ReturnCallback<boolean>): void;
copy(pathFrom: Path, pathTo: Path, overwrite: boolean, depth: number, callback: ReturnCallback<boolean>): void;
mimeType(path: Path, callback: ReturnCallback<string>): void;
mimeType(path: Path, targetSource: boolean, callback: ReturnCallback<string>): void;
size(path: Path, callback: ReturnCallback<number>): void;
size(path: Path, targetSource: boolean, callback: ReturnCallback<number>): void;
addSubTree(rootPath: Path, subTree: SubTree, callback: SimpleCallback): any;
addSubTree(rootPath: Path, resourceType: ResourceType, callback: SimpleCallback): any;
create(path: Path, type: ResourceType, callback: SimpleCallback): void;
create(path: Path, type: ResourceType, createIntermediates: boolean, callback: SimpleCallback): void;
etag(path: Path, callback: ReturnCallback<string>): void;
move(pathFrom: Path, pathTo: Path, callback: ReturnCallback<boolean>): void;
move(pathFrom: Path, pathTo: Path, overwrite: boolean, callback: ReturnCallback<boolean>): void;
rename(pathFrom: Path, newName: string, callback: ReturnCallback<boolean>): void;
rename(pathFrom: Path, newName: string, overwrite: boolean, callback: ReturnCallback<boolean>): void;
availableLocks(path: Path, callback: ReturnCallback<LockKind[]>): void;
lockManager(path: Path, callback: ReturnCallback<ILockManager>): void;
propertyManager(path: Path, callback: ReturnCallback<IPropertyManager>): void;
readDir(path: Path, callback: ReturnCallback<string[]>): void;
readDir(path: Path, retrieveExternalFiles: boolean, callback: ReturnCallback<string[]>): void;
creationDate(path: Path, callback: ReturnCallback<number>): void;
lastModifiedDate(path: Path, callback: ReturnCallback<number>): void;
webName(path: Path, callback: ReturnCallback<string>): void;
displayName(path: Path, callback: ReturnCallback<string>): void;
type(path: Path, callback: ReturnCallback<ResourceType>): void;
listDeepLocks(startPath: Path, callback: ReturnCallback<{
resource(path: Path | string): Resource;
delete(path: Path | string, callback: SimpleCallback): void;
delete(path: Path | string, depth: number, callback: SimpleCallback): void;
openWriteStream(path: Path | string, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path | string, estimatedSize: number, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path | string, targetSource: boolean, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path | string, targetSource: boolean, estimatedSize: number, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path | string, mode: OpenWriteStreamMode, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path | string, mode: OpenWriteStreamMode, estimatedSize: number, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path | string, mode: OpenWriteStreamMode, targetSource: boolean, callback: Return2Callback<Writable, boolean>): void;
openWriteStream(path: Path | string, mode: OpenWriteStreamMode, targetSource: boolean, estimatedSize: number, callback: Return2Callback<Writable, boolean>): void;
openReadStream(path: Path | string, callback: ReturnCallback<Readable>): void;
openReadStream(path: Path | string, estimatedSize: number, callback: ReturnCallback<Readable>): void;
openReadStream(path: Path | string, targetSource: boolean, callback: ReturnCallback<Readable>): void;
openReadStream(path: Path | string, targetSource: boolean, estimatedSize: number, callback: ReturnCallback<Readable>): void;
copy(pathFrom: Path | string, pathTo: Path | string, callback: ReturnCallback<boolean>): void;
copy(pathFrom: Path | string, pathTo: Path | string, depth: number, callback: ReturnCallback<boolean>): void;
copy(pathFrom: Path | string, pathTo: Path | string, overwrite: boolean, callback: ReturnCallback<boolean>): void;
copy(pathFrom: Path | string, pathTo: Path | string, overwrite: boolean, depth: number, callback: ReturnCallback<boolean>): void;
mimeType(path: Path | string, callback: ReturnCallback<string>): void;
mimeType(path: Path | string, targetSource: boolean, callback: ReturnCallback<string>): void;
size(path: Path | string, callback: ReturnCallback<number>): void;
size(path: Path | string, targetSource: boolean, callback: ReturnCallback<number>): void;
addSubTree(rootPath: Path | string, subTree: SubTree, callback: SimpleCallback): any;
addSubTree(rootPath: Path | string, resourceType: ResourceType, callback: SimpleCallback): any;
create(path: Path | string, type: ResourceType, callback: SimpleCallback): void;
create(path: Path | string, type: ResourceType, createIntermediates: boolean, callback: SimpleCallback): void;
etag(path: Path | string, callback: ReturnCallback<string>): void;
move(pathFrom: Path | string, pathTo: Path | string, callback: ReturnCallback<boolean>): void;
move(pathFrom: Path | string, pathTo: Path | string, overwrite: boolean, callback: ReturnCallback<boolean>): void;
rename(pathFrom: Path | string, newName: string, callback: ReturnCallback<boolean>): void;
rename(pathFrom: Path | string, newName: string, overwrite: boolean, callback: ReturnCallback<boolean>): void;
availableLocks(path: Path | string, callback: ReturnCallback<LockKind[]>): void;
lockManager(path: Path | string, callback: ReturnCallback<ILockManager>): void;
propertyManager(path: Path | string, callback: ReturnCallback<IPropertyManager>): void;
readDir(path: Path | string, callback: ReturnCallback<string[]>): void;
readDir(path: Path | string, retrieveExternalFiles: boolean, callback: ReturnCallback<string[]>): void;
creationDate(path: Path | string, callback: ReturnCallback<number>): void;
lastModifiedDate(path: Path | string, callback: ReturnCallback<number>): void;
webName(path: Path | string, callback: ReturnCallback<string>): void;
displayName(path: Path | string, callback: ReturnCallback<string>): void;
type(path: Path | string, callback: ReturnCallback<ResourceType>): void;
listDeepLocks(startPath: Path | string, callback: ReturnCallback<{
[path: string]: Lock[];
}>): any;
listDeepLocks(startPath: Path, depth: number, callback: ReturnCallback<{
listDeepLocks(startPath: Path | string, depth: number, callback: ReturnCallback<{
[path: string]: Lock[];
}>): any;
serializer(): FileSystemSerializer;
Expand Down
16 changes: 8 additions & 8 deletions lib/manager/v2/fileSystem/Resource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { Path } from '../Path';
import { IPropertyManager } from './PropertyManager';
import { ILockManager } from './LockManager';
export declare class Resource {
path: Path;
fs: FileSystem;
context: RequestContext;
constructor(path: Path, fs: FileSystem, context: RequestContext);
path: Path;
constructor(path: Path | string, fs: FileSystem, context: RequestContext);
delete(callback: SimpleCallback): void;
delete(depth: number, callback: SimpleCallback): void;
openWriteStream(callback: Return2Callback<Writable, boolean>): void;
Expand All @@ -27,10 +27,10 @@ export declare class Resource {
openReadStream(estimatedSize: number, callback: ReturnCallback<Readable>): void;
openReadStream(targetSource: boolean, callback: ReturnCallback<Readable>): void;
openReadStream(targetSource: boolean, estimatedSize: number, callback: ReturnCallback<Readable>): void;
copy(pathTo: Path, callback: ReturnCallback<boolean>): void;
copy(pathTo: Path, depth: number, callback: ReturnCallback<boolean>): void;
copy(pathTo: Path, overwrite: boolean, callback: ReturnCallback<boolean>): void;
copy(pathTo: Path, overwrite: boolean, depth: number, callback: ReturnCallback<boolean>): void;
copy(pathTo: Path | string, callback: ReturnCallback<boolean>): void;
copy(pathTo: Path | string, depth: number, callback: ReturnCallback<boolean>): void;
copy(pathTo: Path | string, overwrite: boolean, callback: ReturnCallback<boolean>): void;
copy(pathTo: Path | string, overwrite: boolean, depth: number, callback: ReturnCallback<boolean>): void;
mimeType(callback: ReturnCallback<string>): void;
mimeType(targetSource: boolean, callback: ReturnCallback<string>): void;
size(callback: ReturnCallback<number>): void;
Expand All @@ -40,8 +40,8 @@ export declare class Resource {
create(type: ResourceType, callback: SimpleCallback): void;
create(type: ResourceType, createIntermediates: boolean, callback: SimpleCallback): void;
etag(callback: ReturnCallback<string>): void;
move(pathTo: Path, callback: ReturnCallback<boolean>): void;
move(pathTo: Path, overwrite: boolean, callback: ReturnCallback<boolean>): void;
move(pathTo: Path | string, callback: ReturnCallback<boolean>): void;
move(pathTo: Path | string, overwrite: boolean, callback: ReturnCallback<boolean>): void;
rename(newName: string, callback: ReturnCallback<boolean>): void;
rename(newName: string, overwrite: boolean, callback: ReturnCallback<boolean>): void;
availableLocks(callback: ReturnCallback<LockKind[]>): void;
Expand Down
3 changes: 2 additions & 1 deletion lib/manager/v2/fileSystem/Resource.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Path_1 = require("../Path");
var Resource = (function () {
function Resource(path, fs, context) {
this.path = path;
this.fs = fs;
this.context = context;
this.path = new Path_1.Path(path);
}
Resource.prototype.delete = function (_depth, _callback) {
this.fs.delete(this.context, this.path, _depth, _callback);
Expand Down

0 comments on commit 5c987c6

Please sign in to comment.