Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alien-worlds/alienworlds-api-common

Package Overview
Dependencies
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alien-worlds/alienworlds-api-common

Components used in both the Alien Worlds API and history tools. Package contains repositories, services and entities for various mongodb collections and smart contract tables rows. The binding functions are used to simplify the injection of these componen

  • 0.0.82
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
4
Weekly downloads
 
Created
Source

alienworlds-api-common

Components used in both the Alien Worlds API and history tools. Package contains repositories, services and entities for various mongodb collections and smart contract tables rows. The binding functions are used to simplify the injection of these components in your code.

Content

Assets (MongoDB collection and Smart contract table row)

NameTypeLayerDescription
AssetEntitydomain
AssetRepositoryRepository abstractiondomain
AssetMongoSourceData sourcedatamongodb data source used in the repository
AssetMapperMapperdataconverts dto to entity and vice versa
AssetSmartContractDataEntitydomain
AssetSmartContractRepositoryRepository abstractiondomain
AssetSmartContractRepositoryImplRepository implementationdata
bindAssetRepositoryIOC configbind helper - requires MongoSource instance
bindAssetSmartContractRepositoryIOC configbind helper - requires EosRpcSource instance and code string

AtomicTransfers (MongoDB collection)

NameTypeLayerDescription
AtomicTransferEntitydomain
AtomicTransferRepositoryRepository abstractiondomain
AtomicTransferMongoSourceData sourcedatamongodb data source used in the repository
AtomicTransferMapperMapperdataconverts dto to entity and vice versa
bindAtomicTransferRepositoryIOC configbind helper - requires MongoSource instance

Mines (MongoDB collection)

NameTypeLayerDescription
MineEntitydomain
MineRepositoryRepository abstractiondomain
MineMongoSourceData sourcedatamongodb data source used in the repository
MineMapperMapperdataconverts dto to entity and vice versa
bindMineRepositoryIOC configbind helper - requires MongoSource instance

NFTs (MongoDB collection)

NameTypeLayerDescription
NftEntitydomain
NftRepositoryRepository abstractiondomain
NftMongoSourceData sourcedatamongodb data source used in the repository
NftMapperMapperdataconverts dto to entity and vice versa
bindNftRepositoryIOC configbind helper - requires MongoSource instance

Schemas (Smart contract table row)

NameTypeLayerDescription
SchemaSmartContractDataEntitydomain
SchemaSmartContractRepositoryRepository abstractiondomain
SchemaSmartContractRepositoryImplRepository implementationdata
bindSchemaSmartContractRepositoryIOC configbind helper - requires EosRpcSource instance and code string

Templates (Smart contract table row)

NameTypeLayerDescription
TemplateSmartContractDataEntitydomain
TemplateSmartContractRepositoryRepository abstractiondomain
TemplateSmartContractRepositoryImplRepository implementationdata
bindTemplateSmartContractRepositoryIOC configbind helper - requires EosRpcSource instance and code string

Usage

To use these components in your code, add this package as a dependency using your Node package manager

yarn add @alien-worlds/alienworlds-api-common

You can inject the code with the binding functions or by yourself. In the ioc.config file in your project, add the component of interest to you, remembering to initialize all the source needs in advance, e.g. MongoDB or JsonRpc Api

// with binding functions
import { bindStateRepository } from '@alien-worlds/alienworlds-api-common';

// ...

await client.connect();
const db = client.db(dbName);
const mongoSource = new MongoSource(db);

bindStateRepository(container, mongoSource);
// or without
import {
  StateRepositoryImpl,
  StateRepository,
  StateMongoSource,
  StateMapper,
} from '@alien-worlds/alienworlds-api-common';

// ...

await client.connect();
const db = client.db(dbName);
const mongoSource = new MongoSource(db);
const stateRepositoryImpl = new StateRepositoryImpl(
  new StateMongoSource(mongoSource),
  new StateMapper()
);
container
  .bind<StateRepository>(StateRepository.Token)
  .toConstantValue(stateRepositoryImpl);

Deployment

If you want to release a new version of this package, just run deploy.sh from the main project folder.

# patches version by default
sh scripts/deploy.sh
# Optionally, you can specify the version or what kind of update is (major|minor|patch)
# e.g.
sh scripts/deploy.sh 1.2.3
# or
sh scripts/deploy.sh major

This script will:

  • start the typeScript compiler
  • pull latest changes from the repository
  • bump the version in the package.json file
  • create a commit and push it to the repository
  • publish the new version to the registry (if all the previous steps have been completed successfully)

Before running the script, be sure that you have a clean situation and the latest changes from the repository so that there are no conflicts

FAQs

Package last updated on 27 Nov 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc