s3-storage-dtb 0.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/README.md +484 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +6 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/storage-client.d.ts +26 -0
- package/dist/client/storage-client.d.ts.map +1 -0
- package/dist/client/storage-client.js +237 -0
- package/dist/client/storage-client.js.map +1 -0
- package/dist/core/storage-core.d.ts +20 -0
- package/dist/core/storage-core.d.ts.map +1 -0
- package/dist/core/storage-core.js +192 -0
- package/dist/core/storage-core.js.map +1 -0
- package/dist/errors/storage-errors.d.ts +29 -0
- package/dist/errors/storage-errors.d.ts.map +1 -0
- package/dist/errors/storage-errors.js +78 -0
- package/dist/errors/storage-errors.js.map +1 -0
- package/dist/helpers/mime-validator.d.ts +2 -0
- package/dist/helpers/mime-validator.d.ts.map +1 -0
- package/dist/helpers/mime-validator.js +18 -0
- package/dist/helpers/mime-validator.js.map +1 -0
- package/dist/helpers/path-sanitizer.d.ts +8 -0
- package/dist/helpers/path-sanitizer.d.ts.map +1 -0
- package/dist/helpers/path-sanitizer.js +23 -0
- package/dist/helpers/path-sanitizer.js.map +1 -0
- package/dist/helpers/path-validator.d.ts +27 -0
- package/dist/helpers/path-validator.d.ts.map +1 -0
- package/dist/helpers/path-validator.js +66 -0
- package/dist/helpers/path-validator.js.map +1 -0
- package/dist/helpers/size-parser.d.ts +2 -0
- package/dist/helpers/size-parser.d.ts.map +1 -0
- package/dist/helpers/size-parser.js +22 -0
- package/dist/helpers/size-parser.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/nestjs/index.d.ts +4 -0
- package/dist/nestjs/index.d.ts.map +1 -0
- package/dist/nestjs/index.js +8 -0
- package/dist/nestjs/index.js.map +1 -0
- package/dist/nestjs/storage.module.d.ts +13 -0
- package/dist/nestjs/storage.module.d.ts.map +1 -0
- package/dist/nestjs/storage.module.js +86 -0
- package/dist/nestjs/storage.module.js.map +1 -0
- package/dist/nestjs/storage.service.d.ts +17 -0
- package/dist/nestjs/storage.service.d.ts.map +1 -0
- package/dist/nestjs/storage.service.js +106 -0
- package/dist/nestjs/storage.service.js.map +1 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sanitizePath = sanitizePath;
|
|
4
|
+
const path_validator_1 = require("./path-validator");
|
|
5
|
+
/**
|
|
6
|
+
* Valida y normaliza un path. Usa las mismas reglas estrictas que validatePathSafe.
|
|
7
|
+
* Lanza si el path contiene caracteres prohibidos (;, ", ', #, .., cd, etc.).
|
|
8
|
+
* @param allowEmpty - Si true, permite '' (p. ej. directorio raíz en listFiles).
|
|
9
|
+
*/
|
|
10
|
+
function sanitizePath(inputPath, options = {}) {
|
|
11
|
+
const check = (0, path_validator_1.validatePathSafe)(inputPath, options);
|
|
12
|
+
if (!check.valid) {
|
|
13
|
+
throw new Error(check.message ?? 'Path inválido');
|
|
14
|
+
}
|
|
15
|
+
let sanitized = inputPath.trim();
|
|
16
|
+
if (sanitized.length === 0) {
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
// Eliminar barras al inicio y final
|
|
20
|
+
sanitized = sanitized.replace(/^\/+|\/+$/g, '');
|
|
21
|
+
return sanitized;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=path-sanitizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-sanitizer.js","sourceRoot":"","sources":["../../src/helpers/path-sanitizer.ts"],"names":[],"mappings":";;AAUA,oCAiBC;AA3BD,qDAG0B;AAE1B;;;;GAIG;AACH,SAAgB,YAAY,CAC1B,SAAiB,EACjB,UAA+B,EAAE;IAEjC,MAAM,KAAK,GAAG,IAAA,iCAAgB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACnD,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,SAAS,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IACjC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,oCAAoC;IACpC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAEhD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validación estricta de paths.
|
|
3
|
+
* Solo permite: letras, números, / _ - .
|
|
4
|
+
* Prohibido: caracteres especiales, ; " ' # \ point-and-comma, comillas, cd, .., etc.
|
|
5
|
+
*/
|
|
6
|
+
export interface PathValidationResult {
|
|
7
|
+
valid: boolean;
|
|
8
|
+
message?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ValidatePathOptions {
|
|
11
|
+
/** Si true, permite '' (directorio raíz, p. ej. listFiles). Por defecto false. */
|
|
12
|
+
allowEmpty?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Comprueba que un path sea seguro.
|
|
16
|
+
* - Solo a-z, A-Z, 0-9, /, _, -, ., @ (nombres prefix@uuid)
|
|
17
|
+
* - Sin ".." (path traversal)
|
|
18
|
+
* - Sin "cd" como segmento (cambio de ruta)
|
|
19
|
+
* - Sin punto y coma, comillas, #, barras invertidas, etc.
|
|
20
|
+
*/
|
|
21
|
+
export declare function validatePathSafe(path: string, options?: ValidatePathOptions): PathValidationResult;
|
|
22
|
+
/**
|
|
23
|
+
* Versión que lanza si el path es inválido.
|
|
24
|
+
* Útil en guards/pipes donde se espera throw.
|
|
25
|
+
*/
|
|
26
|
+
export declare function assertPathSafe(path: string): void;
|
|
27
|
+
//# sourceMappingURL=path-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-validator.d.ts","sourceRoot":"","sources":["../../src/helpers/path-validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,kFAAkF;IAClF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,mBAAwB,GAChC,oBAAoB,CAyCtB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAKjD"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Validación estricta de paths.
|
|
4
|
+
* Solo permite: letras, números, / _ - .
|
|
5
|
+
* Prohibido: caracteres especiales, ; " ' # \ point-and-comma, comillas, cd, .., etc.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.validatePathSafe = validatePathSafe;
|
|
9
|
+
exports.assertPathSafe = assertPathSafe;
|
|
10
|
+
/** Solo estos caracteres están permitidos en un path (@ en nombres prefix@uuid.ext) */
|
|
11
|
+
const SAFE_PATH_REGEX = /^[a-zA-Z0-9/_.@-]+$/;
|
|
12
|
+
/** Segmentos prohibidos (comandos / cambio de ruta) */
|
|
13
|
+
const FORBIDDEN_SEGMENTS = ['cd', 'CD', 'Cd', 'cD'];
|
|
14
|
+
/**
|
|
15
|
+
* Comprueba que un path sea seguro.
|
|
16
|
+
* - Solo a-z, A-Z, 0-9, /, _, -, ., @ (nombres prefix@uuid)
|
|
17
|
+
* - Sin ".." (path traversal)
|
|
18
|
+
* - Sin "cd" como segmento (cambio de ruta)
|
|
19
|
+
* - Sin punto y coma, comillas, #, barras invertidas, etc.
|
|
20
|
+
*/
|
|
21
|
+
function validatePathSafe(path, options = {}) {
|
|
22
|
+
if (typeof path !== 'string') {
|
|
23
|
+
return { valid: false, message: 'El path debe ser un string' };
|
|
24
|
+
}
|
|
25
|
+
const trimmed = path.trim();
|
|
26
|
+
if (trimmed.length === 0) {
|
|
27
|
+
if (options.allowEmpty) {
|
|
28
|
+
return { valid: true };
|
|
29
|
+
}
|
|
30
|
+
return { valid: false, message: 'El path no puede estar vacío' };
|
|
31
|
+
}
|
|
32
|
+
if (/\.\./.test(trimmed)) {
|
|
33
|
+
return {
|
|
34
|
+
valid: false,
|
|
35
|
+
message: 'El path no puede contener ".." (path traversal). Use solo rutas permitidas.',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (!SAFE_PATH_REGEX.test(trimmed)) {
|
|
39
|
+
return {
|
|
40
|
+
valid: false,
|
|
41
|
+
message: 'El path solo puede contener letras, números, /, _, -, . y @. ' +
|
|
42
|
+
'Prohibidos: punto y coma, comillas, #, \\, espacios y demás caracteres especiales.',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const segments = trimmed.split('/').filter(Boolean);
|
|
46
|
+
for (const seg of segments) {
|
|
47
|
+
if (FORBIDDEN_SEGMENTS.includes(seg)) {
|
|
48
|
+
return {
|
|
49
|
+
valid: false,
|
|
50
|
+
message: 'El path no puede contener el segmento "cd" (cambio de ruta).',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return { valid: true };
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Versión que lanza si el path es inválido.
|
|
58
|
+
* Útil en guards/pipes donde se espera throw.
|
|
59
|
+
*/
|
|
60
|
+
function assertPathSafe(path) {
|
|
61
|
+
const result = validatePathSafe(path);
|
|
62
|
+
if (!result.valid) {
|
|
63
|
+
throw new Error(result.message ?? 'Path inválido');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=path-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-validator.js","sourceRoot":"","sources":["../../src/helpers/path-validator.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAyBH,4CA4CC;AAMD,wCAKC;AA9ED,uFAAuF;AACvF,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAE9C,uDAAuD;AACvD,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAYpD;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAC9B,IAAY,EACZ,UAA+B,EAAE;IAEjC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACjE,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC;IACnE,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,OAAO,EACL,6EAA6E;SAChF,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACnC,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,OAAO,EACL,+DAA+D;gBAC/D,oFAAoF;SACvF,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACpD,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,IAAI,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACrC,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,OAAO,EAAE,8DAA8D;aACxE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,IAAY;IACzC,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"size-parser.d.ts","sourceRoot":"","sources":["../../src/helpers/size-parser.ts"],"names":[],"mappings":"AAUA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQrD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMaxFileSize = parseMaxFileSize;
|
|
4
|
+
/**
|
|
5
|
+
* Parsea strings de tamaño (ej. "50mb", "1gb") a bytes.
|
|
6
|
+
*/
|
|
7
|
+
const UNITS = {
|
|
8
|
+
b: 1,
|
|
9
|
+
kb: 1024,
|
|
10
|
+
mb: 1024 * 1024,
|
|
11
|
+
gb: 1024 * 1024 * 1024,
|
|
12
|
+
};
|
|
13
|
+
function parseMaxFileSize(size) {
|
|
14
|
+
const match = size.toLowerCase().match(/^(\d+)([a-z]+)$/);
|
|
15
|
+
if (!match) {
|
|
16
|
+
return 50 * 1024 * 1024;
|
|
17
|
+
}
|
|
18
|
+
const value = parseInt(match[1], 10);
|
|
19
|
+
const unit = match[2];
|
|
20
|
+
return value * (UNITS[unit] ?? 1024 * 1024);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=size-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"size-parser.js","sourceRoot":"","sources":["../../src/helpers/size-parser.ts"],"names":[],"mappings":";;AAUA,4CAQC;AAlBD;;GAEG;AACH,MAAM,KAAK,GAA2B;IACpC,CAAC,EAAE,CAAC;IACJ,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI,GAAG,IAAI;IACf,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI;CACvB,CAAC;AAEF,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,CAAC;IACD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACtB,OAAO,KAAK,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,IAAI,CAAC,CAAC;AAC9C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { StorageCore } from './core/storage-core';
|
|
2
|
+
export type { StorageCoreOptions } from './types';
|
|
3
|
+
export { StorageClient } from './client/storage-client';
|
|
4
|
+
export type { StorageClientOptions } from './client/storage-client';
|
|
5
|
+
export type { FileMetadata, ListFilesOptions } from './types';
|
|
6
|
+
export { StorageError, FileNotFoundError, InvalidMimeTypeError, FileTooLargeError, UploadError, DownloadError, DeleteError, MetadataError, ListError, } from './errors/storage-errors';
|
|
7
|
+
export { sanitizePath } from './helpers/path-sanitizer';
|
|
8
|
+
export { validatePathSafe, assertPathSafe } from './helpers/path-validator';
|
|
9
|
+
export type { PathValidationResult, ValidatePathOptions } from './helpers/path-validator';
|
|
10
|
+
export { isMimeTypeAllowed } from './helpers/mime-validator';
|
|
11
|
+
export { parseMaxFileSize } from './helpers/size-parser';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGlD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,YAAY,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGpE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG9D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,SAAS,GACV,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC5E,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMaxFileSize = exports.isMimeTypeAllowed = exports.assertPathSafe = exports.validatePathSafe = exports.sanitizePath = exports.ListError = exports.MetadataError = exports.DeleteError = exports.DownloadError = exports.UploadError = exports.FileTooLargeError = exports.InvalidMimeTypeError = exports.FileNotFoundError = exports.StorageError = exports.StorageClient = exports.StorageCore = void 0;
|
|
4
|
+
// Core exports - Para Node.js puro (almacenamiento local)
|
|
5
|
+
var storage_core_1 = require("./core/storage-core");
|
|
6
|
+
Object.defineProperty(exports, "StorageCore", { enumerable: true, get: function () { return storage_core_1.StorageCore; } });
|
|
7
|
+
// Client exports - Para conectarse al backend remoto
|
|
8
|
+
var storage_client_1 = require("./client/storage-client");
|
|
9
|
+
Object.defineProperty(exports, "StorageClient", { enumerable: true, get: function () { return storage_client_1.StorageClient; } });
|
|
10
|
+
// Errors exports
|
|
11
|
+
var storage_errors_1 = require("./errors/storage-errors");
|
|
12
|
+
Object.defineProperty(exports, "StorageError", { enumerable: true, get: function () { return storage_errors_1.StorageError; } });
|
|
13
|
+
Object.defineProperty(exports, "FileNotFoundError", { enumerable: true, get: function () { return storage_errors_1.FileNotFoundError; } });
|
|
14
|
+
Object.defineProperty(exports, "InvalidMimeTypeError", { enumerable: true, get: function () { return storage_errors_1.InvalidMimeTypeError; } });
|
|
15
|
+
Object.defineProperty(exports, "FileTooLargeError", { enumerable: true, get: function () { return storage_errors_1.FileTooLargeError; } });
|
|
16
|
+
Object.defineProperty(exports, "UploadError", { enumerable: true, get: function () { return storage_errors_1.UploadError; } });
|
|
17
|
+
Object.defineProperty(exports, "DownloadError", { enumerable: true, get: function () { return storage_errors_1.DownloadError; } });
|
|
18
|
+
Object.defineProperty(exports, "DeleteError", { enumerable: true, get: function () { return storage_errors_1.DeleteError; } });
|
|
19
|
+
Object.defineProperty(exports, "MetadataError", { enumerable: true, get: function () { return storage_errors_1.MetadataError; } });
|
|
20
|
+
Object.defineProperty(exports, "ListError", { enumerable: true, get: function () { return storage_errors_1.ListError; } });
|
|
21
|
+
// Helpers exports (opcional, para uso avanzado)
|
|
22
|
+
var path_sanitizer_1 = require("./helpers/path-sanitizer");
|
|
23
|
+
Object.defineProperty(exports, "sanitizePath", { enumerable: true, get: function () { return path_sanitizer_1.sanitizePath; } });
|
|
24
|
+
var path_validator_1 = require("./helpers/path-validator");
|
|
25
|
+
Object.defineProperty(exports, "validatePathSafe", { enumerable: true, get: function () { return path_validator_1.validatePathSafe; } });
|
|
26
|
+
Object.defineProperty(exports, "assertPathSafe", { enumerable: true, get: function () { return path_validator_1.assertPathSafe; } });
|
|
27
|
+
var mime_validator_1 = require("./helpers/mime-validator");
|
|
28
|
+
Object.defineProperty(exports, "isMimeTypeAllowed", { enumerable: true, get: function () { return mime_validator_1.isMimeTypeAllowed; } });
|
|
29
|
+
var size_parser_1 = require("./helpers/size-parser");
|
|
30
|
+
Object.defineProperty(exports, "parseMaxFileSize", { enumerable: true, get: function () { return size_parser_1.parseMaxFileSize; } });
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0DAA0D;AAC1D,oDAAkD;AAAzC,2GAAA,WAAW,OAAA;AAGpB,qDAAqD;AACrD,0DAAwD;AAA/C,+GAAA,aAAa,OAAA;AAMtB,iBAAiB;AACjB,0DAUiC;AAT/B,8GAAA,YAAY,OAAA;AACZ,mHAAA,iBAAiB,OAAA;AACjB,sHAAA,oBAAoB,OAAA;AACpB,mHAAA,iBAAiB,OAAA;AACjB,6GAAA,WAAW,OAAA;AACX,+GAAA,aAAa,OAAA;AACb,6GAAA,WAAW,OAAA;AACX,+GAAA,aAAa,OAAA;AACb,2GAAA,SAAS,OAAA;AAGX,gDAAgD;AAChD,2DAAwD;AAA/C,8GAAA,YAAY,OAAA;AACrB,2DAA4E;AAAnE,kHAAA,gBAAgB,OAAA;AAAE,gHAAA,cAAc,OAAA;AAEzC,2DAA6D;AAApD,mHAAA,iBAAiB,OAAA;AAC1B,qDAAyD;AAAhD,+GAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nestjs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StorageService = exports.StorageModule = void 0;
|
|
4
|
+
var storage_module_1 = require("./storage.module");
|
|
5
|
+
Object.defineProperty(exports, "StorageModule", { enumerable: true, get: function () { return storage_module_1.StorageModule; } });
|
|
6
|
+
var storage_service_1 = require("./storage.service");
|
|
7
|
+
Object.defineProperty(exports, "StorageService", { enumerable: true, get: function () { return storage_service_1.StorageService; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nestjs/index.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import type { StorageCoreOptions } from '../types';
|
|
3
|
+
export interface StorageModuleOptions extends StorageCoreOptions {
|
|
4
|
+
}
|
|
5
|
+
export interface StorageModuleAsyncOptions {
|
|
6
|
+
useFactory: (...args: never[]) => Promise<StorageModuleOptions> | StorageModuleOptions;
|
|
7
|
+
inject?: never[];
|
|
8
|
+
}
|
|
9
|
+
export declare class StorageModule {
|
|
10
|
+
static forRoot(options: StorageModuleOptions): DynamicModule;
|
|
11
|
+
static forRootAsync(options: StorageModuleAsyncOptions): DynamicModule;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=storage.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.module.d.ts","sourceRoot":"","sources":["../../src/nestjs/storage.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;CAAG;AAEnE,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,CAAC;IACvF,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;CAClB;AAED,qBACa,aAAa;IACxB,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa;IAa5D,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,yBAAyB,GAAG,aAAa;CAgBvE"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.StorageModule = void 0;
|
|
38
|
+
const common_1 = require("@nestjs/common");
|
|
39
|
+
const storage_service_1 = require("./storage.service");
|
|
40
|
+
let StorageModule = (() => {
|
|
41
|
+
let _classDecorators = [(0, common_1.Module)({})];
|
|
42
|
+
let _classDescriptor;
|
|
43
|
+
let _classExtraInitializers = [];
|
|
44
|
+
let _classThis;
|
|
45
|
+
var StorageModule = class {
|
|
46
|
+
static { _classThis = this; }
|
|
47
|
+
static {
|
|
48
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
49
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
50
|
+
StorageModule = _classThis = _classDescriptor.value;
|
|
51
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
52
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
53
|
+
}
|
|
54
|
+
static forRoot(options) {
|
|
55
|
+
return {
|
|
56
|
+
module: StorageModule,
|
|
57
|
+
providers: [
|
|
58
|
+
{
|
|
59
|
+
provide: storage_service_1.StorageService,
|
|
60
|
+
useFactory: () => new storage_service_1.StorageService(options),
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
exports: [storage_service_1.StorageService],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
static forRootAsync(options) {
|
|
67
|
+
return {
|
|
68
|
+
module: StorageModule,
|
|
69
|
+
providers: [
|
|
70
|
+
{
|
|
71
|
+
provide: storage_service_1.StorageService,
|
|
72
|
+
useFactory: async (...args) => {
|
|
73
|
+
const config = await options.useFactory(...args);
|
|
74
|
+
return new storage_service_1.StorageService(config);
|
|
75
|
+
},
|
|
76
|
+
inject: options.inject ?? [],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
exports: [storage_service_1.StorageService],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return StorageModule = _classThis;
|
|
84
|
+
})();
|
|
85
|
+
exports.StorageModule = StorageModule;
|
|
86
|
+
//# sourceMappingURL=storage.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.module.js","sourceRoot":"","sources":["../../src/nestjs/storage.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAuD;AACvD,uDAAmD;IAWtC,aAAa;4BADzB,IAAA,eAAM,EAAC,EAAE,CAAC;;;;;;;;YACX,6KA8BC;;;YA9BY,uDAAa;;QACxB,MAAM,CAAC,OAAO,CAAC,OAA6B;YAC1C,OAAO;gBACL,MAAM,EAAE,aAAa;gBACrB,SAAS,EAAE;oBACT;wBACE,OAAO,EAAE,gCAAc;wBACvB,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,gCAAc,CAAC,OAAO,CAAC;qBAC9C;iBACF;gBACD,OAAO,EAAE,CAAC,gCAAc,CAAC;aAC1B,CAAC;QACJ,CAAC;QAED,MAAM,CAAC,YAAY,CAAC,OAAkC;YACpD,OAAO;gBACL,MAAM,EAAE,aAAa;gBACrB,SAAS,EAAE;oBACT;wBACE,OAAO,EAAE,gCAAc;wBACvB,UAAU,EAAE,KAAK,EAAE,GAAG,IAAa,EAAE,EAAE;4BACrC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;4BACjD,OAAO,IAAI,gCAAc,CAAC,MAAM,CAAC,CAAC;wBACpC,CAAC;wBACD,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;qBAC7B;iBACF;gBACD,OAAO,EAAE,CAAC,gCAAc,CAAC;aAC1B,CAAC;QACJ,CAAC;;;;AA7BU,sCAAa"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StreamableFile } from '@nestjs/common';
|
|
2
|
+
import type { FileMetadata, ListFilesOptions, StorageCoreOptions } from '../types';
|
|
3
|
+
export declare class StorageService {
|
|
4
|
+
private readonly logger;
|
|
5
|
+
private readonly storageCore;
|
|
6
|
+
constructor(options: StorageCoreOptions);
|
|
7
|
+
uploadFile(filePath: string, buffer: Buffer, mimeType: string, prefix?: string): Promise<string>;
|
|
8
|
+
downloadFile(path: string): Promise<StreamableFile>;
|
|
9
|
+
deleteFile(path: string): Promise<void>;
|
|
10
|
+
getFileMetadata(path: string): Promise<FileMetadata>;
|
|
11
|
+
listFiles(directoryPath?: string, options?: ListFilesOptions): Promise<{
|
|
12
|
+
files: FileMetadata[];
|
|
13
|
+
total: number;
|
|
14
|
+
}>;
|
|
15
|
+
fileExists(path: string): Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=storage.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.service.d.ts","sourceRoot":"","sources":["../../src/nestjs/storage.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnF,qBACa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;IAC1D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;gBAE9B,OAAO,EAAE,kBAAkB;IAIjC,UAAU,CACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC;IAYZ,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAWnD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWvC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAIpD,SAAS,CACb,aAAa,CAAC,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAI9C,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGjD"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.StorageService = void 0;
|
|
38
|
+
const common_1 = require("@nestjs/common");
|
|
39
|
+
const storage_core_1 = require("../core/storage-core");
|
|
40
|
+
let StorageService = (() => {
|
|
41
|
+
let _classDecorators = [(0, common_1.Injectable)()];
|
|
42
|
+
let _classDescriptor;
|
|
43
|
+
let _classExtraInitializers = [];
|
|
44
|
+
let _classThis;
|
|
45
|
+
var StorageService = class {
|
|
46
|
+
static { _classThis = this; }
|
|
47
|
+
static {
|
|
48
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
49
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
50
|
+
StorageService = _classThis = _classDescriptor.value;
|
|
51
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
52
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
53
|
+
}
|
|
54
|
+
logger = new common_1.Logger(StorageService.name);
|
|
55
|
+
storageCore;
|
|
56
|
+
constructor(options) {
|
|
57
|
+
this.storageCore = new storage_core_1.StorageCore(options);
|
|
58
|
+
}
|
|
59
|
+
async uploadFile(filePath, buffer, mimeType, prefix) {
|
|
60
|
+
try {
|
|
61
|
+
const result = await this.storageCore.uploadFile(filePath, buffer, mimeType, prefix);
|
|
62
|
+
this.logger.log(`Archivo subido: ${filePath}`);
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
67
|
+
this.logger.error(`Error al subir archivo: ${message}`);
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async downloadFile(path) {
|
|
72
|
+
try {
|
|
73
|
+
const stream = await this.storageCore.downloadFile(path);
|
|
74
|
+
return new common_1.StreamableFile(stream);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
78
|
+
this.logger.error(`Error al descargar archivo: ${message}`);
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async deleteFile(path) {
|
|
83
|
+
try {
|
|
84
|
+
await this.storageCore.deleteFile(path);
|
|
85
|
+
this.logger.log(`Archivo eliminado: ${path}`);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
89
|
+
this.logger.error(`Error al eliminar archivo: ${message}`);
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async getFileMetadata(path) {
|
|
94
|
+
return this.storageCore.getFileMetadata(path);
|
|
95
|
+
}
|
|
96
|
+
async listFiles(directoryPath, options) {
|
|
97
|
+
return this.storageCore.listFiles(directoryPath, options);
|
|
98
|
+
}
|
|
99
|
+
async fileExists(path) {
|
|
100
|
+
return this.storageCore.fileExists(path);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return StorageService = _classThis;
|
|
104
|
+
})();
|
|
105
|
+
exports.StorageService = StorageService;
|
|
106
|
+
//# sourceMappingURL=storage.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.service.js","sourceRoot":"","sources":["../../src/nestjs/storage.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAoE;AACpE,uDAAmD;IAItC,cAAc;4BAD1B,IAAA,mBAAU,GAAE;;;;;;;;YACb,6KA6DC;;;YA7DY,uDAAc;;QACR,MAAM,GAAG,IAAI,eAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACzC,WAAW,CAAc;QAE1C,YAAY,OAA2B;YACrC,IAAI,CAAC,WAAW,GAAG,IAAI,0BAAW,CAAC,OAAO,CAAC,CAAC;QAC9C,CAAC;QAED,KAAK,CAAC,UAAU,CACd,QAAgB,EAChB,MAAc,EACd,QAAgB,EAChB,MAAe;YAEf,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;gBACrF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;gBAC/C,OAAO,MAAM,CAAC;YAChB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC;gBACxD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QAED,KAAK,CAAC,YAAY,CAAC,IAAY;YAC7B,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;gBACzD,OAAO,IAAI,uBAAc,CAAC,MAAM,CAAC,CAAC;YACpC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;gBAC5D,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QAED,KAAK,CAAC,UAAU,CAAC,IAAY;YAC3B,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;gBACxC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;YAChD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,OAAO,EAAE,CAAC,CAAC;gBAC3D,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QAED,KAAK,CAAC,eAAe,CAAC,IAAY;YAChC,OAAO,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC;QAED,KAAK,CAAC,SAAS,CACb,aAAsB,EACtB,OAA0B;YAE1B,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC5D,CAAC;QAED,KAAK,CAAC,UAAU,CAAC,IAAY;YAC3B,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;;;;AA5DU,wCAAc"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface FileMetadata {
|
|
2
|
+
name: string;
|
|
3
|
+
path: string;
|
|
4
|
+
size: number;
|
|
5
|
+
mimeType: string;
|
|
6
|
+
createdAt: Date;
|
|
7
|
+
modifiedAt: Date;
|
|
8
|
+
checksum?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ListFilesOptions {
|
|
11
|
+
limit?: number;
|
|
12
|
+
offset?: number;
|
|
13
|
+
prefix?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface StorageCoreOptions {
|
|
16
|
+
rootPath: string;
|
|
17
|
+
maxFileSize?: string;
|
|
18
|
+
allowedMimeTypes?: string[];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "s3-storage-dtb",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Paquete de almacenamiento de archivos local para Node.js y NestJS",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./nestjs": {
|
|
14
|
+
"types": "./dist/nestjs/index.d.ts",
|
|
15
|
+
"default": "./dist/nestjs/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"storage",
|
|
24
|
+
"file-storage",
|
|
25
|
+
"local-storage",
|
|
26
|
+
"s3",
|
|
27
|
+
"filesystem",
|
|
28
|
+
"nestjs",
|
|
29
|
+
"DTB"
|
|
30
|
+
],
|
|
31
|
+
"author": "DTB",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"form-data": "^4.0.0",
|
|
35
|
+
"uuid": "^10.0.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@nestjs/common": "^10.0.0 || ^11.0.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependenciesMeta": {
|
|
41
|
+
"@nestjs/common": {
|
|
42
|
+
"optional": true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^22.0.0",
|
|
47
|
+
"@types/uuid": "^10.0.0",
|
|
48
|
+
"typescript": "^5.7.0"
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"dist",
|
|
52
|
+
"README.md"
|
|
53
|
+
]
|
|
54
|
+
}
|