@uploadista/server 0.0.13-beta.4 → 0.0.13

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.
@@ -5,6 +5,22 @@
5
5
  * requirements and generate appropriate error messages at compile time.
6
6
  */
7
7
 
8
+ import {
9
+ type DescribeVideoMetadata,
10
+ type ExtractFrameVideoParams,
11
+ ImagePlugin,
12
+ type OptimizeParams,
13
+ type ResizeParams,
14
+ type ResizeVideoParams,
15
+ type TranscodeVideoParams,
16
+ type Transformation,
17
+ type TrimVideoParams,
18
+ type UploadistaError,
19
+ VideoPlugin,
20
+ type ZipInput,
21
+ type ZipParams,
22
+ ZipPlugin,
23
+ } from "@uploadista/core";
8
24
  import { Effect, Layer } from "effect";
9
25
  import { expectType } from "tsd";
10
26
  import type {
@@ -20,31 +36,46 @@ import type {
20
36
  // Test Services and Layers
21
37
  // ============================================================================
22
38
 
23
- class ImagePlugin {
24
- readonly _tag = "ImagePlugin";
25
- resize(data: Buffer, width: number): Buffer {
26
- return data;
27
- }
28
- }
29
-
30
- class ZipPlugin {
31
- readonly _tag = "ZipPlugin";
32
- compress(files: Buffer[]): Buffer {
33
- return Buffer.from([]);
34
- }
35
- }
36
-
37
- class VideoPlugin {
38
- readonly _tag = "VideoPlugin";
39
- transcode(data: Buffer): Buffer {
40
- return data;
41
- }
42
- }
43
-
44
- // Create test layers
45
- const imageLayer = Layer.succeed(ImagePlugin, new ImagePlugin());
46
- const zipLayer = Layer.succeed(ZipPlugin, new ZipPlugin());
47
- const videoLayer = Layer.succeed(VideoPlugin, new VideoPlugin());
39
+ const imageLayer = Layer.succeed(
40
+ ImagePlugin,
41
+ ImagePlugin.of({
42
+ optimize: (input: Uint8Array, _options: OptimizeParams) =>
43
+ Effect.succeed(input),
44
+ resize: (input: Uint8Array, _options: ResizeParams) =>
45
+ Effect.succeed(input),
46
+ transform: (input: Uint8Array, _options: Transformation) =>
47
+ Effect.succeed(input),
48
+ }),
49
+ );
50
+ const zipLayer = Layer.succeed(
51
+ ZipPlugin,
52
+ ZipPlugin.of({
53
+ zip: (_inputs: ZipInput[], _options: ZipParams) =>
54
+ Effect.succeed(new Uint8Array([])),
55
+ }),
56
+ );
57
+ const videoLayer = Layer.succeed(
58
+ VideoPlugin,
59
+ VideoPlugin.of({
60
+ transcode: (input: Uint8Array, _options: TranscodeVideoParams) =>
61
+ Effect.succeed(input),
62
+ resize: (input: Uint8Array, _options: ResizeVideoParams) =>
63
+ Effect.succeed(input),
64
+ trim: (input: Uint8Array, _options: TrimVideoParams) =>
65
+ Effect.succeed(input),
66
+ extractFrame: (
67
+ _input: Uint8Array,
68
+ _options: ExtractFrameVideoParams,
69
+ ): Effect.Effect<Uint8Array, UploadistaError> => {
70
+ throw new Error("Function not implemented.");
71
+ },
72
+ describe: (
73
+ _input: Uint8Array,
74
+ ): Effect.Effect<DescribeVideoMetadata, UploadistaError> => {
75
+ throw new Error("Function not implemented.");
76
+ },
77
+ }),
78
+ );
48
79
 
49
80
  // ============================================================================
50
81
  // PluginTuple Tests
@@ -0,0 +1,39 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ /**
4
+ * Shared vitest configuration template for uploadista-sdk packages
5
+ *
6
+ * This template should be used by all SDK packages to ensure consistent
7
+ * testing configuration across the monorepo.
8
+ *
9
+ * Key features:
10
+ * - Tests in dedicated `tests/` directories (not colocated with src)
11
+ * - Node environment for server-side code
12
+ * - V8 coverage provider
13
+ * - Global test functions available
14
+ * - Effect testing support via @effect/vitest
15
+ *
16
+ * Usage:
17
+ * Copy this file to your package root as `vitest.config.ts` and customize
18
+ * if needed (though most packages should use this as-is).
19
+ */
20
+ export default defineConfig({
21
+ test: {
22
+ globals: true,
23
+ environment: "node",
24
+ include: ["tests/**/*.test.ts"],
25
+ exclude: ["node_modules", "dist"],
26
+ coverage: {
27
+ provider: "v8",
28
+ reporter: ["text", "json", "html"],
29
+ exclude: [
30
+ "node_modules/",
31
+ "dist/",
32
+ "**/*.d.ts",
33
+ "**/*.test.ts",
34
+ "**/*.spec.ts",
35
+ "tests/",
36
+ ],
37
+ },
38
+ },
39
+ });