# @drovp/types

> Drovp plugin API definitions

Latest version **5.3.0** (published 2023-11-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @drovp/types
pnpm add @drovp/types
yarn add @drovp/types
bun add @drovp/types
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.3.0 |
| Published | 2023-11-30 |
| First published | 2021-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 27.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | tomasklaen |
| Maintainers | tomasklaen |
| Keywords | drovp, typescript, types |

## Links

- npm: https://www.npmjs.com/package/@drovp/types
- Repository: https://github.com/drovp/types
- Homepage: https://github.com/drovp/types#readme
- Issues: https://github.com/drovp/types/issues
- npm.io page: https://npm.io/package/@drovp/types

## Dependencies (1)

- [@types/node](https://npm.io/package/@types/node.md) *

## 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

- 5.3.0 (latest) — 2023-11-30
- 5.2.1 — 2023-11-14
- 5.2.0 — 2023-11-14
- 5.1.0 — 2022-12-13
- 5.0.0 — 2022-12-05
- 4.11.0 — 2022-07-24
- 4.10.3 — 2022-07-12
- 4.10.2 — 2022-07-12
- 4.10.1 — 2022-06-01
- 4.10.0 — 2022-05-31
- 4.9.1 — 2022-05-31
- 4.9.0 — 2022-05-27
- 4.8.0 — 2022-05-27
- 4.7.1 — 2022-05-21
- 4.7.0 — 2022-05-21
- … 42 more at https://npm.io/package/@drovp/types/versions

## README

# @drovp/types

This package contains type definitions for Drovp plugin API (https://github.com/drovp/drovp).

## Installation

```
npm install --save-dev @drovp/types
```

## Documentation

The documentation is at [drovp.app/docs/typing](https://drovp.app/docs/typing).

## Quick example

Types are intended to be imported in:

### `main.ts` (plugin)

```ts
import {Plugin, PayloadData, makeOptionsSchema, makeAcceptsFlags} from '@drovp/types';

type Options = {
	bulkItems: boolean;
	allowFiles: boolean;
	fileTypes: string[];
};

const schema = makeOptionsSchema<Options>()([
	{name: 'bulkItems', type: 'boolean'},
	{name: 'allowFiles', type: 'boolean'},
	{
		name: 'fileTypes',
		type: 'select',
		default: [],
		options: ['jpg', 'png', 'gif'],
		isHidden: (value, options) => options.allowFiles,
	},
]);
const accepts = makeAcceptsFlags<Options>()({
	files: (item, options) => options.allowFiles && options.fileTypes.includes(item.type),
});

export type Payload = PayloadData<Options, typeof config>;

// Omit if no dependencies
export interface Dependencies {
	ffmpeg: string;
}

export default (plugin: Plugin) => {
	plugin.registerProcessor<Payload>('foo', {
		main: 'dist/processor.js',
		dependencies: ['@drovp/ffmpeg:ffmpeg'],
		accepts: accepts,
		options: schema,
		bulkItems: (items, options) => options.bulkItems,
	});
};
```

### `processor.ts`

```ts
import type {ProcessorUtils} from '@drovp/types';
import type {Payload, Dependencies} from './';

export default async (payload: Payload, utils: ProcessorUtils<Dependencies>) => {
	console.log(payload); // ItemFile(s), profile options, and extra data if any
	console.log(utils.dependencies.ffmpeg); // path to ffmpeg binary
};
```

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