@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
|
@@ -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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
package/vitest.config.ts
ADDED
|
@@ -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
|
+
});
|