@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.
- package/dist/auth/index.d.cts +1 -1
- package/dist/auth/index.d.mts +1 -1
- package/dist/auth/index.mjs +1 -1
- package/dist/{auth-BqArZeGK.mjs → auth-D2lKhlzK.mjs} +1 -1
- package/dist/{auth-BqArZeGK.mjs.map → auth-D2lKhlzK.mjs.map} +1 -1
- package/dist/{index-50KlDIjc.d.cts → index-BXLtlr98.d.mts} +1 -1
- package/dist/{index-50KlDIjc.d.cts.map → index-BXLtlr98.d.mts.map} +1 -1
- package/dist/{index--Lny6VJP.d.mts → index-mMP18lsw.d.cts} +1 -1
- package/dist/{index--Lny6VJP.d.mts.map → index-mMP18lsw.d.cts.map} +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +13 -11
- package/src/core/plugin-types.ts +5 -3
- package/src/plugins-typing.ts +1 -0
- package/{src/__tests__ → tests}/backward-compatibility.test.ts +23 -23
- package/{src → tests}/cache.test.ts +2 -2
- package/tests/core/http-handlers/flow-handlers.test.ts +495 -0
- package/tests/core/http-handlers/upload-handlers.test.ts +657 -0
- package/{src/core/__tests__ → tests/core}/plugin-validation.test.ts +59 -26
- package/tests/core/websocket-handlers/websocket-handlers.test.ts +659 -0
- package/{src → tests}/service.test.ts +2 -2
- package/type-tests/plugin-types.test-d.ts +56 -25
- package/vitest.config.ts +39 -0
|
@@ -4,43 +4,76 @@
|
|
|
4
4
|
* These tests verify runtime plugin validation behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
type DescribeVideoMetadata,
|
|
9
|
+
type ExtractFrameVideoParams,
|
|
10
|
+
ImagePlugin,
|
|
11
|
+
type OptimizeParams,
|
|
12
|
+
type ResizeParams,
|
|
13
|
+
type ResizeVideoParams,
|
|
14
|
+
type TranscodeVideoParams,
|
|
15
|
+
type Transformation,
|
|
16
|
+
type TrimVideoParams,
|
|
17
|
+
type UploadistaError,
|
|
18
|
+
VideoPlugin,
|
|
19
|
+
type ZipInput,
|
|
20
|
+
type ZipParams,
|
|
21
|
+
ZipPlugin,
|
|
22
|
+
} from "@uploadista/core";
|
|
23
|
+
import { Effect, Layer } from "effect";
|
|
8
24
|
import { describe, expect, it } from "vitest";
|
|
9
25
|
import {
|
|
10
26
|
extractServiceIdentifiers,
|
|
11
27
|
formatPluginValidationError,
|
|
12
28
|
validatePluginRequirements,
|
|
13
29
|
validatePluginsOrThrow,
|
|
14
|
-
} from "
|
|
30
|
+
} from "../../src/core/plugin-validation";
|
|
15
31
|
|
|
16
32
|
// ============================================================================
|
|
17
33
|
// Test Fixtures
|
|
18
34
|
// ============================================================================
|
|
19
35
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
// Create test layers
|
|
37
|
+
const imagePluginLayer = Layer.succeed(
|
|
38
|
+
ImagePlugin,
|
|
39
|
+
ImagePlugin.of({
|
|
40
|
+
optimize: (input: Uint8Array, _options: OptimizeParams) =>
|
|
41
|
+
Effect.succeed(input),
|
|
42
|
+
resize: (input: Uint8Array, _options: ResizeParams) =>
|
|
43
|
+
Effect.succeed(input),
|
|
44
|
+
transform: (input: Uint8Array, _options: Transformation) =>
|
|
45
|
+
Effect.succeed(input),
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
const zipPluginLayer = Layer.succeed(
|
|
49
|
+
ZipPlugin,
|
|
50
|
+
ZipPlugin.of({
|
|
51
|
+
zip: (_inputs: ZipInput[], _options: ZipParams) =>
|
|
52
|
+
Effect.succeed(new Uint8Array([])),
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
const videoPluginLayer = Layer.succeed(
|
|
56
|
+
VideoPlugin,
|
|
57
|
+
VideoPlugin.of({
|
|
58
|
+
transcode: (input: Uint8Array, _options: TranscodeVideoParams) =>
|
|
59
|
+
Effect.succeed(input),
|
|
60
|
+
resize: (input: Uint8Array, _options: ResizeVideoParams) =>
|
|
61
|
+
Effect.succeed(input),
|
|
62
|
+
trim: (input: Uint8Array, _options: TrimVideoParams) =>
|
|
63
|
+
Effect.succeed(input),
|
|
64
|
+
extractFrame: (
|
|
65
|
+
_input: Uint8Array,
|
|
66
|
+
_options: ExtractFrameVideoParams,
|
|
67
|
+
): Effect.Effect<Uint8Array, UploadistaError> => {
|
|
68
|
+
throw new Error("Function not implemented.");
|
|
69
|
+
},
|
|
70
|
+
describe: (
|
|
71
|
+
_input: Uint8Array,
|
|
72
|
+
): Effect.Effect<DescribeVideoMetadata, UploadistaError> => {
|
|
73
|
+
throw new Error("Function not implemented.");
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
44
77
|
|
|
45
78
|
// ============================================================================
|
|
46
79
|
// extractServiceIdentifiers Tests
|