@xnestjs/storage 1.5.3 → 1.6.0

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 CHANGED
@@ -72,6 +72,8 @@ export class MyModule {
72
72
  The library supports configuration through environment variables. Environment variables below is accepted.
73
73
  All environment variables starts with prefix (STORAGE_). This can be configured while registering the module.
74
74
 
75
+ <--- BEGIN env --->
76
+
75
77
  | Environment Variable | Type | Default | Description |
76
78
  |----------------------|------|---------|-------------------------------------|
77
79
  | STORAGE_PROVIDER | Enum | | Storage Provider `s3` for Amazon S3 |
@@ -89,3 +91,5 @@ All environment variables starts with prefix (STORAGE_). This can be configured
89
91
  | STORAGE_S3_PATH_STYLE | Boolean | | |
90
92
  | STORAGE_S3_SECRET_KEY | String | | |
91
93
  | STORAGE_S3_ACC_ENDPOINT | String | | |
94
+
95
+ <--- END env --->
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConnectionOptions = getConnectionOptions;
3
+ exports.getStorageConfig = getStorageConfig;
4
4
  const tslib_1 = require("tslib");
5
5
  const node_process_1 = tslib_1.__importDefault(require("node:process"));
6
6
  const objects_1 = require("@jsopen/objects");
7
7
  const putil_varhelpers_1 = require("putil-varhelpers");
8
- function getConnectionOptions(moduleOptions, prefix = 'STORAGE_') {
8
+ function getStorageConfig(moduleOptions, prefix = 'STORAGE_') {
9
9
  const options = (0, objects_1.clone)(moduleOptions);
10
10
  const env = node_process_1.default.env;
11
11
  options.provider = options.provider || env[prefix + 'PROVIDER'];
package/cjs/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./constants.js"), exports);
5
- tslib_1.__exportStar(require("./get-connection-options.js"), exports);
5
+ tslib_1.__exportStar(require("./get-storage-config.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.module.js"), exports);
@@ -6,7 +6,7 @@ const node_assert_1 = tslib_1.__importDefault(require("node:assert"));
6
6
  const common_1 = require("@nestjs/common");
7
7
  const crypto_1 = tslib_1.__importDefault(require("crypto"));
8
8
  const constants_js_1 = require("./constants.js");
9
- const get_connection_options_js_1 = require("./get-connection-options.js");
9
+ const get_storage_config_js_1 = require("./get-storage-config.js");
10
10
  const s3_storage_connection_js_1 = require("./providers/s3-storage-connection.js");
11
11
  const storage_connection_js_1 = require("./services/storage-connection.js");
12
12
  const CLIENT_TOKEN = Symbol('CLIENT_TOKEN');
@@ -15,7 +15,7 @@ class StorageCoreModule {
15
15
  * Configures and returns a dynamic module
16
16
  */
17
17
  static forRoot(moduleOptions) {
18
- const connectionOptions = (0, get_connection_options_js_1.getConnectionOptions)(moduleOptions.useValue || {}, moduleOptions.envPrefix);
18
+ const connectionOptions = (0, get_storage_config_js_1.getStorageConfig)(moduleOptions.useValue || {}, moduleOptions.envPrefix);
19
19
  return this._createDynamicModule(moduleOptions, {
20
20
  global: moduleOptions.global,
21
21
  providers: [
@@ -39,7 +39,7 @@ class StorageCoreModule {
39
39
  inject: asyncOptions.inject,
40
40
  useFactory: async (...args) => {
41
41
  const opts = await asyncOptions.useFactory(...args);
42
- return (0, get_connection_options_js_1.getConnectionOptions)(opts, asyncOptions.envPrefix);
42
+ return (0, get_storage_config_js_1.getStorageConfig)(opts, asyncOptions.envPrefix);
43
43
  },
44
44
  },
45
45
  ],
@@ -1,7 +1,7 @@
1
1
  import process from 'node:process';
2
2
  import { clone } from '@jsopen/objects';
3
3
  import { toBoolean, toInt } from 'putil-varhelpers';
4
- export function getConnectionOptions(moduleOptions, prefix = 'STORAGE_') {
4
+ export function getStorageConfig(moduleOptions, prefix = 'STORAGE_') {
5
5
  const options = clone(moduleOptions);
6
6
  const env = process.env;
7
7
  options.provider = options.provider || env[prefix + 'PROVIDER'];
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './constants.js';
2
- export * from './get-connection-options.js';
2
+ export * from './get-storage-config.js';
3
3
  export * from './services/storage-bucket.js';
4
4
  export * from './services/storage-connection.js';
5
5
  export * from './storage.module.js';
@@ -2,7 +2,7 @@ import assert from 'node:assert';
2
2
  import { Logger } from '@nestjs/common';
3
3
  import crypto from 'crypto';
4
4
  import { STORAGE_MODULE_ID, STORAGE_OPTIONS } from './constants.js';
5
- import { getConnectionOptions } from './get-connection-options.js';
5
+ import { getStorageConfig } from './get-storage-config.js';
6
6
  import { S3StorageConnection } from './providers/s3-storage-connection.js';
7
7
  import { StorageConnection } from './services/storage-connection.js';
8
8
  const CLIENT_TOKEN = Symbol('CLIENT_TOKEN');
@@ -11,7 +11,7 @@ export class StorageCoreModule {
11
11
  * Configures and returns a dynamic module
12
12
  */
13
13
  static forRoot(moduleOptions) {
14
- const connectionOptions = getConnectionOptions(moduleOptions.useValue || {}, moduleOptions.envPrefix);
14
+ const connectionOptions = getStorageConfig(moduleOptions.useValue || {}, moduleOptions.envPrefix);
15
15
  return this._createDynamicModule(moduleOptions, {
16
16
  global: moduleOptions.global,
17
17
  providers: [
@@ -35,7 +35,7 @@ export class StorageCoreModule {
35
35
  inject: asyncOptions.inject,
36
36
  useFactory: async (...args) => {
37
37
  const opts = await asyncOptions.useFactory(...args);
38
- return getConnectionOptions(opts, asyncOptions.envPrefix);
38
+ return getStorageConfig(opts, asyncOptions.envPrefix);
39
39
  },
40
40
  },
41
41
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xnestjs/storage",
3
- "version": "1.5.3",
3
+ "version": "1.6.0",
4
4
  "description": "NestJS extension library for Storage solutions (S3,GS)",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -0,0 +1,2 @@
1
+ import type { StorageOptions } from './types.js';
2
+ export declare function getStorageConfig(moduleOptions: Partial<StorageOptions>, prefix?: string): StorageOptions;
package/types/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './constants.js';
2
- export * from './get-connection-options.js';
2
+ export * from './get-storage-config.js';
3
3
  export * from './services/storage-bucket.js';
4
4
  export * from './services/storage-connection.js';
5
5
  export * from './storage.module.js';
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './constants.js';
2
- export * from './get-connection-options.js';
2
+ export * from './get-storage-config.js';
3
3
  export * from './services/storage-bucket.js';
4
4
  export * from './services/storage-connection.js';
5
5
  export * from './storage.module.js';
@@ -1,2 +0,0 @@
1
- import type { StorageOptions } from './types.js';
2
- export declare function getConnectionOptions(moduleOptions: Partial<StorageOptions>, prefix?: string): StorageOptions;