@uds-nexusai/aws-core 0.1.1 → 0.1.3
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/package.json +14 -1
- package/.prettierrc +0 -5
- package/eslint.config.mjs +0 -34
- package/nest-cli.json +0 -8
- package/src/helpers/create.async.options.provider.ts +0 -62
- package/src/helpers/create.client.provider.ts +0 -13
- package/src/index.ts +0 -5
- package/src/interfaces/aws.module.options.factory.ts +0 -3
- package/src/interfaces/base.module.async.options.ts +0 -11
- package/test/app.e2e-spec.ts +0 -25
- package/test/jest-e2e.json +0 -9
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -21
package/package.json
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uds-nexusai/aws-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"private": false,
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"type": "commonjs",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"require": "./dist/index.js",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
8
21
|
"scripts": {
|
|
9
22
|
"build": "nest build",
|
|
10
23
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
package/.prettierrc
DELETED
package/eslint.config.mjs
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import eslint from '@eslint/js';
|
|
3
|
-
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
4
|
-
import globals from 'globals';
|
|
5
|
-
import tseslint from 'typescript-eslint';
|
|
6
|
-
|
|
7
|
-
export default tseslint.config(
|
|
8
|
-
{
|
|
9
|
-
ignores: ['eslint.config.mjs'],
|
|
10
|
-
},
|
|
11
|
-
eslint.configs.recommended,
|
|
12
|
-
...tseslint.configs.recommendedTypeChecked,
|
|
13
|
-
eslintPluginPrettierRecommended,
|
|
14
|
-
{
|
|
15
|
-
languageOptions: {
|
|
16
|
-
globals: {
|
|
17
|
-
...globals.node,
|
|
18
|
-
...globals.jest,
|
|
19
|
-
},
|
|
20
|
-
sourceType: 'commonjs',
|
|
21
|
-
parserOptions: {
|
|
22
|
-
projectService: true,
|
|
23
|
-
tsconfigRootDir: import.meta.dirname,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
rules: {
|
|
29
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
30
|
-
'@typescript-eslint/no-floating-promises': 'warn',
|
|
31
|
-
'@typescript-eslint/no-unsafe-argument': 'warn'
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
);
|
package/nest-cli.json
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Provider } from '@nestjs/common';
|
|
2
|
-
import { BaseModuleAsyncOptions } from 'src/interfaces/base.module.async.options';
|
|
3
|
-
|
|
4
|
-
export function createAsyncOptionsProvider<TOptions>(params: {
|
|
5
|
-
optionsToken: string | symbol;
|
|
6
|
-
useFactory: (...args: any[]) => Promise<TOptions> | TOptions;
|
|
7
|
-
inject?: any[];
|
|
8
|
-
}): Provider {
|
|
9
|
-
return {
|
|
10
|
-
provide: params.optionsToken,
|
|
11
|
-
useFactory: params.useFactory,
|
|
12
|
-
inject: params.inject ?? [],
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function createAsyncOptionsProviders<
|
|
17
|
-
TOptions,
|
|
18
|
-
TFactory extends {
|
|
19
|
-
createOptions(): Promise<TOptions> | TOptions;
|
|
20
|
-
},
|
|
21
|
-
>(
|
|
22
|
-
options: BaseModuleAsyncOptions<TOptions, TFactory>,
|
|
23
|
-
optionsToken: string | symbol,
|
|
24
|
-
): Provider[] {
|
|
25
|
-
if (options.useFactory) {
|
|
26
|
-
return [
|
|
27
|
-
createAsyncOptionsProvider({
|
|
28
|
-
optionsToken,
|
|
29
|
-
useFactory: options.useFactory,
|
|
30
|
-
inject: options.inject,
|
|
31
|
-
}),
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (options.useExisting) {
|
|
36
|
-
return [
|
|
37
|
-
{
|
|
38
|
-
provide: optionsToken,
|
|
39
|
-
useFactory: async (factory: TFactory) => factory.createOptions(),
|
|
40
|
-
inject: [options.useExisting],
|
|
41
|
-
},
|
|
42
|
-
];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (options.useClass) {
|
|
46
|
-
return [
|
|
47
|
-
{
|
|
48
|
-
provide: optionsToken,
|
|
49
|
-
useFactory: async (factory: TFactory) => factory.createOptions(),
|
|
50
|
-
inject: [options.useClass],
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
provide: options.useClass,
|
|
54
|
-
useClass: options.useClass,
|
|
55
|
-
},
|
|
56
|
-
];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
throw new Error(
|
|
60
|
-
'Invalid async options. Provide useFactory, useClass, or useExisting.',
|
|
61
|
-
);
|
|
62
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Provider } from '@nestjs/common';
|
|
2
|
-
|
|
3
|
-
export function createAwsClientProvider<TOptions, TClient>(params: {
|
|
4
|
-
clientToken: string | symbol;
|
|
5
|
-
optionsToken: string | symbol;
|
|
6
|
-
createClient: (options: TOptions) => TClient;
|
|
7
|
-
}): Provider {
|
|
8
|
-
return {
|
|
9
|
-
provide: params.clientToken,
|
|
10
|
-
useFactory: (options: TOptions) => params.createClient(options),
|
|
11
|
-
inject: [params.optionsToken],
|
|
12
|
-
};
|
|
13
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ModuleMetadata, Type } from '@nestjs/common';
|
|
2
|
-
|
|
3
|
-
export interface BaseModuleAsyncOptions<TOptions, TFactory = any> extends Pick<
|
|
4
|
-
ModuleMetadata,
|
|
5
|
-
'imports'
|
|
6
|
-
> {
|
|
7
|
-
useExisting?: Type<TFactory>;
|
|
8
|
-
useClass?: Type<TFactory>;
|
|
9
|
-
useFactory?: (...args: any[]) => Promise<TOptions> | TOptions;
|
|
10
|
-
inject?: any[];
|
|
11
|
-
}
|
package/test/app.e2e-spec.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
-
import { INestApplication } from '@nestjs/common';
|
|
3
|
-
import * as request from 'supertest';
|
|
4
|
-
import { App } from 'supertest/types';
|
|
5
|
-
import { AppModule } from './../src/app.module';
|
|
6
|
-
|
|
7
|
-
describe('AppController (e2e)', () => {
|
|
8
|
-
let app: INestApplication<App>;
|
|
9
|
-
|
|
10
|
-
beforeEach(async () => {
|
|
11
|
-
const moduleFixture: TestingModule = await Test.createTestingModule({
|
|
12
|
-
imports: [AppModule],
|
|
13
|
-
}).compile();
|
|
14
|
-
|
|
15
|
-
app = moduleFixture.createNestApplication();
|
|
16
|
-
await app.init();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('/ (GET)', () => {
|
|
20
|
-
return request(app.getHttpServer())
|
|
21
|
-
.get('/')
|
|
22
|
-
.expect(200)
|
|
23
|
-
.expect('Hello World!');
|
|
24
|
-
});
|
|
25
|
-
});
|
package/test/jest-e2e.json
DELETED
package/tsconfig.build.json
DELETED
package/tsconfig.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"removeComments": true,
|
|
6
|
-
"emitDecoratorMetadata": true,
|
|
7
|
-
"experimentalDecorators": true,
|
|
8
|
-
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"target": "ES2023",
|
|
10
|
-
"sourceMap": true,
|
|
11
|
-
"outDir": "./dist",
|
|
12
|
-
"baseUrl": "./",
|
|
13
|
-
"incremental": true,
|
|
14
|
-
"skipLibCheck": true,
|
|
15
|
-
"strictNullChecks": true,
|
|
16
|
-
"forceConsistentCasingInFileNames": true,
|
|
17
|
-
"noImplicitAny": false,
|
|
18
|
-
"strictBindCallApply": false,
|
|
19
|
-
"noFallthroughCasesInSwitch": false,
|
|
20
|
-
}
|
|
21
|
-
}
|