npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@alien-worlds/alienworlds-api-common

v0.0.82

Published

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

Downloads

1

Readme

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)

| Name | Type | Layer | Description | | :--------------------------------- | :------------------------------ | :------: | ---------------------------------------------------------------- | | Asset | Entity | domain | | | AssetRepository | Repository abstraction | domain | | | AssetMongoSource | Data source | data | mongodb data source used in the repository | | AssetMapper | Mapper | data | converts dto to entity and vice versa | | AssetSmartContractData | Entity | domain | | | AssetSmartContractRepository | Repository abstraction | domain | | | AssetSmartContractRepositoryImpl | Repository implementation | data | | | bindAssetRepository | IOC config | | bind helper - requires MongoSource instance | | bindAssetSmartContractRepository | IOC config | | bind helper - requires EosRpcSource instance and code string |

AtomicTransfers (MongoDB collection)

| Name | Type | Layer | Description | | :----------------------------- | :--------------------------- | :------: | --------------------------------------------- | | AtomicTransfer | Entity | domain | | | AtomicTransferRepository | Repository abstraction | domain | | | AtomicTransferMongoSource | Data source | data | mongodb data source used in the repository | | AtomicTransferMapper | Mapper | data | converts dto to entity and vice versa | | bindAtomicTransferRepository | IOC config | | bind helper - requires MongoSource instance |

Mines (MongoDB collection)

| Name | Type | Layer | Description | | :------------------- | :--------------------------- | :------: | --------------------------------------------- | | Mine | Entity | domain | | | MineRepository | Repository abstraction | domain | | | MineMongoSource | Data source | data | mongodb data source used in the repository | | MineMapper | Mapper | data | converts dto to entity and vice versa | | bindMineRepository | IOC config | | bind helper - requires MongoSource instance |

NFTs (MongoDB collection)

| Name | Type | Layer | Description | | :------------------ | :--------------------------- | :------: | --------------------------------------------- | | Nft | Entity | domain | | | NftRepository | Repository abstraction | domain | | | NftMongoSource | Data source | data | mongodb data source used in the repository | | NftMapper | Mapper | data | converts dto to entity and vice versa | | bindNftRepository | IOC config | | bind helper - requires MongoSource instance |

Schemas (Smart contract table row)

| Name | Type | Layer | Description | | :---------------------------------- | :------------------------------ | :------: | ---------------------------------------------------------------- | | SchemaSmartContractData | Entity | domain | | | SchemaSmartContractRepository | Repository abstraction | domain | | | SchemaSmartContractRepositoryImpl | Repository implementation | data | | | bindSchemaSmartContractRepository | IOC config | | bind helper - requires EosRpcSource instance and code string |

Templates (Smart contract table row)

| Name | Type | Layer | Description | | :------------------------------------ | :------------------------------ | :------: | ---------------------------------------------------------------- | | TemplateSmartContractData | Entity | domain | | | TemplateSmartContractRepository | Repository abstraction | domain | | | TemplateSmartContractRepositoryImpl | Repository implementation | data | | | bindTemplateSmartContractRepository | IOC config | | bind 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