@kimjansheden/payload-video-processor 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,78 @@
1
+ import { PayloadRequest, CollectionConfig as CollectionConfig$1, Plugin, Config } from 'payload';
2
+
3
+ type Preset = {
4
+ args: string[];
5
+ label?: string;
6
+ enableCrop?: boolean;
7
+ };
8
+ type VariantRecord = {
9
+ preset: string;
10
+ url: string;
11
+ path: string;
12
+ size: number;
13
+ duration?: number;
14
+ width?: number;
15
+ height?: number;
16
+ bitrate?: number;
17
+ createdAt: string;
18
+ };
19
+ type QueueConfig = {
20
+ name?: string;
21
+ redisUrl?: string;
22
+ concurrency?: number;
23
+ };
24
+ type AccessEnqueueArgs = {
25
+ req: PayloadRequest;
26
+ };
27
+ type AccessVariantArgs = {
28
+ req: PayloadRequest;
29
+ collection: string;
30
+ id: string;
31
+ preset?: string;
32
+ variantId?: string;
33
+ variantIndex?: number;
34
+ };
35
+ type AccessControl = {
36
+ enqueue?: (args: AccessEnqueueArgs) => boolean | Promise<boolean>;
37
+ replaceOriginal?: (args: AccessVariantArgs) => boolean | Promise<boolean>;
38
+ removeVariant?: (args: AccessVariantArgs) => boolean | Promise<boolean>;
39
+ };
40
+ type CollectionConfig = CollectionConfig$1;
41
+ type ResolvePathsArgs = {
42
+ doc: unknown;
43
+ collection: CollectionConfig | null;
44
+ collectionSlug: string;
45
+ original: {
46
+ filename: string;
47
+ path: string;
48
+ url: string;
49
+ };
50
+ presetName: string;
51
+ };
52
+ type ResolvePathsResult = {
53
+ dir: string;
54
+ filename: string;
55
+ url: string;
56
+ };
57
+ type VideoPluginOptions = {
58
+ presets: Record<string, Preset>;
59
+ queue?: QueueConfig;
60
+ access?: AccessControl;
61
+ resolvePaths?: (args: ResolvePathsArgs) => ResolvePathsResult;
62
+ };
63
+ type VideoVariantFieldConfig = {
64
+ presets: Record<string, {
65
+ label: string;
66
+ enableCrop: boolean;
67
+ }>;
68
+ queueName: string;
69
+ enqueuePath: string;
70
+ statusPath: string;
71
+ removeVariantPath: string;
72
+ replaceOriginalPath: string;
73
+ collectionSlug: string;
74
+ };
75
+ type PayloadConfig = Config;
76
+ type PayloadPluginFactory = Plugin;
77
+
78
+ export type { PayloadPluginFactory as P, ResolvePathsArgs as R, VideoPluginOptions as V, ResolvePathsResult as a, Preset as b, VariantRecord as c, PayloadConfig as d, VideoVariantFieldConfig as e };
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "@kimjansheden/payload-video-processor",
3
+ "version": "0.1.1",
4
+ "description": "Queued FFmpeg video variant processing for Payload CMS",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/kimjansheden/PayloadVideoPlugin.git"
8
+ },
9
+ "bugs": {
10
+ "url": "https://github.com/kimjansheden/PayloadVideoPlugin/issues"
11
+ },
12
+ "homepage": "https://github.com/kimjansheden/PayloadVideoPlugin#readme",
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "type": "module",
17
+ "main": "dist/index.cjs",
18
+ "module": "dist/index.js",
19
+ "types": "types/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./types/index.d.ts",
23
+ "import": "./dist/index.js",
24
+ "require": "./dist/index.cjs"
25
+ },
26
+ "./worker": {
27
+ "types": "./dist/queue/worker.d.ts",
28
+ "import": "./dist/queue/worker.js",
29
+ "require": "./dist/queue/worker.cjs"
30
+ },
31
+ "./admin/VideoField": {
32
+ "types": "./dist/admin/VideoField.d.ts",
33
+ "import": "./dist/admin/VideoField.js",
34
+ "require": "./dist/admin/VideoField.cjs"
35
+ },
36
+ "./client": {
37
+ "types": "./dist/exports/client.d.ts",
38
+ "import": "./dist/exports/client.js",
39
+ "require": "./dist/exports/client.cjs",
40
+ "default": "./dist/exports/client.js"
41
+ }
42
+ },
43
+ "files": [
44
+ "dist",
45
+ "types"
46
+ ],
47
+ "bin": {
48
+ "payload-video-worker": "dist/cli/start-worker.js"
49
+ },
50
+ "scripts": {
51
+ "build": "pnpm exec tsup && node ./scripts/ensureUseClient.mjs",
52
+ "dev": "pnpm exec tsup --watch",
53
+ "lint": "eslint src --ext .ts,.tsx",
54
+ "typecheck": "tsc --noEmit",
55
+ "test": "vitest",
56
+ "worker": "node ./dist/queue/worker.js"
57
+ },
58
+ "peerDependencies": {
59
+ "@payloadcms/ui": "^3.0.0",
60
+ "payload": "^3.0.0",
61
+ "react": ">=18",
62
+ "react-dom": ">=18"
63
+ },
64
+ "dependencies": {
65
+ "bullmq": "^5.38.0",
66
+ "fluent-ffmpeg": "^2.1.2",
67
+ "ffmpeg-static": "^5.2.0",
68
+ "ffprobe-static": "^3.1.0",
69
+ "ioredis": "^5.4.1",
70
+ "dotenv": "^16.4.5",
71
+ "react-easy-crop": "^5.0.7",
72
+ "zod": "^3.23.8"
73
+ },
74
+ "devDependencies": {
75
+ "@eslint/js": "^9.33.0",
76
+ "@payloadcms/ui": "^3.0.0",
77
+ "@types/fluent-ffmpeg": "^2.1.24",
78
+ "@types/express": "^5.0.1",
79
+ "@types/node": "^22.10.1",
80
+ "@types/react": "^19.1.10",
81
+ "@types/react-dom": "^19.1.7",
82
+ "@typescript-eslint/eslint-plugin": "^8.16.0",
83
+ "@typescript-eslint/parser": "^8.16.0",
84
+ "eslint": "^9.33.0",
85
+ "globals": "^15.14.0",
86
+ "payload": "^3.0.0",
87
+ "typescript": "^5.8.3",
88
+ "tsup": "^8.3.0",
89
+ "vitest": "^2.1.8"
90
+ }
91
+ }
@@ -0,0 +1,6 @@
1
+ export * from "../dist/index";
2
+ import type { Plugin } from "payload";
3
+ import type { VideoPluginOptions } from "../dist/index";
4
+
5
+ declare const pluginFactory: (options: VideoPluginOptions) => Plugin;
6
+ export default pluginFactory;