
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@gojob/nest-cloud-datastore
Advanced tools
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 1 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.