# @inertiagroup/apex

> The apex packages allows you do variuos stuff with JSON data and some IOC concepts

Latest version **1.4.4** (published 2024-07-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install @inertiagroup/apex
pnpm add @inertiagroup/apex
yarn add @inertiagroup/apex
bun add @inertiagroup/apex
```

## 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.4.4 |
| Published | 2024-07-19 |
| First published | 2023-07-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 60.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Mzimkhulu Ncube |
| Maintainers | mzincube161 |
| Keywords | The Inertia Group, Pzare, Apex, NodeJS, Typescript |

## Links

- npm: https://www.npmjs.com/package/@inertiagroup/apex
- npm.io page: https://npm.io/package/@inertiagroup/apex

## Dependencies (10)

- [uuid](https://npm.io/package/uuid.md) ^9.0.1
- [axios](https://npm.io/package/axios.md) ^1.6.7
- [moment](https://npm.io/package/moment.md) ^2.29.4
- [ts-node](https://npm.io/package/ts-node.md) ^10.9.1
- [firebase](https://npm.io/package/firebase.md) ^10.5.0
- [tsyringe](https://npm.io/package/tsyringe.md) ^4.8.0
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^9.0.2
- [firebase-admin](https://npm.io/package/firebase-admin.md) ^11.11.0
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13
- [class-transformer](https://npm.io/package/class-transformer.md) ^0.5.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.4.4 (latest) — 2024-07-19
- 1.4.3 — 2024-05-19
- 1.4.2 — 2024-05-05
- 1.4.1 — 2024-04-16
- 1.4.0 — 2024-04-16
- 1.3.9 — 2024-03-24
- 1.3.8 — 2024-01-27
- 1.3.7 — 2024-01-18
- 1.3.6 — 2024-01-07
- 1.3.5 — 2024-01-07
- 1.3.4 — 2024-01-07
- 1.3.3 — 2023-11-27
- 1.3.2 — 2023-11-26
- 1.3.1 — 2023-11-26
- 1.3.0 — 2023-11-26
- … 10 more at https://npm.io/package/@inertiagroup/apex/versions

## README

The apex packages allows you do variuos stuff with JSON data and some IOC concepts

You can convert a POJO into a JSON liek this
```
@JsonObject()
class JustObject { @JsonMember() friends: JustObject2[]; }

@JsonObject()
class JustObject2 { @JsonMember() name: string; }

const object = new JustObject();
const friend2 = new JustObject2();
friend2.name = "Mike";
object.friends = [friend2];

const expected = { 
    friends: [{ 
        name: "Mike" 
    }] 
};

const json = ApexObjectMapper.write<JustObject>(object);
```

You can also take a JSON and convert to a POJO as follows:
```
@JsonObject()
class JustObject2 { @JsonMember() name: string; }

@JsonObject()
class JustObject {
    @JsonMember({
        decoder: (value: any[]) => value.map(v => ApexObjectMapper.read<JustObject2>(v, JustObject2)),
        encoder: (value: JustObject2[]) => value.map(v => ApexObjectMapper.write(v)),
    })
    friends: JustObject2[];
}

const json = { friends: [{ name: "Mike" }, { name: "John" }] };

const expected = new JustObject();
const friend2 = new JustObject2();
friend2.name = "Mike";
const friend3 = new JustObject2();
friend3.name = "John";
expected.friends = [friend2, friend3];

const object = ApexObjectMapper.read<JustObject>(json, JustObject);

expect(object).toEqual(expected);
```

```
@JsonObject()
class JustObject3 { @JsonMember() name: string; }

@JsonObject()
class JustObject2 { @JsonMember({ type: JustObject3 }) friend: JustObject3; }

@JsonObject()
class JustObject { @JsonMember({ type: JustObject2 }) friend: JustObject2; }

const json = { friend: { friend: { name: "Mike" } } };

const expected = new JustObject();
const friend2 = new JustObject2();
const friend3 = new JustObject3();
friend3.name = "Mike";
friend2.friend = friend3;
expected.friend = friend2;

const object = ApexObjectMapper.read<JustObject>(json, JustObject);

expect(object).toEqual(expected);
```

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