Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@gojob/nest-cloud-datastore
Advanced tools
Readme
Cloud Datastore module for Nestjs
yarn add @gojob/nest-cloud-datastore
# or
npm install @gojob/nest-cloud-datastore
If you use the default configuration of GCP client libraries, just import the module CloudDatastoreModule
as-is.
Otherwise, the configuration passed to the constructor of Datastore can be customized in two ways:
forRoot
:import { CloudDatastoreModule, DatastoreModuleAsyncOptions } from '@gojob/nest-cloud-datastore';
const datastoreModule = CloudDatastoreModule.forRoot({ keyFile: configService.get('GCP_KEY_FILE_DATASTORE') });
export default datastoreModule;
forRootAsync
, for configuration object built dynamically:import { CloudDatastoreModule, DatastoreModuleAsyncOptions } from '@gojob/nest-cloud-datastore';
import { ConfigModule } from '../config/config.module';
import { ConfigService } from '../config/config.service';
const moduleConfig: DatastoreModuleAsyncOptions = {
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({ keyFile: configService.get('GCP_KEY_FILE_DATASTORE') }),
};
const datastoreModule = CloudDatastoreModule.forRootAsync(moduleConfig);
export default datastoreModule;
Once the module imported, CloudDatastoreService
is made available in the injection scope.
Have a look at src/cloud-datastore.integration-test.ts
to see the methods available.
Thanks to the Docker image google/cloud-sdk
including an emulator, testing the integration of your features with Cloud Datastore is pretty straightforward. Download docker-compose.yml
from this git repository, then:
docker-compose up -d # run the emulator
curl localhost:8081 # ensure the emulator is available
# run your tests, with the following environment variables:
# DATASTORE_EMULATOR_HOST=localhost:8081
# DATASTORE_PROJECT_ID=datastore-testing
A helper class DatastoreEmulator
is provided in this package, in order to easily:
reset
)removeDatastoreKeyProp
)createEntity
, createEntities
)getAll
)Examples of tests are available src/cloud-datastore.integration-test.ts
.
yarn install
yarn build
docker-compose up -d # start the Cloud Datastore emulator
yarn integration
docker-compose down
FAQs
Cloud Datastore module for Nestjs
The npm package @gojob/nest-cloud-datastore receives a total of 4 weekly downloads. As such, @gojob/nest-cloud-datastore popularity was classified as not popular.
We found that @gojob/nest-cloud-datastore demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.