@better-media/core 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +39 -0
- package/dist/index.d.mts +779 -0
- package/dist/index.d.ts +779 -0
- package/dist/index.js +749 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +718 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 abenezeratnafu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
|
20
|
+
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @better-media/core
|
|
2
|
+
|
|
3
|
+
Core interfaces and types for the Better Media framework.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package defines the contracts that all adapters and plugins must implement. It has **zero dependencies** and provides the type definitions for:
|
|
8
|
+
|
|
9
|
+
- **StorageAdapter**: Handles file read/write operations (S3, Filesystem, Memory).
|
|
10
|
+
- **DatabaseAdapter**: Handles metadata persistence and retrieval.
|
|
11
|
+
- **JobAdapter**: Handles background execution of pipeline tasks.
|
|
12
|
+
- **PipelinePlugin**: Defines hooks and logic for media processing, validation, etc.
|
|
13
|
+
- **PipelineContext**: The data structure passed through the pipeline.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
You typically only need this package if you are:
|
|
18
|
+
|
|
19
|
+
1. **Building a custom adapter**: Implement `StorageAdapter`, `DatabaseAdapter`, or `JobAdapter`.
|
|
20
|
+
2. **Building a custom plugin**: Implement the `PipelinePlugin` interface.
|
|
21
|
+
3. **Type-checking your configuration**: Import types for your `BetterMediaConfig`.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import type { StorageAdapter, PipelinePlugin } from "@better-media/core";
|
|
25
|
+
|
|
26
|
+
// Example: Minimal custom plugin
|
|
27
|
+
export const myPlugin: PipelinePlugin = {
|
|
28
|
+
name: "my-plugin",
|
|
29
|
+
hooks: {
|
|
30
|
+
afterUpload: async (context) => {
|
|
31
|
+
console.log("File uploaded:", context.file.key);
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
|
|
39
|
+
For full documentation, visit [better-media.dev](https://better-media.dev/docs/core).
|