
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
nestjs-opensearch
Advanced tools
OpenSearch module for NestJS framework
Installation
·
Usage
·
Issues
For NPM:
$ npm i --save nestjs-opensearch @opensearch-project/opensearch
For Yarn:
$ yarn add nestjs-opensearch @opensearch-project/opensearch
Module for single connection:
import { OpensearchModule } from 'nestjs-opensearch';
@Module({
imports: [
OpensearchModule.forRoot({
node: 'https://*****.es.amazonaws.com',
}),
],
providers: (...),
})
export class SearchModule { }
Module for multiple connections:
import { OpensearchModule } from 'nestjs-opensearch';
@Module({
imports: [
OpensearchModule.forRoot({
clientName: 'foo',
node: 'https://*****.es.amazonaws.com',
}),
OpensearchModule.forRoot({
clientName: 'bar',
node: 'https://*****.es.amazonaws.com',
}),
],
providers: (...),
})
export class SearchModule { }
Module for async configuration using useFactory:
import { OpensearchModule } from 'nestjs-opensearch';
@Module({
imports: [
OpensearchModule.forRootAsync({
clientName: 'baz',
// See also: https://docs.nestjs.com/techniques/configuration
imports: [ ConfigModule ],
inject: [ ConfigService ],
useFactory: (configService) => ({
node: configService.get<string>('opensearch.node'),
}),
}),
],
providers: (...),
})
export class SearchModule { }
Module for async configuration using useClass:
import type { ClientOptions } from '@opensearch-project/opensearch';
import { OpensearchModule, OpensearchClientOptionsFactory } from 'nestjs-opensearch';
@Injectable()
export class OpensearchConfigService implements OpensearchClientOptionsFactory {
public async createOpensearchClientOptions(): Promise<ClientOptions> {
const configs = await fetch(...);
return {
node: configs.node,
};
}
}
@Module({
imports: [
OpensearchModule.forRootAsync({
clientName: 'qux',
useClass: OpensearchConfigService,
}),
],
providers: (...),
})
export class SearchModule { }
import { InjectOpensearchClient, OpensearchClient } from 'nestjs-opensearch';
@Injectable()
export class SearchService {
public constructor(
// Inject the default client
private readonly searchClient: OpensearchClient,
// Also inject the default client
@InjectOpensearchClient()
private readonly alsoSearchClient: OpensearchClient,
// Inject the 'foo' named client
@InjectOpensearchClient('foo')
private readonly fooSearchClient: OpensearchClient,
) { }
}
FAQs
OpenSearch module for NestJS framework
The npm package nestjs-opensearch receives a total of 15,534 weekly downloads. As such, nestjs-opensearch popularity was classified as popular.
We found that nestjs-opensearch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.