@xnestjs/storage 0.9.0 → 0.10.4
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/cjs/index.js +0 -1
- package/cjs/providers/s3-storage-connection.js +0 -1
- package/cjs/storage-core.module.js +38 -37
- package/cjs/storage.constants.js +2 -2
- package/cjs/storage.module.js +3 -1
- package/cjs/storage.utils.js +5 -14
- package/esm/index.js +0 -1
- package/esm/providers/s3-storage-connection.js +0 -1
- package/esm/storage-core.module.js +39 -38
- package/esm/storage.constants.js +1 -1
- package/esm/storage.module.js +3 -1
- package/esm/storage.utils.js +5 -13
- package/package.json +3 -4
- package/types/index.d.cts +0 -1
- package/types/index.d.ts +0 -1
- package/types/interfaces/storage.interfaces.d.ts +22 -19
- package/types/providers/s3-storage-connection.d.ts +2 -2
- package/types/storage-core.module.d.ts +2 -5
- package/types/storage.constants.d.ts +1 -1
- package/types/storage.module.d.ts +1 -1
- package/types/storage.utils.d.ts +1 -2
- package/cjs/storage.decorators.js +0 -7
- package/esm/storage.decorators.js +0 -3
- package/types/storage.decorators.d.ts +0 -1
package/cjs/index.js
CHANGED
|
@@ -6,5 +6,4 @@ tslib_1.__exportStar(require("./interfaces/storage.interfaces.js"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("./services/storage-bucket.js"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./services/storage-connection.js"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./storage.constants.js"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./storage.decorators.js"), exports);
|
|
10
9
|
tslib_1.__exportStar(require("./storage.module.js"), exports);
|
|
@@ -8,7 +8,6 @@ class S3StorageConnection extends storage_connection_js_1.StorageConnection {
|
|
|
8
8
|
constructor(options) {
|
|
9
9
|
super();
|
|
10
10
|
this._client = new Minio.Client(options);
|
|
11
|
-
// todo: remove casting to any later. https://github.com/minio/minio-js/issues/1163
|
|
12
11
|
this._client.setRequestOptions({ rejectUnauthorized: options.rejectUnauthorized });
|
|
13
12
|
}
|
|
14
13
|
async putObject(bucketName, objectName, source, options) {
|
|
@@ -4,61 +4,62 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.StorageCoreModule = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const common_1 = require("@nestjs/common");
|
|
7
|
+
const storage_connection_js_1 = require("./services/storage-connection.js");
|
|
8
|
+
const storage_constants_js_1 = require("./storage.constants.js");
|
|
7
9
|
const storage_utils_js_1 = require("./storage.utils.js");
|
|
8
10
|
let StorageCoreModule = StorageCoreModule_1 = class StorageCoreModule {
|
|
9
11
|
static register(options) {
|
|
10
12
|
const connectionProvider = {
|
|
11
|
-
provide:
|
|
13
|
+
provide: options.token || storage_connection_js_1.StorageConnection,
|
|
12
14
|
useValue: (0, storage_utils_js_1.createConnection)(options),
|
|
13
15
|
};
|
|
14
16
|
return {
|
|
15
17
|
module: StorageCoreModule_1,
|
|
16
18
|
providers: [connectionProvider],
|
|
17
19
|
exports: [connectionProvider],
|
|
20
|
+
global: options.global,
|
|
18
21
|
};
|
|
19
22
|
}
|
|
20
|
-
static
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
module: StorageCoreModule_1,
|
|
24
|
-
imports: asyncOptions.imports || [],
|
|
25
|
-
providers,
|
|
26
|
-
exports: providers,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
static createAsyncProviders(asyncOptions) {
|
|
30
|
-
if (asyncOptions.useFactory || asyncOptions.useExisting)
|
|
31
|
-
return [this.createAsyncOptionsProvider(asyncOptions)];
|
|
32
|
-
if (asyncOptions.useClass) {
|
|
33
|
-
return [
|
|
34
|
-
this.createAsyncOptionsProvider(asyncOptions),
|
|
35
|
-
{ provide: asyncOptions.useClass, useClass: asyncOptions.useClass },
|
|
36
|
-
];
|
|
37
|
-
}
|
|
38
|
-
throw new Error('Invalid configuration. Must provide useFactory, useClass or useExisting');
|
|
39
|
-
}
|
|
40
|
-
static createAsyncOptionsProvider(asyncOptions) {
|
|
23
|
+
static registerAsync(asyncOptions) {
|
|
24
|
+
let optionsProvider;
|
|
41
25
|
if (asyncOptions.useFactory) {
|
|
42
|
-
|
|
43
|
-
provide:
|
|
44
|
-
useFactory: this.createFactoryWrapper(asyncOptions.useFactory),
|
|
26
|
+
optionsProvider = {
|
|
27
|
+
provide: storage_constants_js_1.STORAGE_OPTIONS,
|
|
45
28
|
inject: asyncOptions.inject || [],
|
|
29
|
+
useFactory: asyncOptions.useFactory,
|
|
46
30
|
};
|
|
47
31
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
useFactory: this.createFactoryWrapper((optionsFactory) => optionsFactory.getOptions()),
|
|
53
|
-
inject: [useClass],
|
|
32
|
+
else if (asyncOptions.useExisting) {
|
|
33
|
+
optionsProvider = {
|
|
34
|
+
provide: storage_constants_js_1.STORAGE_OPTIONS,
|
|
35
|
+
useExisting: asyncOptions.useExisting,
|
|
54
36
|
};
|
|
55
37
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
38
|
+
else if (asyncOptions.useClass) {
|
|
39
|
+
optionsProvider = {
|
|
40
|
+
provide: storage_constants_js_1.STORAGE_OPTIONS,
|
|
41
|
+
useClass: asyncOptions.useClass,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
throw new Error('Invalid configuration. Must provide useFactory, useClass or useExisting');
|
|
46
|
+
}
|
|
47
|
+
const providers = [
|
|
48
|
+
optionsProvider,
|
|
49
|
+
{
|
|
50
|
+
provide: asyncOptions.token || storage_connection_js_1.StorageConnection,
|
|
51
|
+
inject: [storage_constants_js_1.STORAGE_OPTIONS],
|
|
52
|
+
useFactory: (options) => (0, storage_utils_js_1.createConnection)(options),
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
if (asyncOptions.providers)
|
|
56
|
+
providers.push(...asyncOptions.providers);
|
|
57
|
+
return {
|
|
58
|
+
module: StorageCoreModule_1,
|
|
59
|
+
imports: asyncOptions.imports || [],
|
|
60
|
+
exports: asyncOptions.exports || [],
|
|
61
|
+
providers,
|
|
62
|
+
global: asyncOptions.global,
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
65
|
};
|
package/cjs/storage.constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.STORAGE_OPTIONS = void 0;
|
|
4
|
+
exports.STORAGE_OPTIONS = Symbol('STORAGE_OPTIONS');
|
package/cjs/storage.module.js
CHANGED
|
@@ -10,12 +10,14 @@ let StorageModule = StorageModule_1 = class StorageModule {
|
|
|
10
10
|
return {
|
|
11
11
|
module: StorageModule_1,
|
|
12
12
|
imports: [storage_core_module_js_1.StorageCoreModule.register(options)],
|
|
13
|
+
global: options.global,
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
16
|
static registerAsync(options) {
|
|
16
17
|
return {
|
|
17
18
|
module: StorageModule_1,
|
|
18
|
-
imports: [storage_core_module_js_1.StorageCoreModule.
|
|
19
|
+
imports: [storage_core_module_js_1.StorageCoreModule.registerAsync(options)],
|
|
20
|
+
global: options.global,
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
23
|
};
|
package/cjs/storage.utils.js
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getStorageConnectionToken = getStorageConnectionToken;
|
|
4
3
|
exports.createConnection = createConnection;
|
|
5
4
|
const s3_storage_connection_js_1 = require("./providers/s3-storage-connection.js");
|
|
6
|
-
const storage_connection_js_1 = require("./services/storage-connection.js");
|
|
7
|
-
function getStorageConnectionToken(name) {
|
|
8
|
-
if (!name)
|
|
9
|
-
return storage_connection_js_1.StorageConnection;
|
|
10
|
-
// noinspection SuspiciousTypeOfGuard
|
|
11
|
-
if (typeof name === 'symbol' || typeof name === 'function')
|
|
12
|
-
return name;
|
|
13
|
-
return `${name}_StorageConnection`;
|
|
14
|
-
}
|
|
15
5
|
function createConnection(options) {
|
|
16
|
-
if (!options.config)
|
|
17
|
-
throw new Error('You must provide storage config');
|
|
18
6
|
switch (options.type) {
|
|
19
|
-
case 's3':
|
|
20
|
-
|
|
7
|
+
case 's3': {
|
|
8
|
+
if (!options.s3)
|
|
9
|
+
throw new Error('You must provide S3 config');
|
|
10
|
+
return new s3_storage_connection_js_1.S3StorageConnection(options.s3);
|
|
11
|
+
}
|
|
21
12
|
default:
|
|
22
13
|
throw new Error(`Unknown Storage provider type ${options.type}`);
|
|
23
14
|
}
|
package/esm/index.js
CHANGED
|
@@ -3,5 +3,4 @@ export * from './interfaces/storage.interfaces.js';
|
|
|
3
3
|
export * from './services/storage-bucket.js';
|
|
4
4
|
export * from './services/storage-connection.js';
|
|
5
5
|
export * from './storage.constants.js';
|
|
6
|
-
export * from './storage.decorators.js';
|
|
7
6
|
export * from './storage.module.js';
|
|
@@ -4,7 +4,6 @@ export class S3StorageConnection extends StorageConnection {
|
|
|
4
4
|
constructor(options) {
|
|
5
5
|
super();
|
|
6
6
|
this._client = new Minio.Client(options);
|
|
7
|
-
// todo: remove casting to any later. https://github.com/minio/minio-js/issues/1163
|
|
8
7
|
this._client.setRequestOptions({ rejectUnauthorized: options.rejectUnauthorized });
|
|
9
8
|
}
|
|
10
9
|
async putObject(bucketName, objectName, source, options) {
|
|
@@ -1,61 +1,62 @@
|
|
|
1
1
|
var StorageCoreModule_1;
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
3
|
import { Global, Module } from '@nestjs/common';
|
|
4
|
-
import {
|
|
4
|
+
import { StorageConnection } from './services/storage-connection.js';
|
|
5
|
+
import { STORAGE_OPTIONS } from './storage.constants.js';
|
|
6
|
+
import { createConnection } from './storage.utils.js';
|
|
5
7
|
let StorageCoreModule = StorageCoreModule_1 = class StorageCoreModule {
|
|
6
8
|
static register(options) {
|
|
7
9
|
const connectionProvider = {
|
|
8
|
-
provide:
|
|
10
|
+
provide: options.token || StorageConnection,
|
|
9
11
|
useValue: createConnection(options),
|
|
10
12
|
};
|
|
11
13
|
return {
|
|
12
14
|
module: StorageCoreModule_1,
|
|
13
15
|
providers: [connectionProvider],
|
|
14
16
|
exports: [connectionProvider],
|
|
17
|
+
global: options.global,
|
|
15
18
|
};
|
|
16
19
|
}
|
|
17
|
-
static
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
module: StorageCoreModule_1,
|
|
21
|
-
imports: asyncOptions.imports || [],
|
|
22
|
-
providers,
|
|
23
|
-
exports: providers,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
static createAsyncProviders(asyncOptions) {
|
|
27
|
-
if (asyncOptions.useFactory || asyncOptions.useExisting)
|
|
28
|
-
return [this.createAsyncOptionsProvider(asyncOptions)];
|
|
29
|
-
if (asyncOptions.useClass) {
|
|
30
|
-
return [
|
|
31
|
-
this.createAsyncOptionsProvider(asyncOptions),
|
|
32
|
-
{ provide: asyncOptions.useClass, useClass: asyncOptions.useClass },
|
|
33
|
-
];
|
|
34
|
-
}
|
|
35
|
-
throw new Error('Invalid configuration. Must provide useFactory, useClass or useExisting');
|
|
36
|
-
}
|
|
37
|
-
static createAsyncOptionsProvider(asyncOptions) {
|
|
20
|
+
static registerAsync(asyncOptions) {
|
|
21
|
+
let optionsProvider;
|
|
38
22
|
if (asyncOptions.useFactory) {
|
|
39
|
-
|
|
40
|
-
provide:
|
|
41
|
-
useFactory: this.createFactoryWrapper(asyncOptions.useFactory),
|
|
23
|
+
optionsProvider = {
|
|
24
|
+
provide: STORAGE_OPTIONS,
|
|
42
25
|
inject: asyncOptions.inject || [],
|
|
26
|
+
useFactory: asyncOptions.useFactory,
|
|
43
27
|
};
|
|
44
28
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
useFactory: this.createFactoryWrapper((optionsFactory) => optionsFactory.getOptions()),
|
|
50
|
-
inject: [useClass],
|
|
29
|
+
else if (asyncOptions.useExisting) {
|
|
30
|
+
optionsProvider = {
|
|
31
|
+
provide: STORAGE_OPTIONS,
|
|
32
|
+
useExisting: asyncOptions.useExisting,
|
|
51
33
|
};
|
|
52
34
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
35
|
+
else if (asyncOptions.useClass) {
|
|
36
|
+
optionsProvider = {
|
|
37
|
+
provide: STORAGE_OPTIONS,
|
|
38
|
+
useClass: asyncOptions.useClass,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
throw new Error('Invalid configuration. Must provide useFactory, useClass or useExisting');
|
|
43
|
+
}
|
|
44
|
+
const providers = [
|
|
45
|
+
optionsProvider,
|
|
46
|
+
{
|
|
47
|
+
provide: asyncOptions.token || StorageConnection,
|
|
48
|
+
inject: [STORAGE_OPTIONS],
|
|
49
|
+
useFactory: (options) => createConnection(options),
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
if (asyncOptions.providers)
|
|
53
|
+
providers.push(...asyncOptions.providers);
|
|
54
|
+
return {
|
|
55
|
+
module: StorageCoreModule_1,
|
|
56
|
+
imports: asyncOptions.imports || [],
|
|
57
|
+
exports: asyncOptions.exports || [],
|
|
58
|
+
providers,
|
|
59
|
+
global: asyncOptions.global,
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
};
|
package/esm/storage.constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const STORAGE_OPTIONS = Symbol('STORAGE_OPTIONS');
|
package/esm/storage.module.js
CHANGED
|
@@ -7,12 +7,14 @@ let StorageModule = StorageModule_1 = class StorageModule {
|
|
|
7
7
|
return {
|
|
8
8
|
module: StorageModule_1,
|
|
9
9
|
imports: [StorageCoreModule.register(options)],
|
|
10
|
+
global: options.global,
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
13
|
static registerAsync(options) {
|
|
13
14
|
return {
|
|
14
15
|
module: StorageModule_1,
|
|
15
|
-
imports: [StorageCoreModule.
|
|
16
|
+
imports: [StorageCoreModule.registerAsync(options)],
|
|
17
|
+
global: options.global,
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
20
|
};
|
package/esm/storage.utils.js
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
import { S3StorageConnection } from './providers/s3-storage-connection.js';
|
|
2
|
-
import { StorageConnection } from './services/storage-connection.js';
|
|
3
|
-
export function getStorageConnectionToken(name) {
|
|
4
|
-
if (!name)
|
|
5
|
-
return StorageConnection;
|
|
6
|
-
// noinspection SuspiciousTypeOfGuard
|
|
7
|
-
if (typeof name === 'symbol' || typeof name === 'function')
|
|
8
|
-
return name;
|
|
9
|
-
return `${name}_StorageConnection`;
|
|
10
|
-
}
|
|
11
2
|
export function createConnection(options) {
|
|
12
|
-
if (!options.config)
|
|
13
|
-
throw new Error('You must provide storage config');
|
|
14
3
|
switch (options.type) {
|
|
15
|
-
case 's3':
|
|
16
|
-
|
|
4
|
+
case 's3': {
|
|
5
|
+
if (!options.s3)
|
|
6
|
+
throw new Error('You must provide S3 config');
|
|
7
|
+
return new S3StorageConnection(options.s3);
|
|
8
|
+
}
|
|
17
9
|
default:
|
|
18
10
|
throw new Error(`Unknown Storage provider type ${options.type}`);
|
|
19
11
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xnestjs/storage",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.4",
|
|
4
4
|
"description": "NestJS extension library for Storage solutions (S3,GS)",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@nestjs/common": "^10.4.
|
|
8
|
+
"@nestjs/common": "^10.4.7"
|
|
9
9
|
},
|
|
10
10
|
"optionalDependencies": {
|
|
11
|
-
"minio": "^8.0.
|
|
11
|
+
"minio": "^8.0.2"
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
|
14
14
|
"exports": {
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"npm": ">=7.0.0"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
|
-
"bin/",
|
|
41
40
|
"cjs/",
|
|
42
41
|
"esm/",
|
|
43
42
|
"types/",
|
package/types/index.d.cts
CHANGED
|
@@ -3,5 +3,4 @@ export * from './interfaces/storage.interfaces.js';
|
|
|
3
3
|
export * from './services/storage-bucket.js';
|
|
4
4
|
export * from './services/storage-connection.js';
|
|
5
5
|
export * from './storage.constants.js';
|
|
6
|
-
export * from './storage.decorators.js';
|
|
7
6
|
export * from './storage.module.js';
|
package/types/index.d.ts
CHANGED
|
@@ -3,5 +3,4 @@ export * from './interfaces/storage.interfaces.js';
|
|
|
3
3
|
export * from './services/storage-bucket.js';
|
|
4
4
|
export * from './services/storage-connection.js';
|
|
5
5
|
export * from './storage.constants.js';
|
|
6
|
-
export * from './storage.decorators.js';
|
|
7
6
|
export * from './storage.module.js';
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ModuleMetadata, Type } from '@nestjs/common/interfaces';
|
|
3
|
-
import * as minio from 'minio';
|
|
4
|
-
export type
|
|
5
|
-
rejectUnauthorized
|
|
1
|
+
import type { InjectionToken } from '@nestjs/common';
|
|
2
|
+
import type { ModuleMetadata, Type } from '@nestjs/common/interfaces';
|
|
3
|
+
import type * as minio from 'minio';
|
|
4
|
+
export type S3Config = minio.ClientOptions & {
|
|
5
|
+
rejectUnauthorized?: boolean;
|
|
6
6
|
};
|
|
7
7
|
export type AbstractType<T> = abstract new (...args: any[]) => T;
|
|
8
|
-
export interface
|
|
9
|
-
type: 's3'
|
|
10
|
-
|
|
8
|
+
export interface S3StorageOptions {
|
|
9
|
+
type: 's3';
|
|
10
|
+
s3: S3Config;
|
|
11
11
|
}
|
|
12
|
+
export interface GSStorageOptions {
|
|
13
|
+
type: 'gs';
|
|
14
|
+
gs: {};
|
|
15
|
+
}
|
|
16
|
+
export type StorageOptions = S3StorageOptions | GSStorageOptions;
|
|
12
17
|
export type StorageModuleOptions = StorageOptions & {
|
|
13
|
-
|
|
18
|
+
token?: InjectionToken;
|
|
19
|
+
global?: boolean;
|
|
14
20
|
};
|
|
15
|
-
export interface
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
useExisting?: Type<StorageModuleOptionsFactory>;
|
|
23
|
-
useFactory?: (...args: any[]) => Promise<StorageModuleOptions> | StorageModuleOptions;
|
|
24
|
-
extraProviders?: Provider[];
|
|
21
|
+
export interface StorageModuleAsyncOptions<I extends [any]> extends Pick<ModuleMetadata, 'imports' | 'exports' | 'providers'> {
|
|
22
|
+
token?: InjectionToken;
|
|
23
|
+
inject?: I;
|
|
24
|
+
global?: boolean;
|
|
25
|
+
useClass?: Type<StorageOptions>;
|
|
26
|
+
useExisting?: InjectionToken;
|
|
27
|
+
useFactory?: (...args: I) => Promise<StorageOptions> | StorageOptions;
|
|
25
28
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Buffer } from 'buffer';
|
|
2
2
|
import { Readable } from 'stream';
|
|
3
3
|
import { GetObjectSignedUrlOptions, ObjectInfo, PutObjectOptions } from '../interfaces/connection.interfaces.js';
|
|
4
|
-
import {
|
|
4
|
+
import { S3Config } from '../interfaces/storage.interfaces.js';
|
|
5
5
|
import { StorageConnection } from '../services/storage-connection.js';
|
|
6
6
|
export declare class S3StorageConnection extends StorageConnection {
|
|
7
7
|
private _client;
|
|
8
|
-
constructor(options:
|
|
8
|
+
constructor(options: S3Config);
|
|
9
9
|
putObject(bucketName: string, objectName: string, source: Buffer | Readable | string, options?: PutObjectOptions): Promise<void>;
|
|
10
10
|
getObjectInfo(bucketName: string, objectName: string): Promise<ObjectInfo>;
|
|
11
11
|
removeObject(bucketName: string, objectName: string): Promise<void>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { DynamicModule
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
2
|
import { StorageModuleAsyncOptions, StorageModuleOptions } from './interfaces/storage.interfaces.js';
|
|
3
3
|
export declare class StorageCoreModule {
|
|
4
4
|
static register(options: StorageModuleOptions): DynamicModule;
|
|
5
|
-
static
|
|
6
|
-
static createAsyncProviders(asyncOptions: StorageModuleAsyncOptions): Provider[];
|
|
7
|
-
static createAsyncOptionsProvider(asyncOptions: StorageModuleAsyncOptions): Provider;
|
|
8
|
-
private static createFactoryWrapper;
|
|
5
|
+
static registerAsync<I extends [any] = never>(asyncOptions: StorageModuleAsyncOptions<I>): DynamicModule;
|
|
9
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const STORAGE_OPTIONS: unique symbol;
|
|
@@ -2,5 +2,5 @@ import { DynamicModule } from '@nestjs/common';
|
|
|
2
2
|
import { StorageModuleAsyncOptions, StorageModuleOptions } from './interfaces/storage.interfaces.js';
|
|
3
3
|
export declare class StorageModule {
|
|
4
4
|
static register(options: StorageModuleOptions): DynamicModule;
|
|
5
|
-
static registerAsync(options: StorageModuleAsyncOptions): DynamicModule;
|
|
5
|
+
static registerAsync<I extends [any] = never>(options: StorageModuleAsyncOptions<I>): DynamicModule;
|
|
6
6
|
}
|
package/types/storage.utils.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StorageModuleOptions } from './interfaces/storage.interfaces.js';
|
|
2
2
|
import { StorageConnection } from './services/storage-connection.js';
|
|
3
|
-
export declare function getStorageConnectionToken(name?: string | symbol | AbstractType<StorageConnection>): string | symbol | AbstractType<StorageConnection>;
|
|
4
3
|
export declare function createConnection(options: StorageModuleOptions): StorageConnection;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InjectStorage = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const storage_utils_js_1 = require("./storage.utils.js");
|
|
6
|
-
const InjectStorage = (connection) => (0, common_1.Inject)((0, storage_utils_js_1.getStorageConnectionToken)(connection));
|
|
7
|
-
exports.InjectStorage = InjectStorage;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const InjectStorage: (connection?: string) => ParameterDecorator;
|