# @meemproject/metadata

> Meem metadata types and validator.

Latest version **0.19.7** (published 2023-02-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @meemproject/metadata
pnpm add @meemproject/metadata
yarn add @meemproject/metadata
bun add @meemproject/metadata
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.19.7 |
| Published | 2023-02-13 |
| First published | 2022-07-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 57.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Meem Project |
| Maintainers | meemwtf, bminch, jgads, kengoldfarb |

## Links

- npm: https://www.npmjs.com/package/@meemproject/metadata
- Homepage: https://meem.wtf
- npm.io page: https://npm.io/package/@meemproject/metadata

## Dependencies (3)

- [jsonschema](https://npm.io/package/jsonschema.md) ^1.4.1
- [@kengoldfarb/log](https://npm.io/package/@kengoldfarb/log.md) ^1.0.5
- [json-schema-to-typescript](https://npm.io/package/json-schema-to-typescript.md) ^11.0.2

## Recent versions

- 0.19.7 (latest) — 2023-02-13
- 0.20.9 (beta) — 2023-05-17
- 0.19.11-pre-9b42525.0 (canary) — 2023-03-23
- 0.20.8 — 2023-05-04
- 0.20.7 — 2023-05-03
- 0.20.6 — 2023-04-26
- 0.20.5 — 2023-04-14
- 0.20.4 — 2023-04-04
- 0.20.3 — 2023-04-03
- 0.20.2 — 2023-04-03
- 0.20.1 — 2023-03-28
- 0.20.0 — 2023-03-23
- 0.19.11-pre-6dead5e.0 — 2023-03-23
- 0.19.11-pre-4a8e708.0 — 2023-03-23
- 0.19.10 — 2023-03-08
- … 124 more at https://npm.io/package/@meemproject/metadata/versions

## README

# Meem Metadata

Metadata types and validator.

## Types
This package contains types for all supported Meem metadata schemas. Import the metadata type as shown below to ensure metadata will pass validation when parsed by the Meem API.

See the `types` folder for currently supported metadata types.

    import { MeemAgreement_Contract_20221116 } from '@meemproject/metadata'

    const metadata: MeemAgreement_Contract_20221116 = {
        meem_metadata_version: "MeemAgreement_Contract_20221116",
        meem_metadata_type: "MeemAgreement",
        name: "Strongly typed Agreement!",
        description: "Now with tokens!",
        external_url: "",
        image: ""
    }

## Parser
The parser can take a metadata object or JSON string and parse/validate it against supported metadata versions.

    const parser = new Parser()

    try {
        const parsedMetadata = parser.parse(
            metadata as unknown as MeemMetadataLike
        )
        const { name, type, calVer, metadata } = parsedMetadata
        console.log(name, type, calVer, metadata)
    } catch (e) {
        console.log(e)
    }

## Validator
Here's an example of how to validate metadata for a MeemAgreement contract

    const metadata = {
        meem_metadata_version: "20221116",
        meem_metadata_type: "MeemAgreement_Contract",
        name: "Strongly typed Agreement!",
        description: "Now with tokens!",
        external_url: "",
        image: ""
    }

    const validator = new Validator(metadata)
    const result = validator.validate(metadata)
    const isValid = result.valid

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