@onivoro/server-aws-sns 24.12.0 → 24.14.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/jest.config.ts +11 -0
- package/package.json +4 -10
- package/project.json +33 -0
- package/src/index.ts +3 -0
- package/src/lib/classes/server-aws-sns-config.class.ts +4 -0
- package/src/lib/server-aws-sns.module.ts +32 -0
- package/tsconfig.json +16 -0
- package/tsconfig.lib.json +10 -0
- package/tsconfig.spec.json +21 -0
package/jest.config.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
export default {
|
|
3
|
+
displayName: 'lib-server-aws-sns',
|
|
4
|
+
preset: '../../../jest.preset.js',
|
|
5
|
+
testEnvironment: 'node',
|
|
6
|
+
transform: {
|
|
7
|
+
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
|
|
8
|
+
},
|
|
9
|
+
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
10
|
+
coverageDirectory: '../../../coverage/libs/server/aws-sns',
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onivoro/server-aws-sns",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.14.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -9,18 +9,12 @@
|
|
|
9
9
|
"url": "https://github.com/onivoro/monorepo.git"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@onivoro/server-aws-credential-providers": "24.
|
|
13
|
-
"@onivoro/server-common": "24.
|
|
12
|
+
"@onivoro/server-aws-credential-providers": "24.14.0",
|
|
13
|
+
"@onivoro/server-common": "24.14.0",
|
|
14
14
|
"tslib": "^2.3.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@aws-sdk/client-sns": "~3.782.0",
|
|
18
18
|
"@nestjs/common": "~10.4.6"
|
|
19
|
-
}
|
|
20
|
-
"files": [
|
|
21
|
-
"**/*.js",
|
|
22
|
-
"**/*.d.ts",
|
|
23
|
-
"**/*.js.map",
|
|
24
|
-
"README.md"
|
|
25
|
-
]
|
|
19
|
+
}
|
|
26
20
|
}
|
package/project.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lib-server-aws-sns",
|
|
3
|
+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "libs/server/aws-sns/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"targets": {
|
|
7
|
+
"build": {
|
|
8
|
+
"executor": "@nx/js:tsc",
|
|
9
|
+
"outputs": ["{options.outputPath}"],
|
|
10
|
+
"options": {
|
|
11
|
+
"outputPath": "dist/libs/server/aws-sns",
|
|
12
|
+
"main": "libs/server/aws-sns/src/index.ts",
|
|
13
|
+
"tsConfig": "libs/server/aws-sns/tsconfig.lib.json",
|
|
14
|
+
"assets": [
|
|
15
|
+
"libs/server/aws-sns/README.md",
|
|
16
|
+
"libs/server/aws-sns/package.json"
|
|
17
|
+
],
|
|
18
|
+
"declaration": true,
|
|
19
|
+
"updateBuildableProjectPackageJsonDependencies": true,
|
|
20
|
+
"rootDir": "libs/server/aws-sns/src"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"publish": {
|
|
24
|
+
"executor": "@nx/js:npm",
|
|
25
|
+
"outputs": [],
|
|
26
|
+
"dependsOn": ["build"],
|
|
27
|
+
"options": {
|
|
28
|
+
"packageRoot": "dist/libs/server/aws-sns"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"tags": []
|
|
33
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { moduleFactory } from '@onivoro/server-common';
|
|
3
|
+
import { SNSClient } from '@aws-sdk/client-sns';
|
|
4
|
+
import { ServerAwsSnsConfig } from './classes/server-aws-sns-config.class';
|
|
5
|
+
import { AwsCredentials, ServerAwsCredentialProvidersModule } from '@onivoro/server-aws-credential-providers';
|
|
6
|
+
|
|
7
|
+
let snsClient: SNSClient | null = null;
|
|
8
|
+
|
|
9
|
+
@Module({
|
|
10
|
+
})
|
|
11
|
+
export class ServerAwsSnsModule {
|
|
12
|
+
static configure(config: ServerAwsSnsConfig) {
|
|
13
|
+
return moduleFactory({
|
|
14
|
+
module: ServerAwsSnsModule,
|
|
15
|
+
imports: [ServerAwsCredentialProvidersModule.configure(config)],
|
|
16
|
+
providers: [
|
|
17
|
+
{
|
|
18
|
+
provide: SNSClient,
|
|
19
|
+
useFactory: (credentials: AwsCredentials) => snsClient
|
|
20
|
+
? snsClient
|
|
21
|
+
: snsClient = new SNSClient({
|
|
22
|
+
region: config.AWS_REGION,
|
|
23
|
+
logger: console,
|
|
24
|
+
credentials
|
|
25
|
+
}),
|
|
26
|
+
inject: [AwsCredentials]
|
|
27
|
+
},
|
|
28
|
+
{ provide: ServerAwsSnsConfig, useValue: config },
|
|
29
|
+
],
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.server.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../../dist/out-tsc"
|
|
5
|
+
},
|
|
6
|
+
"files": [],
|
|
7
|
+
"include": [],
|
|
8
|
+
"references": [
|
|
9
|
+
{
|
|
10
|
+
"path": "./tsconfig.lib.json"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"path": "./tsconfig.spec.json"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"types": [
|
|
5
|
+
"jest",
|
|
6
|
+
"node"
|
|
7
|
+
]
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"jest.config.ts",
|
|
11
|
+
"**/*.test.ts",
|
|
12
|
+
"**/*.spec.ts",
|
|
13
|
+
"**/*.test.tsx",
|
|
14
|
+
"**/*.spec.tsx",
|
|
15
|
+
"**/*.test.js",
|
|
16
|
+
"**/*.spec.js",
|
|
17
|
+
"**/*.test.jsx",
|
|
18
|
+
"**/*.spec.jsx",
|
|
19
|
+
"**/*.d.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|