[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/addon-tools](https://jsprismarine.dev/api/@jsprismarine/addon-tools/index.md) / addonIndex

# addonIndex

## Interfaces

### AddonCommand

Defined in: [addonIndex.ts:101](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L101)

A command an addon's scripts register with `customCommandRegistry.registerCommand`.

#### Properties

##### cheatsRequired

> `readonly` **cheatsRequired**: `boolean`

Defined in: [addonIndex.ts:111](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L111)

Whether it needs cheats on, as the script asked.

##### description

> `readonly` **description**: `string`

Defined in: [addonIndex.ts:107](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L107)

##### name

> `readonly` **name**: `string`

Defined in: [addonIndex.ts:106](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L106)

The name with its namespace, such as `jsp:tpsbar`. It is also the permission node that
grants or takes away the command in a server's `permissions.json`.

##### parameters

> `readonly` **parameters**: readonly [`AddonCommandParameter`](#addoncommandparameter)[]

Defined in: [addonIndex.ts:113](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L113)

The mandatory parameters, then the optional ones.

##### permissionLevel

> `readonly` **permissionLevel**: `number`

Defined in: [addonIndex.ts:109](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L109)

The `CommandPermissionLevel` it needs, an index into [COMMAND\_PERMISSION\_LEVELS](#command-permission-levels).

***

### AddonCommandParameter

Defined in: [addonIndex.ts:117](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L117)

One parameter of an [AddonCommand](#addoncommand).

#### Properties

##### name

> `readonly` **name**: `string`

Defined in: [addonIndex.ts:118](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L118)

##### optional

> `readonly` **optional**: `boolean`

Defined in: [addonIndex.ts:121](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L121)

##### type

> `readonly` **type**: `string`

Defined in: [addonIndex.ts:120](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L120)

The `CustomCommandParamType` member, such as `String` or `Enum`.

##### values?

> `readonly` `optional` **values?**: readonly `string`[]

Defined in: [addonIndex.ts:123](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L123)

The values an `Enum` parameter takes, when its enum was registered.

***

### AddonIndex

Defined in: [addonIndex.ts:127](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L127)

A parsed addon index.

#### Properties

##### addons

> `readonly` **addons**: readonly [`AddonIndexEntry`](#addonindexentry)[]

Defined in: [addonIndex.ts:130](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L130)

Every published version, sorted by name and then by version, oldest first.

##### schemaVersion

> `readonly` **schemaVersion**: `1`

Defined in: [addonIndex.ts:128](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L128)

***

### AddonIndexEntry

Defined in: [addonIndex.ts:28](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L28)

One published version of one addon.

#### Properties

##### description

> `readonly` **description**: `string`

Defined in: [addonIndex.ts:34](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L34)

A one-line description of what the addon does.

##### listing?

> `readonly` `optional` **listing?**: [`AddonListing`](#addonlisting)

Defined in: [addonIndex.ts:45](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L45)

What the marketplace shows for this version. Versions built before listings existed have
none, and a reader that predates listings drops the key.

##### minServer

> `readonly` **minServer**: `string`

Defined in: [addonIndex.ts:36](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L36)

The oldest JSPrismarine version the addon runs on, `major.minor.patch`.

##### name

> `readonly` **name**: `string`

Defined in: [addonIndex.ts:30](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L30)

The addon's name: its folder in the source repository and its name in `addon install`.

##### sha256

> `readonly` **sha256**: `string`

Defined in: [addonIndex.ts:40](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L40)

The pack's SHA-256, in lowercase hexadecimal.

##### url

> `readonly` **url**: `string`

Defined in: [addonIndex.ts:38](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L38)

Where the `.mcpack` downloads from, an `https:` URL.

##### version

> `readonly` **version**: `string`

Defined in: [addonIndex.ts:32](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L32)

The pack's version, `major.minor.patch`, from its manifest header.

***

### AddonListing

Defined in: [addonIndex.ts:67](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L67)

The page content for one published version of an addon, read from its `addon.json`, README and
icon when it was built. The files sit beside the pack on the release and are fixed with it.

#### Properties

##### authors

> `readonly` **authors**: readonly `string`[]

Defined in: [addonIndex.ts:75](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L75)

Who wrote the addon, as its author lists them.

##### commands?

> `readonly` `optional` **commands?**: readonly [`AddonCommand`](#addoncommand)[]

Defined in: [addonIndex.ts:90](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L90)

The commands the addon's scripts register, in the order they register them. A version built
before listings recorded commands, or whose scripts could not be run to read them, has none.

##### deprecated?

> `readonly` `optional` **deprecated?**: `string`

Defined in: [addonIndex.ts:77](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L77)

Why the addon should no longer be installed, when its author has deprecated it.

##### icon?

> `readonly` `optional` **icon?**: [`AddonListingFile`](#addonlistingfile)

Defined in: [addonIndex.ts:83](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L83)

The pack's `pack_icon.png`, when it has one.

##### license

> `readonly` **license**: `string`

Defined in: [addonIndex.ts:71](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L71)

The addon's license, as an SPDX expression.

##### readme

> `readonly` **readme**: [`AddonListingFile`](#addonlistingfile)

Defined in: [addonIndex.ts:81](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L81)

The addon's `README.md`.

##### replacedBy?

> `readonly` `optional` **replacedBy?**: `string`

Defined in: [addonIndex.ts:79](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L79)

The install id of the addon that replaces this one, such as `warps-plus` or `owner/repo/name`.

##### screenshots

> `readonly` **screenshots**: readonly [`AddonListingScreenshot`](#addonlistingscreenshot)[]

Defined in: [addonIndex.ts:85](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L85)

The screenshots, in the order `addon.json` lists them.

##### tags

> `readonly` **tags**: readonly `string`[]

Defined in: [addonIndex.ts:73](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L73)

Tags the marketplace filters by.

##### title

> `readonly` **title**: `string`

Defined in: [addonIndex.ts:69](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L69)

The addon's name for people, such as `TPS Bar`.

***

### AddonListingFile

Defined in: [addonIndex.ts:49](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L49)

A file a listing names: where it downloads from and its SHA-256.

#### Extended by

- [`AddonListingScreenshot`](#addonlistingscreenshot)

#### Properties

##### sha256

> `readonly` **sha256**: `string`

Defined in: [addonIndex.ts:53](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L53)

The file's SHA-256, in lowercase hexadecimal.

##### url

> `readonly` **url**: `string`

Defined in: [addonIndex.ts:51](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L51)

An `https:` URL.

***

### AddonListingScreenshot

Defined in: [addonIndex.ts:57](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L57)

A screenshot a listing shows, with the text that describes it.

#### Extends

- [`AddonListingFile`](#addonlistingfile)

#### Properties

##### alt

> `readonly` **alt**: `string`

Defined in: [addonIndex.ts:58](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L58)

##### file?

> `readonly` `optional` **file?**: `string`

Defined in: [addonIndex.ts:60](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L60)

Its path in the addon's folder, such as `media/bar.png`, which the README's images name.

##### sha256

> `readonly` **sha256**: `string`

Defined in: [addonIndex.ts:53](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L53)

The file's SHA-256, in lowercase hexadecimal.

###### Inherited from

[`AddonListingFile`](#addonlistingfile).[`sha256`](#sha256-1)

##### url

> `readonly` **url**: `string`

Defined in: [addonIndex.ts:51](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L51)

An `https:` URL.

###### Inherited from

[`AddonListingFile`](#addonlistingfile).[`url`](#url-1)

***

### MergedAddonIndex

Defined in: [addonIndex.ts:396](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L396)

An index with a build's entries merged in, and which of those it did not list before.

#### Properties

##### added

> `readonly` **added**: readonly [`AddonIndexEntry`](#addonindexentry)[]

Defined in: [addonIndex.ts:399](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L399)

The built entries the earlier index did not have, in index order.

##### index

> `readonly` **index**: [`AddonIndex`](#addonindex)

Defined in: [addonIndex.ts:397](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L397)

## Variables

### ADDON\_INDEX\_BACKUP\_FILE

> `const` **ADDON\_INDEX\_BACKUP\_FILE**: `"index.previous.json"` = `'index.previous.json'`

Defined in: [addonIndex.ts:25](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L25)

The name the release workflow gives the old index while it uploads a new one. GitHub deletes
an asset before replacing it, so the old index is renamed first; when the upload fails, this
file still holds every published version, and the next build merges with it.

***

### ADDON\_INDEX\_FILE

> `const` **ADDON\_INDEX\_FILE**: `"index.json"` = `'index.json'`

Defined in: [addonIndex.ts:18](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L18)

The file name of the index on the release.

***

### ADDON\_INDEX\_SCHEMA\_VERSION

> `const` **ADDON\_INDEX\_SCHEMA\_VERSION**: `1` = `1`

Defined in: [addonIndex.ts:12](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L12)

The schema version this module writes and reads.

***

### ADDON\_RELEASE\_TAG

> `const` **ADDON\_RELEASE\_TAG**: `"addons"` = `'addons'`

Defined in: [addonIndex.ts:15](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L15)

The release tag a source publishes its packs and index on.

***

### COMMAND\_PERMISSION\_LEVELS

> `const` **COMMAND\_PERMISSION\_LEVELS**: readonly \[`"Any"`, `"GameDirectors"`, `"Admin"`, `"Host"`, `"Owner"`\]

Defined in: [addonIndex.ts:98](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L98)

The names of `CommandPermissionLevel` in `@minecraft/server`, in the order of their values, from
`Any` at 0 to `Owner`. A command's level is stored as the number, which the server compares
with a player's level.

## Functions

### addonVersionsInRange()

> **addonVersionsInRange**(`index`, `name`, `range`): [`AddonIndexEntry`](#addonindexentry)[]

Defined in: [addonIndex.ts:219](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L219)

The versions of one addon an index lists that fall in a range, newest first: the order an
installer tries them in.

#### Parameters

##### index

[`AddonIndex`](#addonindex)

##### name

`string`

##### range

`string`

#### Returns

[`AddonIndexEntry`](#addonindexentry)[]

***

### compareAddonVersions()

> **compareAddonVersions**(`a`, `b`): `number`

Defined in: [addonIndex.ts:169](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L169)

Compares two `major.minor.patch` versions.

#### Parameters

##### a

`string`

##### b

`string`

#### Returns

`number`

Negative when `a` is older than `b`, zero when they are equal.

***

### createAddonIndex()

> **createAddonIndex**(`entries`): [`AddonIndex`](#addonindex)

Defined in: [addonIndex.ts:362](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L362)

Builds an index from entries, sorted the way an index keeps them.

#### Parameters

##### entries

`Iterable`\<[`AddonIndexEntry`](#addonindexentry)\>

#### Returns

[`AddonIndex`](#addonindex)

#### Throws

When two entries share a name and a version.

***

### isAddonInstallId()

> **isAddonInstallId**(`id`): `boolean`

Defined in: [addonIndex.ts:149](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L149)

Whether a string is an addon's install id, the name `addon install` takes without a range: an
addon name such as `tps-bar` for JSPrismarine's own addons, or `<owner>/<repo>/<name>`.

#### Parameters

##### id

`string`

#### Returns

`boolean`

***

### isAddonName()

> **isAddonName**(`name`): `boolean`

Defined in: [addonIndex.ts:140](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L140)

Whether a name is an addon name: lowercase letters and digits, with single hyphens between.

#### Parameters

##### name

`string`

#### Returns

`boolean`

***

### isAddonRange()

> **isAddonRange**(`range`): `boolean`

Defined in: [addonIndex.ts:185](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L185)

Whether a string is a version range [satisfiesAddonRange](#satisfiesaddonrange) reads.

#### Parameters

##### range

`string`

#### Returns

`boolean`

***

### isAddonRepository()

> **isAddonRepository**(`repository`): `boolean`

Defined in: [addonIndex.ts:143](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L143)

Whether a string names a GitHub repository, `<owner>/<repo>`.

#### Parameters

##### repository

`string`

#### Returns

`boolean`

***

### isAddonVersion()

> **isAddonVersion**(`version`): `boolean`

Defined in: [addonIndex.ts:159](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L159)

Whether a version is `major.minor.patch` with no leading zeros, the form an index uses. Each part
must be a safe integer, since versions compare as numbers and two larger parts could read as one.

#### Parameters

##### version

`string`

#### Returns

`boolean`

***

### mergeAddonIndex()

> **mergeAddonIndex**(`published`, `built`): [`MergedAddonIndex`](#mergedaddonindex)

Defined in: [addonIndex.ts:417](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L417)

Merges a build's entries into the index already published. Every published version stays, so a
lockfile's URL keeps downloading the pack it hashed; a built version that is already listed must
match its hash, and its listing files must match theirs. A version published before listings
existed keeps its entry without one.

#### Parameters

##### published

[`AddonIndex`](#addonindex) \| `undefined`

The index on the release, or undefined before the first release.

##### built

readonly [`AddonIndexEntry`](#addonindexentry)[]

One entry for each addon the build packed.

#### Returns

[`MergedAddonIndex`](#mergedaddonindex)

#### Throws

`PublishedVersionChanged` when a built pack's version is published
with another hash, and `PublishedListingChanged` when its listing files are published with others.

***

### packFileName()

> **packFileName**(`name`, `version`): `string`

Defined in: [addonIndex.ts:163](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L163)

The file name of an addon's pack on the release: `<name>-<version>.mcpack`.

#### Parameters

##### name

`string`

##### version

`string`

#### Returns

`string`

***

### parseAddonCommands()

> **parseAddonCommands**(`value`): [`AddonCommand`](#addoncommand)[] \| `undefined`

Defined in: [addonIndex.ts:258](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L258)

Reads a listing's `commands`. Keys beyond the schema are dropped, as they are elsewhere in the
index.

#### Parameters

##### value

`unknown`

#### Returns

[`AddonCommand`](#addoncommand)[] \| `undefined`

The commands, or undefined when the value is not a list of them.

***

### parseAddonIndex()

> **parseAddonIndex**(`value`): [`AddonIndex`](#addonindex)

Defined in: [addonIndex.ts:380](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L380)

Validates a decoded `index.json` against the schema. Keys an entry has beyond the schema's are
dropped, so an index that gains fields under the same schema version still reads.

#### Parameters

##### value

`unknown`

The index, as `JSON.parse` returned it.

#### Returns

[`AddonIndex`](#addonindex)

#### Throws

When the index does not follow the schema, has a schema version
other than [ADDON\_INDEX\_SCHEMA\_VERSION](#addon-index-schema-version), or lists one version of an addon twice.

***

### satisfiesAddonRange()

> **satisfiesAddonRange**(`version`, `range`): `boolean`

Defined in: [addonIndex.ts:199](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L199)

Whether a version falls in a range, as npm reads the same range:

- `1.2.3` matches that version only.
- `~1.2.3` matches `1.2.3` and later patches of `1.2`.
- `^1.2.3` matches `1.2.3` and anything later with the same major version. Below `1.0.0` the
  first non-zero part is the one that stays: `^0.2.3` stops before `0.3.0`, and `^0.0.3`
  matches `0.0.3` only.
- `*` matches every version.

#### Parameters

##### version

`string`

##### range

`string`

#### Returns

`boolean`

False for a version or a range neither form takes.

***

### serializeAddonIndex()

> **serializeAddonIndex**(`index`): `string`

Defined in: [addonIndex.ts:393](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/addon-tools/src/addonIndex.ts#L393)

An index as the text of `index.json`: four-space indented, ending in a newline.

#### Parameters

##### index

[`AddonIndex`](#addonindex)

#### Returns

`string`
