@onivoro/server-aws-kinesis 24.9.0 → 24.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onivoro/server-aws-kinesis",
3
- "version": "24.9.0",
3
+ "version": "24.11.0",
4
4
  "type": "commonjs",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -9,12 +9,18 @@
9
9
  "url": "https://github.com/onivoro/monorepo.git"
10
10
  },
11
11
  "dependencies": {
12
- "@onivoro/server-aws-credential-providers": "24.9.0",
13
- "@onivoro/server-common": "24.9.0",
12
+ "@onivoro/server-aws-credential-providers": "24.11.0",
13
+ "@onivoro/server-common": "24.11.0",
14
14
  "tslib": "^2.3.0"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@aws-sdk/client-kinesis": "~3.782.0",
18
18
  "@nestjs/common": "~10.4.6"
19
- }
19
+ },
20
+ "files": [
21
+ "**/*.js",
22
+ "**/*.d.ts",
23
+ "**/*.js.map",
24
+ "README.md"
25
+ ]
20
26
  }
package/jest.config.ts DELETED
@@ -1,11 +0,0 @@
1
- /* eslint-disable */
2
- export default {
3
- displayName: 'lib-server-aws-kinesis',
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-kinesis',
11
- };
package/project.json DELETED
@@ -1,32 +0,0 @@
1
- {
2
- "name": "lib-server-aws-kinesis",
3
- "$schema": "../../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "libs/server/aws-kinesis/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-kinesis",
12
- "main": "libs/server/aws-kinesis/src/index.ts",
13
- "tsConfig": "libs/server/aws-kinesis/tsconfig.lib.json",
14
- "assets": [
15
- "libs/server/aws-kinesis/README.md",
16
- "libs/server/aws-kinesis/package.json"
17
- ],
18
- "declaration": true,
19
- "updateBuildableProjectPackageJsonDependencies": true,
20
- "rootDir": "libs/server/aws-kinesis/src"
21
- }
22
- },
23
- "publish": {
24
- "executor": "@nx/js:npm",
25
- "outputs": [],
26
- "options": {
27
- "packageRoot": "dist/libs/server/aws-kinesis"
28
- }
29
- }
30
- },
31
- "tags": []
32
- }
package/src/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './lib/classes/server-aws-kinesis-config.class';
2
-
3
- export * from './lib/services/kinesis.service';
4
-
5
- export * from './lib/server-aws-kinesis.module';
@@ -1,5 +0,0 @@
1
- export class ServerAwsKinesisConfig {
2
- AWS_KINESIS_NAME: string;
3
- AWS_PROFILE?: string;
4
- AWS_REGION: string;
5
- }
@@ -1,33 +0,0 @@
1
- import { Module } from '@nestjs/common';
2
- import { moduleFactory } from '@onivoro/server-common';
3
- import { KinesisClient } from '@aws-sdk/client-kinesis';
4
- import { KinesisService } from './services/kinesis.service';
5
- import { ServerAwsKinesisConfig } from './classes/server-aws-kinesis-config.class';
6
- import { AwsCredentials, ServerAwsCredentialProvidersModule } from '@onivoro/server-aws-credential-providers';
7
-
8
- let kinesisClient: KinesisClient | null = null;
9
-
10
- @Module({})
11
- export class ServerAwsKinesisModule {
12
- static configure(config: ServerAwsKinesisConfig) {
13
- return moduleFactory({
14
- module: ServerAwsKinesisModule,
15
- imports: [ServerAwsCredentialProvidersModule.configure(config)],
16
- providers: [
17
- {
18
- provide: KinesisClient,
19
- useFactory: (credentials: AwsCredentials) => kinesisClient
20
- ? kinesisClient
21
- : kinesisClient = new KinesisClient({
22
- region: config.AWS_REGION,
23
- logger: console,
24
- credentials
25
- }),
26
- inject: [AwsCredentials]
27
- },
28
- { provide: ServerAwsKinesisConfig, useValue: config },
29
- KinesisService
30
- ]
31
- });
32
- }
33
- }
@@ -1,25 +0,0 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { KinesisClient, PutRecordCommand, PutRecordCommandInput } from '@aws-sdk/client-kinesis';
3
- import { ServerAwsKinesisConfig } from '../classes/server-aws-kinesis-config.class';
4
-
5
- @Injectable()
6
- export class KinesisService {
7
- constructor(private kinesis: KinesisClient, private config: ServerAwsKinesisConfig) { }
8
-
9
- async publish<TData>(event: TData, PartitionKey: string) {
10
-
11
- try {
12
- const input: PutRecordCommandInput = {
13
- Data: Buffer.from(JSON.stringify(event)),
14
- PartitionKey,
15
- StreamName: this.config.AWS_KINESIS_NAME,
16
- };
17
-
18
- const command = new PutRecordCommand(input);
19
-
20
- await this.kinesis.send(command);
21
- } catch (err) {
22
- console.error(`Error sending data to Kinesis:`, event, err);
23
- }
24
- }
25
- }
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
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
- }
package/tsconfig.lib.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "rootDir": "./src",
5
- "outDir": "../../dist/libs/server/aws-kinesis",
6
- "declaration": true
7
- },
8
- "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"],
9
- "include": ["src/**/*.ts"]
10
- }
@@ -1,21 +0,0 @@
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
- }