5.3.0 • Published 12 months ago

@drovp/types v5.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

@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.

Quick example

Types are intended to be imported in:

main.ts (plugin)

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

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
};
5.3.0

12 months ago

5.2.1

1 year ago

5.2.0

1 year ago

5.1.0

2 years ago

5.0.0

2 years ago

4.10.2

2 years ago

4.10.3

2 years ago

4.11.0

2 years ago

4.9.0

2 years ago

4.7.1

2 years ago

4.9.1

2 years ago

4.6.1

3 years ago

4.10.1

2 years ago

4.10.0

2 years ago

4.8.0

2 years ago

4.6.2

3 years ago

4.7.0

2 years ago

4.5.0

3 years ago

4.4.1

3 years ago

4.4.0

3 years ago

4.6.0

3 years ago

4.5.1

3 years ago

4.3.0

3 years ago

4.1.0

3 years ago

4.2.1

3 years ago

4.2.0

3 years ago

4.1.1

3 years ago

4.0.1

3 years ago

4.0.2

3 years ago

3.1.0

3 years ago

4.0.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.15

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago