{"_id":"@alien-worlds/alienworlds-api-common","_rev":"2-9aa7d1099a79dbdd5d5ccacaea570023","name":"@alien-worlds/alienworlds-api-common","dist-tags":{"latest":"0.0.82"},"versions":{"0.0.82":{"name":"@alien-worlds/alienworlds-api-common","version":"0.0.82","author":{"name":"rkamysz","email":"radoslaw.kamysz@gmail.com"},"license":"ISC","_id":"@alien-worlds/alienworlds-api-common@0.0.82","maintainers":[{"name":"rkamysz","email":"radoslaw.kamysz@gmail.com"},{"name":"lbobka","email":"volodymyr@dacoco.io"},{"name":"dallas.johnson","email":"dallasj001@gmail.com"},{"name":"atirmazi","email":"ahmadtirmazi@gmail.com"}],"homepage":"https://github.com/Alien-Worlds/alienworlds-api-common#readme","bugs":{"url":"https://github.com/Alien-Worlds/alienworlds-api-common/issues"},"dist":{"shasum":"8d63afab1f79c4b88156c0cb2708686ec47a22ca","tarball":"https://registry.npmjs.org/@alien-worlds/alienworlds-api-common/-/alienworlds-api-common-0.0.82.tgz","fileCount":2,"integrity":"sha512-EIuzYU9yudxpKOTyDF2w7tUO0d7ghkAof3NEP1Atua/KJkwbdrS//Hhjbnp0ova0qvdbZ9fSSrXWyQ9ePJ/3kQ==","signatures":[{"sig":"MEYCIQDydzYzQs9cyt5c4lXe3v9oI2yk9eVLbp3A/6gmYzRyTwIhAO2wfSlvuDFvPLQed33PuxwvfpO/bSk9LK9zP0jMRusK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9548},"main":"build/index.js","types":"build/index.d.ts","gitHead":"391072e5076e854f4e6dd8fe4bfca94abb6d6dea","scripts":{"build":"yarn clean && tsc","clean":"rm -rf ./build","test:unit":"jest --config=jest.config.unit.js","prepublish":"yarn clean && tsc --project tsconfig.build.json"},"_npmUser":{"name":"rkamysz","email":"radoslaw.kamysz@gmail.com"},"repository":{"url":"git+ssh://git@github.com/Alien-Worlds/alienworlds-api-common.git","type":"git"},"_npmVersion":"8.3.1","description":"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","directories":{},"_nodeVersion":"17.4.0","dependencies":{"eosjs":"^22.1.0","crypto":"^1.0.1","atomicassets":"^1.5.1","@alien-worlds/api-core":"^0.0.101"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.4.5","eslint":"^8.23.1","ts-jest":"^27.1.3","prettier":"^2.7.1","typescript":"^4.8.2","@types/jest":"^27.0.3","@types/node":"^18.7.14","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/alienworlds-api-common_0.0.82_1701077876706_0.7836245582329027","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-11-27T09:37:56.627Z","modified":"2026-04-20T11:37:40.419Z","0.0.82":"2023-11-27T09:37:56.886Z"},"bugs":{"url":"https://github.com/Alien-Worlds/alienworlds-api-common/issues"},"author":{"name":"rkamysz","email":"radoslaw.kamysz@gmail.com"},"license":"ISC","homepage":"https://github.com/Alien-Worlds/alienworlds-api-common#readme","repository":{"url":"git+ssh://git@github.com/Alien-Worlds/alienworlds-api-common.git","type":"git"},"description":"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","maintainers":[{"email":"dallasj001@gmail.com","name":"dallas.johnson"},{"email":"volodymyr@dacoco.io","name":"lbobka"},{"email":"muhammad.g@dacoco.io","name":"salman.gurmani"}],"readme":"# alienworlds-api-common\n\nComponents 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.\n\n## Content\n\n### Assets (MongoDB collection and Smart contract table row)\n\n| Name                               | Type                            |  Layer   | Description                                                      |\n| :--------------------------------- | :------------------------------ | :------: | ---------------------------------------------------------------- |\n| `Asset`                            | **_Entity_**                    | _domain_ |                                                                  |\n| `AssetRepository`                  | **_Repository abstraction_**    | _domain_ |                                                                  |\n| `AssetMongoSource`                 | **_Data source_**               |  _data_  | mongodb data source used in the repository                       |\n| `AssetMapper`                      | **_Mapper_**                    |  _data_  | converts `dto` to `entity` and vice versa                        |\n| `AssetSmartContractData`           | **_Entity_**                    | _domain_ |                                                                  |\n| `AssetSmartContractRepository`     | **_Repository abstraction_**    | _domain_ |                                                                  |\n| `AssetSmartContractRepositoryImpl` | **_Repository implementation_** |  _data_  |                                                                  |\n| `bindAssetRepository`              | **_IOC config_**                |          | bind helper - requires `MongoSource` instance                    |\n| `bindAssetSmartContractRepository` | **_IOC config_**                |          | bind helper - requires `EosRpcSource` instance and `code` string |\n\n### AtomicTransfers (MongoDB collection)\n\n| Name                           | Type                         |  Layer   | Description                                   |\n| :----------------------------- | :--------------------------- | :------: | --------------------------------------------- |\n| `AtomicTransfer`               | **_Entity_**                 | _domain_ |                                               |\n| `AtomicTransferRepository`     | **_Repository abstraction_** | _domain_ |                                               |\n| `AtomicTransferMongoSource`    | **_Data source_**            |  _data_  | mongodb data source used in the repository    |\n| `AtomicTransferMapper`         | **_Mapper_**                 |  _data_  | converts `dto` to `entity` and vice versa     |\n| `bindAtomicTransferRepository` | **_IOC config_**             |          | bind helper - requires `MongoSource` instance |\n\n### Mines (MongoDB collection)\n\n| Name                 | Type                         |  Layer   | Description                                   |\n| :------------------- | :--------------------------- | :------: | --------------------------------------------- |\n| `Mine`               | **_Entity_**                 | _domain_ |                                               |\n| `MineRepository`     | **_Repository abstraction_** | _domain_ |                                               |\n| `MineMongoSource`    | **_Data source_**            |  _data_  | mongodb data source used in the repository    |\n| `MineMapper`         | **_Mapper_**                 |  _data_  | converts `dto` to `entity` and vice versa     |\n| `bindMineRepository` | **_IOC config_**             |          | bind helper - requires `MongoSource` instance |\n\n### NFTs (MongoDB collection)\n\n| Name                | Type                         |  Layer   | Description                                   |\n| :------------------ | :--------------------------- | :------: | --------------------------------------------- |\n| `Nft`               | **_Entity_**                 | _domain_ |                                               |\n| `NftRepository`     | **_Repository abstraction_** | _domain_ |                                               |\n| `NftMongoSource`    | **_Data source_**            |  _data_  | mongodb data source used in the repository    |\n| `NftMapper`         | **_Mapper_**                 |  _data_  | converts `dto` to `entity` and vice versa     |\n| `bindNftRepository` | **_IOC config_**             |          | bind helper - requires `MongoSource` instance |\n\n### Schemas (Smart contract table row)\n\n| Name                                | Type                            |  Layer   | Description                                                      |\n| :---------------------------------- | :------------------------------ | :------: | ---------------------------------------------------------------- |\n| `SchemaSmartContractData`           | **_Entity_**                    | _domain_ |                                                                  |\n| `SchemaSmartContractRepository`     | **_Repository abstraction_**    | _domain_ |                                                                  |\n| `SchemaSmartContractRepositoryImpl` | **_Repository implementation_** |  _data_  |                                                                  |\n| `bindSchemaSmartContractRepository` | **_IOC config_**                |          | bind helper - requires `EosRpcSource` instance and `code` string |\n\n### Templates (Smart contract table row)\n\n| Name                                  | Type                            |  Layer   | Description                                                      |\n| :------------------------------------ | :------------------------------ | :------: | ---------------------------------------------------------------- |\n| `TemplateSmartContractData`           | **_Entity_**                    | _domain_ |                                                                  |\n| `TemplateSmartContractRepository`     | **_Repository abstraction_**    | _domain_ |                                                                  |\n| `TemplateSmartContractRepositoryImpl` | **_Repository implementation_** |  _data_  |                                                                  |\n| `bindTemplateSmartContractRepository` | **_IOC config_**                |          | bind helper - requires `EosRpcSource` instance and `code` string |\n\n## Usage\n\nTo use these components in your code, add this package as a dependency using your Node package manager\n\n```\nyarn add @alien-worlds/alienworlds-api-common\n```\n\nYou 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_\n\n```ts\n// with binding functions\nimport { bindStateRepository } from '@alien-worlds/alienworlds-api-common';\n\n// ...\n\nawait client.connect();\nconst db = client.db(dbName);\nconst mongoSource = new MongoSource(db);\n\nbindStateRepository(container, mongoSource);\n```\n\n```ts\n// or without\nimport {\n  StateRepositoryImpl,\n  StateRepository,\n  StateMongoSource,\n  StateMapper,\n} from '@alien-worlds/alienworlds-api-common';\n\n// ...\n\nawait client.connect();\nconst db = client.db(dbName);\nconst mongoSource = new MongoSource(db);\nconst stateRepositoryImpl = new StateRepositoryImpl(\n  new StateMongoSource(mongoSource),\n  new StateMapper()\n);\ncontainer\n  .bind<StateRepository>(StateRepository.Token)\n  .toConstantValue(stateRepositoryImpl);\n```\n\n## Deployment\n\nIf you want to release a new version of this package, just run `deploy.sh` from the main project folder.\n\n```sh\n# patches version by default\nsh scripts/deploy.sh\n# Optionally, you can specify the version or what kind of update is (major|minor|patch)\n# e.g.\nsh scripts/deploy.sh 1.2.3\n# or\nsh scripts/deploy.sh major\n```\n\nThis script will:\n\n- start the typeScript compiler\n- pull latest changes from the repository\n- bump the version in the `package.json` file\n- create a commit and push it to the repository\n- publish the new version to the registry (if all the previous steps have been completed successfully)\n\n**_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_**\n","readmeFilename":"README.md"}