# @xlera/convector-core-model

> Convector Model base class

Latest version **1.3.11** (published 2023-01-23) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @xlera/convector-core-model
pnpm add @xlera/convector-core-model
yarn add @xlera/convector-core-model
bun add @xlera/convector-core-model
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.11 |
| Published | 2023-01-23 |
| First published | 2023-01-20 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 43 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 143 |
| Maintainers | hermes.mau, xleralms |
| Keywords | typescript, chaincode, blockchain, hyperledger, solutions, environment, hyperledger fabric, smart contract, run, hurley, composer |

## Links

- npm: https://www.npmjs.com/package/@xlera/convector-core-model
- Repository: https://github.com/hyperledger-labs/convector.git#develop
- Homepage: https://worldsibu.tech/convector/convector-smart-contracts/
- Issues: https://github.com/hyperledger-labs/convector/issues
- npm.io page: https://npm.io/package/@xlera/convector-core-model

## Dependencies (5)

- [yup](https://npm.io/package/yup.md) ^0.26.10
- [tslib](https://npm.io/package/tslib.md) ^2.4.1
- [window-or-global](https://npm.io/package/window-or-global.md) ^1.0.1
- [@xlera/convector-core-errors](https://npm.io/package/@xlera/convector-core-errors.md) ^1.3.11
- [@xlera/convector-core-storage](https://npm.io/package/@xlera/convector-core-storage.md) ^1.3.11

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.3.11 (latest) — 2023-01-23
- 1.3.10 — 2023-01-20

## README

# Convector Model

This module contains the base model to be used as a base for any other model.

## Usage

The children classes can be used in 1 of 3 ways:

### As an model query

```ts
class MyModel extends ConvectorModel<MyModel> { ... }

const model = new MyModel(id);
model.fetch()
  .then(onModelFound)
  .catch(onModelNotFound);
```

### As a param constructor and validator

```ts
class MyModel extends ConvectorModel<MyModel> { /* ... */ }

@Controller('my-controller')
class MyController {
  @Invokable()
  public async myMethod(
    @Param(MyModel)
    myModel: MyModel
  ) {
    myModel.save();
  }
}
```

### As a container to start filling the model

```ts
class MyModel extends ConvectorModel<MyModel> { /* ... */ }

const myModel = new MyModel();
myModel.name = 'name';
myModel.info = 'info';
/* ... */
myModel.save();
```

---
_Source: https://npm.io/package/@xlera/convector-core-model · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
