@nuvix/storage 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7375 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +469 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +7360 -0
- package/dist/index.js.map +1 -0
- package/package.json +12 -18
- package/dist/index.cjs.js +0 -1296
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.esm.js +0 -1283
- package/dist/index.esm.js.map +0 -1
- package/dist/src/device/local.d.ts +0 -31
- package/dist/src/device/local.d.ts.map +0 -1
- package/dist/src/device/minio.d.ts +0 -16
- package/dist/src/device/minio.d.ts.map +0 -1
- package/dist/src/device/s3.d.ts +0 -94
- package/dist/src/device/s3.d.ts.map +0 -1
- package/dist/src/device/wasabi.d.ts +0 -24
- package/dist/src/device/wasabi.d.ts.map +0 -1
- package/dist/src/device.d.ts +0 -146
- package/dist/src/device.d.ts.map +0 -1
- package/dist/src/storage.d.ts +0 -57
- package/dist/src/storage.d.ts.map +0 -1
- package/dist/src/validator/file-ext.d.ts +0 -15
- package/dist/src/validator/file-ext.d.ts.map +0 -1
- package/dist/src/validator/file-name.d.ts +0 -15
- package/dist/src/validator/file-name.d.ts.map +0 -1
- package/dist/src/validator/file-size.d.ts +0 -17
- package/dist/src/validator/file-size.d.ts.map +0 -1
- package/dist/src/validator/file-type.d.ts +0 -27
- package/dist/src/validator/file-type.d.ts.map +0 -1
- package/dist/src/validator/file.d.ts +0 -14
- package/dist/src/validator/file.d.ts.map +0 -1
- package/dist/src/validator/upload.d.ts +0 -15
- package/dist/src/validator/upload.d.ts.map +0 -1
- package/dist/src/validator/validator.d.ts +0 -8
- package/dist/src/validator/validator.d.ts.map +0 -1
package/dist/src/storage.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Device } from "./device";
|
|
2
|
-
export declare class Storage {
|
|
3
|
-
/**
|
|
4
|
-
* Supported devices
|
|
5
|
-
*/
|
|
6
|
-
static readonly DEVICE_LOCAL = "local";
|
|
7
|
-
static readonly DEVICE_S3 = "s3";
|
|
8
|
-
static readonly DEVICE_WASABI = "wasabi";
|
|
9
|
-
static readonly DEVICE_MINIO = "minio";
|
|
10
|
-
/**
|
|
11
|
-
* Devices.
|
|
12
|
-
*
|
|
13
|
-
* List of all available storage devices
|
|
14
|
-
*/
|
|
15
|
-
private static devices;
|
|
16
|
-
/**
|
|
17
|
-
* Set Device.
|
|
18
|
-
*
|
|
19
|
-
* Add device by name
|
|
20
|
-
*
|
|
21
|
-
* @param name
|
|
22
|
-
* @param device
|
|
23
|
-
* @throws Error
|
|
24
|
-
*/
|
|
25
|
-
static setDevice(name: string, device: Device): void;
|
|
26
|
-
/**
|
|
27
|
-
* Get Device.
|
|
28
|
-
*
|
|
29
|
-
* Get device by name
|
|
30
|
-
*
|
|
31
|
-
* @param name
|
|
32
|
-
* @returns Device
|
|
33
|
-
* @throws Error
|
|
34
|
-
*/
|
|
35
|
-
static getDevice(name: string): Device;
|
|
36
|
-
/**
|
|
37
|
-
* Exists.
|
|
38
|
-
*
|
|
39
|
-
* Checks if given storage name is registered or not
|
|
40
|
-
*
|
|
41
|
-
* @param name
|
|
42
|
-
* @returns boolean
|
|
43
|
-
*/
|
|
44
|
-
static exists(name: string): boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Human readable data size format from bytes input.
|
|
47
|
-
*
|
|
48
|
-
* Based on: https://stackoverflow.com/a/38659168/2299554
|
|
49
|
-
*
|
|
50
|
-
* @param bytes
|
|
51
|
-
* @param decimals
|
|
52
|
-
* @param system
|
|
53
|
-
* @returns string
|
|
54
|
-
*/
|
|
55
|
-
static human(bytes: number, decimals?: number, system?: "binary" | "metric"): string;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,OAAO;IAClB;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,YAAY,WAAW;IACvC,MAAM,CAAC,QAAQ,CAAC,SAAS,QAAQ;IAEjC,MAAM,CAAC,QAAQ,CAAC,aAAa,YAAY;IACzC,MAAM,CAAC,QAAQ,CAAC,YAAY,WAAW;IAIvC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,OAAO,CAAkC;IAExD;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAIpD;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAQtC;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIpC;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,CACV,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,MAAU,EACpB,MAAM,GAAE,QAAQ,GAAG,QAAmB,GACrC,MAAM;CAYV"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Validator } from "./validator";
|
|
2
|
-
export declare class FileExt extends Validator {
|
|
3
|
-
static readonly TYPE_JPEG = "jpeg";
|
|
4
|
-
static readonly TYPE_JPG = "jpg";
|
|
5
|
-
static readonly TYPE_GIF = "gif";
|
|
6
|
-
static readonly TYPE_PNG = "png";
|
|
7
|
-
static readonly TYPE_GZIP = "gz";
|
|
8
|
-
static readonly TYPE_ZIP = "zip";
|
|
9
|
-
private allowed;
|
|
10
|
-
constructor(allowed: string[]);
|
|
11
|
-
getDescription(): string;
|
|
12
|
-
isValid(filename: string): boolean;
|
|
13
|
-
private getFileExtension;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=file-ext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-ext.d.ts","sourceRoot":"","sources":["../../../src/validator/file-ext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,OAAQ,SAAQ,SAAS;IACpC,MAAM,CAAC,QAAQ,CAAC,SAAS,UAAU;IACnC,MAAM,CAAC,QAAQ,CAAC,QAAQ,SAAS;IACjC,MAAM,CAAC,QAAQ,CAAC,QAAQ,SAAS;IACjC,MAAM,CAAC,QAAQ,CAAC,QAAQ,SAAS;IACjC,MAAM,CAAC,QAAQ,CAAC,SAAS,QAAQ;IACjC,MAAM,CAAC,QAAQ,CAAC,QAAQ,SAAS;IAEjC,OAAO,CAAC,OAAO,CAAW;gBAEd,OAAO,EAAE,MAAM,EAAE;IAK7B,cAAc,IAAI,MAAM;IAIxB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAKlC,OAAO,CAAC,gBAAgB;CAIzB"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Validator } from "./validator";
|
|
2
|
-
export declare class FileName extends Validator {
|
|
3
|
-
/**
|
|
4
|
-
* Get Description
|
|
5
|
-
*/
|
|
6
|
-
getDescription(): string;
|
|
7
|
-
/**
|
|
8
|
-
* The file name can only contain "a-z", "A-Z", "0-9" and "." and not empty.
|
|
9
|
-
*
|
|
10
|
-
* @param name - The filename to validate
|
|
11
|
-
* @returns boolean indicating if the filename is valid
|
|
12
|
-
*/
|
|
13
|
-
isValid(name: any): boolean;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=file-name.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-name.d.ts","sourceRoot":"","sources":["../../../src/validator/file-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,QAAS,SAAQ,SAAS;IACrC;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO;CAe5B"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Validator } from "./validator";
|
|
2
|
-
export declare class FileSize extends Validator {
|
|
3
|
-
private max;
|
|
4
|
-
/**
|
|
5
|
-
* Max size in bytes
|
|
6
|
-
*/
|
|
7
|
-
constructor(max: number);
|
|
8
|
-
/**
|
|
9
|
-
* Get Description
|
|
10
|
-
*/
|
|
11
|
-
getDescription(): string;
|
|
12
|
-
/**
|
|
13
|
-
* Finds whether a file size is smaller than required limit.
|
|
14
|
-
*/
|
|
15
|
-
isValid(fileSize: any): boolean;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=file-size.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-size.d.ts","sourceRoot":"","sources":["../../../src/validator/file-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,QAAS,SAAQ,SAAS;IACrC,OAAO,CAAC,GAAG,CAAS;IAEpB;;OAEG;gBACS,GAAG,EAAE,MAAM;IAKvB;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO;CAWhC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Validator } from "./validator";
|
|
2
|
-
export declare class FileType extends Validator {
|
|
3
|
-
/**
|
|
4
|
-
* File Types Constants.
|
|
5
|
-
*/
|
|
6
|
-
static readonly FILE_TYPE_JPEG = "jpeg";
|
|
7
|
-
static readonly FILE_TYPE_GIF = "gif";
|
|
8
|
-
static readonly FILE_TYPE_PNG = "png";
|
|
9
|
-
static readonly FILE_TYPE_GZIP = "gz";
|
|
10
|
-
/**
|
|
11
|
-
* File Type Binaries.
|
|
12
|
-
*/
|
|
13
|
-
private readonly types;
|
|
14
|
-
private readonly allowed;
|
|
15
|
-
constructor(allowed: string[]);
|
|
16
|
-
/**
|
|
17
|
-
* Get Description
|
|
18
|
-
*/
|
|
19
|
-
getDescription(): string;
|
|
20
|
-
/**
|
|
21
|
-
* Is Valid.
|
|
22
|
-
*
|
|
23
|
-
* Binary check to finds whether a file is of valid type
|
|
24
|
-
*/
|
|
25
|
-
isValid(path: string): Promise<boolean>;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=file-type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-type.d.ts","sourceRoot":"","sources":["../../../src/validator/file-type.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,QAAS,SAAQ,SAAS;IACrC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,UAAU;IACxC,MAAM,CAAC,QAAQ,CAAC,aAAa,SAAS;IACtC,MAAM,CAAC,QAAQ,CAAC,aAAa,SAAS;IACtC,MAAM,CAAC,QAAQ,CAAC,cAAc,QAAQ;IAEtC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,KAAK,CAKpB;IAEF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;gBAEvB,OAAO,EAAE,MAAM,EAAE;IAY7B;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;;;OAIG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAyB9C"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Validator } from "./validator";
|
|
2
|
-
export declare class File extends Validator {
|
|
3
|
-
getDescription(): string;
|
|
4
|
-
/**
|
|
5
|
-
* NOT MUCH RIGHT NOW.
|
|
6
|
-
*
|
|
7
|
-
* TODO think what to do here, currently only used for parameter to be present in SDKs
|
|
8
|
-
*
|
|
9
|
-
* @param name
|
|
10
|
-
* @return boolean
|
|
11
|
-
*/
|
|
12
|
-
isValid(name: any): boolean;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/validator/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,IAAK,SAAQ,SAAS;IAC1B,cAAc,IAAI,MAAM;IAI/B;;;;;;;OAOG;IACI,OAAO,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO;CAGnC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Validator } from "./validator";
|
|
2
|
-
export declare class Upload extends Validator {
|
|
3
|
-
/**
|
|
4
|
-
* Get Description
|
|
5
|
-
*/
|
|
6
|
-
getDescription(): string;
|
|
7
|
-
/**
|
|
8
|
-
* Check if a file is a valid upload file
|
|
9
|
-
*
|
|
10
|
-
* @param path - The file path to validate
|
|
11
|
-
* @returns Promise that resolves to true if valid upload file, false otherwise
|
|
12
|
-
*/
|
|
13
|
-
isValid(path: unknown): Promise<boolean>;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=upload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/validator/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,qBAAa,MAAO,SAAQ,SAAS;IACnC;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;;;;OAKG;IACG,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAY/C"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare abstract class Validator {
|
|
2
|
-
static TYPE_STRING: string;
|
|
3
|
-
static TYPE_ARRAY: string;
|
|
4
|
-
static TYPE_INTEGER: string;
|
|
5
|
-
static TYPE_BOOLEAN: string;
|
|
6
|
-
abstract isValid(value: any): boolean | Promise<boolean>;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/validator/validator.ts"],"names":[],"mappings":"AAAA,8BAAsB,SAAS;IAC7B,MAAM,CAAC,WAAW,SAAY;IAC9B,MAAM,CAAC,UAAU,SAAW;IAC5B,MAAM,CAAC,YAAY,SAAa;IAChC,MAAM,CAAC,YAAY,SAAa;IAEhC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CACzD"}
|