@uploadista/flow-videos-nodes 0.0.16 → 0.0.17-beta.2
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/.turbo/turbo-build.log +9 -9
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +34 -34
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/describe-video-node.ts +6 -1
- package/src/resize-node.ts +2 -0
- package/src/thumbnail-node.ts +2 -0
- package/src/transcode-node.ts +2 -0
- package/src/trim-node.ts +2 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @uploadista/flow-videos-nodes@0.0.
|
|
3
|
+
> @uploadista/flow-videos-nodes@0.0.17-beta.1 build /Users/denislaboureyras/Documents/uploadista/dev/uploadista-workspace/uploadista-sdk/packages/flow/videos/nodes
|
|
4
4
|
> tsdown
|
|
5
5
|
|
|
6
6
|
[34mℹ[39m tsdown [2mv0.16.5[22m powered by rolldown [2mv1.0.0-beta.50[22m
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
10
10
|
[34mℹ[39m Build start
|
|
11
11
|
[34mℹ[39m Cleaning 7 files
|
|
12
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mindex.cjs[22m [2m2.
|
|
13
|
-
[34mℹ[39m [33m[CJS][39m 1 files, total: 2.
|
|
14
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mindex.mjs[22m [2m 2.
|
|
15
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.mjs.map [2m11.
|
|
16
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.d.mts.map [2m 2.10 kB[22m [2m│ gzip: 0.
|
|
12
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mindex.cjs[22m [2m2.83 kB[22m [2m│ gzip: 0.91 kB[22m
|
|
13
|
+
[34mℹ[39m [33m[CJS][39m 1 files, total: 2.83 kB
|
|
14
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mindex.mjs[22m [2m 2.53 kB[22m [2m│ gzip: 0.93 kB[22m
|
|
15
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.mjs.map [2m11.66 kB[22m [2m│ gzip: 2.67 kB[22m
|
|
16
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.d.mts.map [2m 2.10 kB[22m [2m│ gzip: 0.61 kB[22m
|
|
17
17
|
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 9.46 kB[22m [2m│ gzip: 1.50 kB[22m
|
|
18
|
-
[34mℹ[39m [34m[ESM][39m 4 files, total: 25.
|
|
19
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22mindex.d.cts.map [2m2.10 kB[22m [2m│ gzip: 0.
|
|
18
|
+
[34mℹ[39m [34m[ESM][39m 4 files, total: 25.74 kB
|
|
19
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mindex.d.cts.map [2m2.10 kB[22m [2m│ gzip: 0.61 kB[22m
|
|
20
20
|
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mindex.d.cts[22m[39m [2m9.46 kB[22m [2m│ gzip: 1.50 kB[22m
|
|
21
21
|
[34mℹ[39m [33m[CJS][39m 2 files, total: 11.55 kB
|
|
22
|
-
[32m✔[39m Build complete in [
|
|
22
|
+
[32m✔[39m Build complete in [32m6791ms[39m
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e=require(`@uploadista/core/flow`),t=require(`effect`),n=require(`@uploadista/core/errors`);function r(n){return t.Effect.gen(function*(){let r=yield*e.VideoPlugin;return yield*(0,e.createTransformNode)({id:n,name:`Describe Video`,description:`Extracts video metadata (duration, resolution, codec, etc.)`,transform:(e,n)=>t.Effect.gen(function*(){let t=yield*r.describe(e);return{bytes:e,metadata:{...n.metadata,videoInfo:t}}})})})}function i(n,r){return t.Effect.gen(function*(){let i=yield*e.VideoPlugin;return yield*(0,e.createTransformNode)({id:n,name:`Resize Video`,description:`Changes video resolution`,transform:(e,n)=>t.Effect.map(i.resize(e,r),e=>({bytes:e}))})})}function a(n,r){return t.Effect.gen(function*(){let i=yield*e.VideoPlugin,a=r.format||`jpeg`;return yield*(0,e.createTransformNode)({id:n,name:`Generate Thumbnail`,description:`Extracts a frame from video as an image`,transform:(e,n)=>t.Effect.map(i.extractFrame(e,r),e=>{let t=a===`png`?`image/png`:`image/jpeg`,r=a===`png`?`png`:`jpg`,i=n.metadata?.fileName;return{bytes:e,type:t,fileName:i&&typeof i==`string`?i.replace(/\.[^.]+$/,`.${r}`):void 0}})})})}const o={mp4:`video/mp4`,webm:`video/webm`,mov:`video/quicktime`,avi:`video/x-msvideo`},s={mp4:`mp4`,webm:`webm`,mov:`mov`,avi:`avi`};function c(n,r){return t.Effect.gen(function*(){let i=yield*e.VideoPlugin;return yield*(0,e.createTransformNode)({id:n,name:`Transcode`,description:`Converts video to specified format and codec`,transform:(e,n)=>t.Effect.map(i.transcode(e,r),e=>{let t=o[r.format],i=s[r.format],a=n.metadata?.fileName;return{bytes:e,type:t,fileName:a&&typeof a==`string`?a.replace(/\.[^.]+$/,`.${i}`):void 0}})})})}function l(r,i){return t.Effect.gen(function*(){let a=yield*e.VideoPlugin;return i.endTime!==void 0&&i.endTime<=i.startTime?yield*n.UploadistaError.fromCode(`VALIDATION_ERROR`,{body:`endTime must be greater than startTime`,details:{params:i}}).toEffect():i.duration!==void 0&&i.endTime!==void 0&&i.duration!==i.endTime-i.startTime?yield*n.UploadistaError.fromCode(`VALIDATION_ERROR`,{body:`Cannot specify both endTime and duration with conflicting values`,details:{params:i}}).toEffect():i.duration!==void 0&&i.duration<=0?yield*n.UploadistaError.fromCode(`VALIDATION_ERROR`,{body:`duration must be greater than 0`,details:{params:i}}).toEffect():yield*(0,e.createTransformNode)({id:r,name:`Trim Video`,description:`Extracts a segment from the video`,transform:(e,n)=>t.Effect.map(a.trim(e,i),e=>({bytes:e}))})})}exports.createDescribeVideoNode=r,exports.createTranscodeVideoNode=c,exports.createTrimVideoNode=l,exports.createVideoResizeNode=i,exports.createVideoThumbnailNode=a;
|
|
1
|
+
let e=require(`@uploadista/core/flow`),t=require(`effect`),n=require(`@uploadista/core/errors`);function r(n){return t.Effect.gen(function*(){let r=yield*e.VideoPlugin;return yield*(0,e.createTransformNode)({id:n,name:`Describe Video`,description:`Extracts video metadata (duration, resolution, codec, etc.)`,nodeTypeId:e.STORAGE_OUTPUT_TYPE_ID,transform:(e,n)=>t.Effect.gen(function*(){let t=yield*r.describe(e);return{bytes:e,metadata:{...n.metadata,videoInfo:t}}})})})}function i(n,r){return t.Effect.gen(function*(){let i=yield*e.VideoPlugin;return yield*(0,e.createTransformNode)({id:n,name:`Resize Video`,description:`Changes video resolution`,nodeTypeId:e.STORAGE_OUTPUT_TYPE_ID,transform:(e,n)=>t.Effect.map(i.resize(e,r),e=>({bytes:e}))})})}function a(n,r){return t.Effect.gen(function*(){let i=yield*e.VideoPlugin,a=r.format||`jpeg`;return yield*(0,e.createTransformNode)({id:n,name:`Generate Thumbnail`,description:`Extracts a frame from video as an image`,nodeTypeId:e.STORAGE_OUTPUT_TYPE_ID,transform:(e,n)=>t.Effect.map(i.extractFrame(e,r),e=>{let t=a===`png`?`image/png`:`image/jpeg`,r=a===`png`?`png`:`jpg`,i=n.metadata?.fileName;return{bytes:e,type:t,fileName:i&&typeof i==`string`?i.replace(/\.[^.]+$/,`.${r}`):void 0}})})})}const o={mp4:`video/mp4`,webm:`video/webm`,mov:`video/quicktime`,avi:`video/x-msvideo`},s={mp4:`mp4`,webm:`webm`,mov:`mov`,avi:`avi`};function c(n,r){return t.Effect.gen(function*(){let i=yield*e.VideoPlugin;return yield*(0,e.createTransformNode)({id:n,name:`Transcode`,description:`Converts video to specified format and codec`,nodeTypeId:e.STORAGE_OUTPUT_TYPE_ID,transform:(e,n)=>t.Effect.map(i.transcode(e,r),e=>{let t=o[r.format],i=s[r.format],a=n.metadata?.fileName;return{bytes:e,type:t,fileName:a&&typeof a==`string`?a.replace(/\.[^.]+$/,`.${i}`):void 0}})})})}function l(r,i){return t.Effect.gen(function*(){let a=yield*e.VideoPlugin;return i.endTime!==void 0&&i.endTime<=i.startTime?yield*n.UploadistaError.fromCode(`VALIDATION_ERROR`,{body:`endTime must be greater than startTime`,details:{params:i}}).toEffect():i.duration!==void 0&&i.endTime!==void 0&&i.duration!==i.endTime-i.startTime?yield*n.UploadistaError.fromCode(`VALIDATION_ERROR`,{body:`Cannot specify both endTime and duration with conflicting values`,details:{params:i}}).toEffect():i.duration!==void 0&&i.duration<=0?yield*n.UploadistaError.fromCode(`VALIDATION_ERROR`,{body:`duration must be greater than 0`,details:{params:i}}).toEffect():yield*(0,e.createTransformNode)({id:r,name:`Trim Video`,description:`Extracts a segment from the video`,nodeTypeId:e.STORAGE_OUTPUT_TYPE_ID,transform:(e,n)=>t.Effect.map(a.trim(e,i),e=>({bytes:e}))})})}exports.createDescribeVideoNode=r,exports.createTranscodeVideoNode=c,exports.createTrimVideoNode=l,exports.createVideoResizeNode=i,exports.createVideoThumbnailNode=a;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _uploadista_core_flow2 from "@uploadista/core/flow";
|
|
2
2
|
import { DescribeVideoMetadata, ExtractFrameVideoParams, ExtractFrameVideoParams as ExtractFrameVideoParams$1, ResizeVideoParams, ResizeVideoParams as ResizeVideoParams$1, TranscodeVideoParams, TranscodeVideoParams as TranscodeVideoParams$1, TrimVideoParams, TrimVideoParams as TrimVideoParams$1, VideoPlugin } from "@uploadista/core/flow";
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
3
|
+
import * as _uploadista_core_types5 from "@uploadista/core/types";
|
|
4
|
+
import * as zod_v4_core1 from "zod/v4/core";
|
|
5
|
+
import * as zod1 from "zod";
|
|
6
6
|
import * as _uploadista_core_errors0 from "@uploadista/core/errors";
|
|
7
7
|
import { UploadistaError } from "@uploadista/core/errors";
|
|
8
8
|
import * as _uploadista_core_upload0 from "@uploadista/core/upload";
|
|
@@ -25,17 +25,17 @@ import { Effect } from "effect";
|
|
|
25
25
|
* const node = yield* createDescribeVideoNode("describe-1");
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
declare function createDescribeVideoNode(id: string): Effect.Effect<
|
|
29
|
-
inputSchema:
|
|
30
|
-
outputSchema:
|
|
28
|
+
declare function createDescribeVideoNode(id: string): Effect.Effect<_uploadista_core_flow2.FlowNodeData & {
|
|
29
|
+
inputSchema: zod1.ZodType<_uploadista_core_types5.UploadFile, unknown, zod_v4_core1.$ZodTypeInternals<_uploadista_core_types5.UploadFile, unknown>>;
|
|
30
|
+
outputSchema: zod1.ZodType<_uploadista_core_types5.UploadFile, unknown, zod_v4_core1.$ZodTypeInternals<_uploadista_core_types5.UploadFile, unknown>>;
|
|
31
31
|
run: (args: {
|
|
32
|
-
data:
|
|
32
|
+
data: _uploadista_core_types5.UploadFile;
|
|
33
33
|
jobId: string;
|
|
34
34
|
storageId: string;
|
|
35
35
|
flowId: string;
|
|
36
36
|
inputs?: Record<string, unknown>;
|
|
37
37
|
clientId: string | null;
|
|
38
|
-
}) => Effect.Effect<
|
|
38
|
+
}) => Effect.Effect<_uploadista_core_flow2.NodeExecutionResult<_uploadista_core_types5.UploadFile>, _uploadista_core_errors0.UploadistaError, never>;
|
|
39
39
|
condition?: {
|
|
40
40
|
field: string;
|
|
41
41
|
operator: string;
|
|
@@ -50,7 +50,7 @@ declare function createDescribeVideoNode(id: string): Effect.Effect<_uploadista_
|
|
|
50
50
|
exponentialBackoff?: boolean;
|
|
51
51
|
};
|
|
52
52
|
} & {
|
|
53
|
-
type:
|
|
53
|
+
type: _uploadista_core_flow2.NodeType;
|
|
54
54
|
}, _uploadista_core_errors0.UploadistaError, VideoPlugin | _uploadista_core_upload0.UploadServer>;
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region src/resize-node.d.ts
|
|
@@ -73,17 +73,17 @@ declare function createDescribeVideoNode(id: string): Effect.Effect<_uploadista_
|
|
|
73
73
|
* });
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
|
-
declare function createVideoResizeNode(id: string, params: ResizeVideoParams$1): Effect.Effect<
|
|
77
|
-
inputSchema:
|
|
78
|
-
outputSchema:
|
|
76
|
+
declare function createVideoResizeNode(id: string, params: ResizeVideoParams$1): Effect.Effect<_uploadista_core_flow2.FlowNodeData & {
|
|
77
|
+
inputSchema: zod1.ZodType<_uploadista_core_types5.UploadFile, unknown, zod_v4_core1.$ZodTypeInternals<_uploadista_core_types5.UploadFile, unknown>>;
|
|
78
|
+
outputSchema: zod1.ZodType<_uploadista_core_types5.UploadFile, unknown, zod_v4_core1.$ZodTypeInternals<_uploadista_core_types5.UploadFile, unknown>>;
|
|
79
79
|
run: (args: {
|
|
80
|
-
data:
|
|
80
|
+
data: _uploadista_core_types5.UploadFile;
|
|
81
81
|
jobId: string;
|
|
82
82
|
storageId: string;
|
|
83
83
|
flowId: string;
|
|
84
84
|
inputs?: Record<string, unknown>;
|
|
85
85
|
clientId: string | null;
|
|
86
|
-
}) => Effect.Effect<
|
|
86
|
+
}) => Effect.Effect<_uploadista_core_flow2.NodeExecutionResult<_uploadista_core_types5.UploadFile>, _uploadista_core_errors0.UploadistaError, never>;
|
|
87
87
|
condition?: {
|
|
88
88
|
field: string;
|
|
89
89
|
operator: string;
|
|
@@ -98,7 +98,7 @@ declare function createVideoResizeNode(id: string, params: ResizeVideoParams$1):
|
|
|
98
98
|
exponentialBackoff?: boolean;
|
|
99
99
|
};
|
|
100
100
|
} & {
|
|
101
|
-
type:
|
|
101
|
+
type: _uploadista_core_flow2.NodeType;
|
|
102
102
|
}, _uploadista_core_errors0.UploadistaError, VideoPlugin | _uploadista_core_upload0.UploadServer>;
|
|
103
103
|
//#endregion
|
|
104
104
|
//#region src/thumbnail-node.d.ts
|
|
@@ -120,17 +120,17 @@ declare function createVideoResizeNode(id: string, params: ResizeVideoParams$1):
|
|
|
120
120
|
* });
|
|
121
121
|
* ```
|
|
122
122
|
*/
|
|
123
|
-
declare function createVideoThumbnailNode(id: string, params: ExtractFrameVideoParams$1): Effect.Effect<
|
|
124
|
-
inputSchema:
|
|
125
|
-
outputSchema:
|
|
123
|
+
declare function createVideoThumbnailNode(id: string, params: ExtractFrameVideoParams$1): Effect.Effect<_uploadista_core_flow2.FlowNodeData & {
|
|
124
|
+
inputSchema: zod1.ZodType<_uploadista_core_types5.UploadFile, unknown, zod_v4_core1.$ZodTypeInternals<_uploadista_core_types5.UploadFile, unknown>>;
|
|
125
|
+
outputSchema: zod1.ZodType<_uploadista_core_types5.UploadFile, unknown, zod_v4_core1.$ZodTypeInternals<_uploadista_core_types5.UploadFile, unknown>>;
|
|
126
126
|
run: (args: {
|
|
127
|
-
data:
|
|
127
|
+
data: _uploadista_core_types5.UploadFile;
|
|
128
128
|
jobId: string;
|
|
129
129
|
storageId: string;
|
|
130
130
|
flowId: string;
|
|
131
131
|
inputs?: Record<string, unknown>;
|
|
132
132
|
clientId: string | null;
|
|
133
|
-
}) => Effect.Effect<
|
|
133
|
+
}) => Effect.Effect<_uploadista_core_flow2.NodeExecutionResult<_uploadista_core_types5.UploadFile>, _uploadista_core_errors0.UploadistaError, never>;
|
|
134
134
|
condition?: {
|
|
135
135
|
field: string;
|
|
136
136
|
operator: string;
|
|
@@ -145,7 +145,7 @@ declare function createVideoThumbnailNode(id: string, params: ExtractFrameVideoP
|
|
|
145
145
|
exponentialBackoff?: boolean;
|
|
146
146
|
};
|
|
147
147
|
} & {
|
|
148
|
-
type:
|
|
148
|
+
type: _uploadista_core_flow2.NodeType;
|
|
149
149
|
}, _uploadista_core_errors0.UploadistaError, VideoPlugin | _uploadista_core_upload0.UploadServer>;
|
|
150
150
|
//#endregion
|
|
151
151
|
//#region src/transcode-node.d.ts
|
|
@@ -167,17 +167,17 @@ declare function createVideoThumbnailNode(id: string, params: ExtractFrameVideoP
|
|
|
167
167
|
* });
|
|
168
168
|
* ```
|
|
169
169
|
*/
|
|
170
|
-
declare function createTranscodeVideoNode(id: string, params: TranscodeVideoParams$1): Effect.Effect<
|
|
171
|
-
inputSchema:
|
|
172
|
-
outputSchema:
|
|
170
|
+
declare function createTranscodeVideoNode(id: string, params: TranscodeVideoParams$1): Effect.Effect<_uploadista_core_flow2.FlowNodeData & {
|
|
171
|
+
inputSchema: zod1.ZodType<_uploadista_core_types5.UploadFile, unknown, zod_v4_core1.$ZodTypeInternals<_uploadista_core_types5.UploadFile, unknown>>;
|
|
172
|
+
outputSchema: zod1.ZodType<_uploadista_core_types5.UploadFile, unknown, zod_v4_core1.$ZodTypeInternals<_uploadista_core_types5.UploadFile, unknown>>;
|
|
173
173
|
run: (args: {
|
|
174
|
-
data:
|
|
174
|
+
data: _uploadista_core_types5.UploadFile;
|
|
175
175
|
jobId: string;
|
|
176
176
|
storageId: string;
|
|
177
177
|
flowId: string;
|
|
178
178
|
inputs?: Record<string, unknown>;
|
|
179
179
|
clientId: string | null;
|
|
180
|
-
}) => Effect.Effect<
|
|
180
|
+
}) => Effect.Effect<_uploadista_core_flow2.NodeExecutionResult<_uploadista_core_types5.UploadFile>, _uploadista_core_errors0.UploadistaError, never>;
|
|
181
181
|
condition?: {
|
|
182
182
|
field: string;
|
|
183
183
|
operator: string;
|
|
@@ -192,7 +192,7 @@ declare function createTranscodeVideoNode(id: string, params: TranscodeVideoPara
|
|
|
192
192
|
exponentialBackoff?: boolean;
|
|
193
193
|
};
|
|
194
194
|
} & {
|
|
195
|
-
type:
|
|
195
|
+
type: _uploadista_core_flow2.NodeType;
|
|
196
196
|
}, _uploadista_core_errors0.UploadistaError, VideoPlugin | _uploadista_core_upload0.UploadServer>;
|
|
197
197
|
//#endregion
|
|
198
198
|
//#region src/trim-node.d.ts
|
|
@@ -219,17 +219,17 @@ declare function createTranscodeVideoNode(id: string, params: TranscodeVideoPara
|
|
|
219
219
|
* });
|
|
220
220
|
* ```
|
|
221
221
|
*/
|
|
222
|
-
declare function createTrimVideoNode(id: string, params: TrimVideoParams$1): Effect.Effect<
|
|
223
|
-
inputSchema:
|
|
224
|
-
outputSchema:
|
|
222
|
+
declare function createTrimVideoNode(id: string, params: TrimVideoParams$1): Effect.Effect<_uploadista_core_flow2.FlowNodeData & {
|
|
223
|
+
inputSchema: zod1.ZodType<_uploadista_core_types5.UploadFile, unknown, zod_v4_core1.$ZodTypeInternals<_uploadista_core_types5.UploadFile, unknown>>;
|
|
224
|
+
outputSchema: zod1.ZodType<_uploadista_core_types5.UploadFile, unknown, zod_v4_core1.$ZodTypeInternals<_uploadista_core_types5.UploadFile, unknown>>;
|
|
225
225
|
run: (args: {
|
|
226
|
-
data:
|
|
226
|
+
data: _uploadista_core_types5.UploadFile;
|
|
227
227
|
jobId: string;
|
|
228
228
|
storageId: string;
|
|
229
229
|
flowId: string;
|
|
230
230
|
inputs?: Record<string, unknown>;
|
|
231
231
|
clientId: string | null;
|
|
232
|
-
}) => Effect.Effect<
|
|
232
|
+
}) => Effect.Effect<_uploadista_core_flow2.NodeExecutionResult<_uploadista_core_types5.UploadFile>, UploadistaError, never>;
|
|
233
233
|
condition?: {
|
|
234
234
|
field: string;
|
|
235
235
|
operator: string;
|
|
@@ -244,7 +244,7 @@ declare function createTrimVideoNode(id: string, params: TrimVideoParams$1): Eff
|
|
|
244
244
|
exponentialBackoff?: boolean;
|
|
245
245
|
};
|
|
246
246
|
} & {
|
|
247
|
-
type:
|
|
247
|
+
type: _uploadista_core_flow2.NodeType;
|
|
248
248
|
}, UploadistaError, VideoPlugin | _uploadista_core_upload0.UploadServer>;
|
|
249
249
|
//#endregion
|
|
250
250
|
export { type DescribeVideoMetadata, type ExtractFrameVideoParams, type ResizeVideoParams, type TranscodeVideoParams, type TrimVideoParams, createDescribeVideoNode, createTranscodeVideoNode, createTrimVideoNode, createVideoResizeNode, createVideoThumbnailNode };
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/describe-video-node.ts","../src/resize-node.ts","../src/thumbnail-node.ts","../src/transcode-node.ts","../src/trim-node.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/describe-video-node.ts","../src/resize-node.ts","../src/thumbnail-node.ts","../src/transcode-node.ts","../src/trim-node.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA;;;;;;iBAAgB,uBAAA,cAAkC,MAAA,CAAA,OAAX,sBAAA,CAAW,YAAA;4BAAA,uBAAA,CAAA,UAAA;;;;IA2BghlI,KAAA,EAAA,MAAA;IAAA,SAAA,EAAA,MAAA;;aAAA;;iEAAA,uBAAA,CAAA,UAAA;;;;IA3BhhlI,KAAA,EAAA,OAAA;EAAA,CAAA;;;;ECKlC,KAAA,CAAA,EAAA;IAA0C,UAAA,CAAA,EAAA,MAAA;IAAiB,UAAA,CAAA,EAAA,MAAA;IAAA,kBAAA,CAAA,EAAA,OAAA;;;;;;;;;;;;;;;;ADL3E;;;;;;;;;;iBCKgB,qBAAA,qBAA0C,sBAAiB,MAAA,CAAA,OAAA,sBAAA,CAAA,YAAA;EDsBu/kI,WAAA,cAAA,CCtBv/kI,uBAAA,CAAA,UAAA,EDsBu/kI,OAAA,gCAAA,qCAAA,OAAA,CAAA,CAAA;EAAA,YAAA,cAAA,qCAAA,OAAA,gCAAA,qCAAA,OAAA,CAAA,CAAA;;;;;;aCHsP;;EDxBtwlI,CAAA,EAAA,gBAAA,2CAAA,CCwBswlI,uBAAA,CAAA,UAAA,CDxBtwlI,4CAAA,KAAA,CAAA;EAAA,SAA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I;;EHlD72jI,CAAA,EAAA,gBAAA,2CAAqB,CGkDw1jI,uBAAA,CAAA,UAAA,CHlDx1jI,iBAAA,EAAA,KAAA,CAAA;EAAqB,SAAA,CAAA,EAAA;IAAiB,KAAA,EAAA,MAAA;IAAA,QAAA,EAAA,MAAA;;;;;;;;;IAmB6ulI,kBAAA,CAAA,EAAA,OAAA;EAAA,CAAA"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/describe-video-node.ts","../src/resize-node.ts","../src/thumbnail-node.ts","../src/transcode-node.ts","../src/trim-node.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/describe-video-node.ts","../src/resize-node.ts","../src/thumbnail-node.ts","../src/transcode-node.ts","../src/trim-node.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA;;;;;;iBAAgB,uBAAA,cAAkC,MAAA,CAAA,OAAX,sBAAA,CAAW,YAAA;4BAAA,uBAAA,CAAA,UAAA;;;;IA2BghlI,KAAA,EAAA,MAAA;IAAA,SAAA,EAAA,MAAA;;aAAA;;iEAAA,uBAAA,CAAA,UAAA;;;;IA3BhhlI,KAAA,EAAA,OAAA;EAAA,CAAA;;;;ECKlC,KAAA,CAAA,EAAA;IAA0C,UAAA,CAAA,EAAA,MAAA;IAAiB,UAAA,CAAA,EAAA,MAAA;IAAA,kBAAA,CAAA,EAAA,OAAA;;;;;;;;;;;;;;;;ADL3E;;;;;;;;;;iBCKgB,qBAAA,qBAA0C,sBAAiB,MAAA,CAAA,OAAA,sBAAA,CAAA,YAAA;EDsBu/kI,WAAA,cAAA,CCtBv/kI,uBAAA,CAAA,UAAA,EDsBu/kI,OAAA,gCAAA,qCAAA,OAAA,CAAA,CAAA;EAAA,YAAA,cAAA,qCAAA,OAAA,gCAAA,qCAAA,OAAA,CAA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Ae,MAAA,CAAA,OAAA,sBAAA,CAAA,YAAA;4BAAA,uBAAA,CAAA,UAAA;;;;IJVrB,KAAA,EAAA,MAAA;IAAA,SAAA,EAAA,MAAA;;aIuD20jI;;EHlD72jI,CAAA,EAAA,gBAAA,2CAAqB,CGkDw1jI,uBAAA,CAAA,UAAA,CHlDx1jI,iBAAA,EAAA,KAAA,CAAA;EAAqB,SAAA,CAAA,EAAA;IAAiB,KAAA,EAAA,MAAA;IAAA,QAAA,EAAA,MAAA;;;;;;;;;IAmB6ulI,kBAAA,CAAA,EAAA,OAAA;EAAA,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{STORAGE_OUTPUT_TYPE_ID as e,VideoPlugin as t,createTransformNode as n}from"@uploadista/core/flow";import{Effect as r}from"effect";import{UploadistaError as i}from"@uploadista/core/errors";function a(i){return r.gen(function*(){let a=yield*t;return yield*n({id:i,name:`Describe Video`,description:`Extracts video metadata (duration, resolution, codec, etc.)`,nodeTypeId:e,transform:(e,t)=>r.gen(function*(){let n=yield*a.describe(e);return{bytes:e,metadata:{...t.metadata,videoInfo:n}}})})})}function o(i,a){return r.gen(function*(){let o=yield*t;return yield*n({id:i,name:`Resize Video`,description:`Changes video resolution`,nodeTypeId:e,transform:(e,t)=>r.map(o.resize(e,a),e=>({bytes:e}))})})}function s(i,a){return r.gen(function*(){let o=yield*t,s=a.format||`jpeg`;return yield*n({id:i,name:`Generate Thumbnail`,description:`Extracts a frame from video as an image`,nodeTypeId:e,transform:(e,t)=>r.map(o.extractFrame(e,a),e=>{let n=s===`png`?`image/png`:`image/jpeg`,r=s===`png`?`png`:`jpg`,i=t.metadata?.fileName;return{bytes:e,type:n,fileName:i&&typeof i==`string`?i.replace(/\.[^.]+$/,`.${r}`):void 0}})})})}const c={mp4:`video/mp4`,webm:`video/webm`,mov:`video/quicktime`,avi:`video/x-msvideo`},l={mp4:`mp4`,webm:`webm`,mov:`mov`,avi:`avi`};function u(i,a){return r.gen(function*(){let o=yield*t;return yield*n({id:i,name:`Transcode`,description:`Converts video to specified format and codec`,nodeTypeId:e,transform:(e,t)=>r.map(o.transcode(e,a),e=>{let n=c[a.format],r=l[a.format],i=t.metadata?.fileName;return{bytes:e,type:n,fileName:i&&typeof i==`string`?i.replace(/\.[^.]+$/,`.${r}`):void 0}})})})}function d(a,o){return r.gen(function*(){let s=yield*t;return o.endTime!==void 0&&o.endTime<=o.startTime?yield*i.fromCode(`VALIDATION_ERROR`,{body:`endTime must be greater than startTime`,details:{params:o}}).toEffect():o.duration!==void 0&&o.endTime!==void 0&&o.duration!==o.endTime-o.startTime?yield*i.fromCode(`VALIDATION_ERROR`,{body:`Cannot specify both endTime and duration with conflicting values`,details:{params:o}}).toEffect():o.duration!==void 0&&o.duration<=0?yield*i.fromCode(`VALIDATION_ERROR`,{body:`duration must be greater than 0`,details:{params:o}}).toEffect():yield*n({id:a,name:`Trim Video`,description:`Extracts a segment from the video`,nodeTypeId:e,transform:(e,t)=>r.map(s.trim(e,o),e=>({bytes:e}))})})}export{a as createDescribeVideoNode,u as createTranscodeVideoNode,d as createTrimVideoNode,o as createVideoResizeNode,s as createVideoThumbnailNode};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["formatToMimeType: Record<TranscodeVideoParams[\"format\"], string>","formatToExtension: Record<TranscodeVideoParams[\"format\"], string>"],"sources":["../src/describe-video-node.ts","../src/resize-node.ts","../src/thumbnail-node.ts","../src/transcode-node.ts","../src/trim-node.ts"],"sourcesContent":["import { createTransformNode, VideoPlugin } from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n/**\n * Creates a Describe Video metadata extraction node\n *\n * Extracts comprehensive metadata from the video file including duration,\n * resolution, codec, bitrate, and audio information. The metadata is stored\n * in the file context for downstream nodes while passing through the original bytes.\n *\n * @param id - Unique node identifier\n * @returns Effect that resolves to the configured node\n *\n * @example\n * ```typescript\n * const node = yield* createDescribeVideoNode(\"describe-1\");\n * ```\n */\nexport function createDescribeVideoNode(id: string) {\n return Effect.gen(function* () {\n const videoService = yield* VideoPlugin;\n\n return yield* createTransformNode({\n id,\n name: \"Describe Video\",\n description:\n \"Extracts video metadata (duration, resolution, codec, etc.)\",\n transform: (inputBytes, file) =>\n Effect.gen(function* () {\n // Extract metadata\n const metadata = yield* videoService.describe(inputBytes);\n\n // Store metadata in file context for downstream nodes\n return {\n bytes: inputBytes, // Pass through original bytes unchanged\n metadata: {\n ...file.metadata,\n videoInfo: metadata,\n },\n };\n }),\n });\n });\n}\n","import {\n createTransformNode,\n type ResizeVideoParams,\n VideoPlugin,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n/**\n * Creates a Resize video processing node\n *\n * Changes video resolution while optionally maintaining aspect ratio.\n *\n * @param id - Unique node identifier\n * @param params - Resize parameters\n * @returns Effect that resolves to the configured node\n *\n * @example\n * ```typescript\n * const node = yield* createResizeNode(\"resize-1\", {\n * width: 1280,\n * height: 720,\n * aspectRatio: \"keep\",\n * scaling: \"bicubic\"\n * });\n * ```\n */\nexport function createVideoResizeNode(id: string, params: ResizeVideoParams) {\n return Effect.gen(function* () {\n const videoService = yield* VideoPlugin;\n\n return yield* createTransformNode({\n id,\n name: \"Resize Video\",\n description: \"Changes video resolution\",\n transform: (inputBytes, _file) =>\n Effect.map(videoService.resize(inputBytes, params), (resizedBytes) => {\n // Pass through video bytes (no metadata changes needed)\n return {\n bytes: resizedBytes,\n };\n }),\n });\n });\n}\n","import {\n createTransformNode,\n type ExtractFrameVideoParams,\n VideoPlugin,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n/**\n * Creates a Thumbnail generation node\n *\n * Extracts a single frame from the video as an image (JPEG or PNG).\n *\n * @param id - Unique node identifier\n * @param params - Frame extraction parameters\n * @returns Effect that resolves to the configured node\n *\n * @example\n * ```typescript\n * const node = yield* createThumbnailNode(\"thumbnail-1\", {\n * timestamp: 15,\n * format: \"jpeg\",\n * quality: 85\n * });\n * ```\n */\nexport function createVideoThumbnailNode(\n id: string,\n params: ExtractFrameVideoParams,\n) {\n return Effect.gen(function* () {\n const videoService = yield* VideoPlugin;\n\n const format = params.format || \"jpeg\";\n\n return yield* createTransformNode({\n id,\n name: \"Generate Thumbnail\",\n description: \"Extracts a frame from video as an image\",\n transform: (inputBytes, file) =>\n Effect.map(\n videoService.extractFrame(inputBytes, params),\n (imageBytes) => {\n // Map output to image MIME type and extension\n const mimeType = format === \"png\" ? \"image/png\" : \"image/jpeg\";\n const extension = format === \"png\" ? \"png\" : \"jpg\";\n\n // Update file extension\n const fileName = file.metadata?.fileName;\n const newFileName =\n fileName && typeof fileName === \"string\"\n ? fileName.replace(/\\.[^.]+$/, `.${extension}`)\n : undefined;\n\n return {\n bytes: imageBytes,\n type: mimeType,\n fileName: newFileName,\n };\n },\n ),\n });\n });\n}\n","import {\n createTransformNode,\n type TranscodeVideoParams,\n VideoPlugin,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n// Map video format to MIME type\nconst formatToMimeType: Record<TranscodeVideoParams[\"format\"], string> = {\n mp4: \"video/mp4\",\n webm: \"video/webm\",\n mov: \"video/quicktime\",\n avi: \"video/x-msvideo\",\n};\n\n// Map video format to file extension\nconst formatToExtension: Record<TranscodeVideoParams[\"format\"], string> = {\n mp4: \"mp4\",\n webm: \"webm\",\n mov: \"mov\",\n avi: \"avi\",\n};\n\n/**\n * Creates a Transcode video processing node\n *\n * Converts video to specified format and codec, optionally adjusting bitrates.\n *\n * @param id - Unique node identifier\n * @param params - Transcode parameters\n * @returns Effect that resolves to the configured node\n *\n * @example\n * ```typescript\n * const node = yield* createTranscodeNode(\"transcode-1\", {\n * format: \"webm\",\n * codec: \"vp9\",\n * videoBitrate: \"1000k\"\n * });\n * ```\n */\nexport function createTranscodeVideoNode(\n id: string,\n params: TranscodeVideoParams,\n) {\n return Effect.gen(function* () {\n const videoService = yield* VideoPlugin;\n\n return yield* createTransformNode({\n id,\n name: \"Transcode\",\n description: \"Converts video to specified format and codec\",\n transform: (inputBytes, file) =>\n Effect.map(\n videoService.transcode(inputBytes, params),\n (transcodedBytes) => {\n // Update metadata if format changes\n const newType = formatToMimeType[params.format];\n const newExtension = formatToExtension[params.format];\n\n // Update file extension\n const fileName = file.metadata?.fileName;\n const newFileName =\n fileName && typeof fileName === \"string\"\n ? fileName.replace(/\\.[^.]+$/, `.${newExtension}`)\n : undefined;\n\n return {\n bytes: transcodedBytes,\n type: newType,\n fileName: newFileName,\n };\n },\n ),\n });\n });\n}\n","import { UploadistaError } from \"@uploadista/core/errors\";\nimport {\n createTransformNode,\n type TrimVideoParams,\n VideoPlugin,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n/**\n * Creates a Trim video processing node\n *\n * Extracts a segment from the video by time range.\n *\n * @param id - Unique node identifier\n * @param params - Trim parameters\n * @returns Effect that resolves to the configured node\n *\n * @example\n * ```typescript\n * const node = yield* createTrimNode(\"trim-1\", {\n * startTime: 10,\n * endTime: 30\n * });\n *\n * // Or using duration\n * const node2 = yield* createTrimNode(\"trim-2\", {\n * startTime: 10,\n * duration: 20\n * });\n * ```\n */\nexport function createTrimVideoNode(id: string, params: TrimVideoParams) {\n return Effect.gen(function* () {\n const videoService = yield* VideoPlugin;\n\n // Validate params\n if (params.endTime !== undefined && params.endTime <= params.startTime) {\n return yield* UploadistaError.fromCode(\"VALIDATION_ERROR\", {\n body: \"endTime must be greater than startTime\",\n details: { params },\n }).toEffect();\n }\n\n if (\n params.duration !== undefined &&\n params.endTime !== undefined &&\n params.duration !== params.endTime - params.startTime\n ) {\n return yield* UploadistaError.fromCode(\"VALIDATION_ERROR\", {\n body: \"Cannot specify both endTime and duration with conflicting values\",\n details: { params },\n }).toEffect();\n }\n\n if (params.duration !== undefined && params.duration <= 0) {\n return yield* UploadistaError.fromCode(\"VALIDATION_ERROR\", {\n body: \"duration must be greater than 0\",\n details: { params },\n }).toEffect();\n }\n\n return yield* createTransformNode({\n id,\n name: \"Trim Video\",\n description: \"Extracts a segment from the video\",\n transform: (inputBytes, _file) =>\n Effect.map(videoService.trim(inputBytes, params), (trimmedBytes) => {\n // Pass through video bytes\n return {\n bytes: trimmedBytes,\n };\n }),\n });\n });\n}\n"],"mappings":"uKAkBA,SAAgB,EAAwB,EAAY,CAClD,OAAO,EAAO,IAAI,WAAa,CAC7B,IAAM,EAAe,MAAO,EAE5B,OAAO,MAAO,EAAoB,CAChC,KACA,KAAM,iBACN,YACE,8DACF,WAAY,EAAY,IACtB,EAAO,IAAI,WAAa,CAEtB,IAAM,EAAW,MAAO,EAAa,SAAS,EAAW,CAGzD,MAAO,CACL,MAAO,EACP,SAAU,CACR,GAAG,EAAK,SACR,UAAW,EACZ,CACF,EACD,CACL,CAAC,EACF,CChBJ,SAAgB,EAAsB,EAAY,EAA2B,CAC3E,OAAO,EAAO,IAAI,WAAa,CAC7B,IAAM,EAAe,MAAO,EAE5B,OAAO,MAAO,EAAoB,CAChC,KACA,KAAM,eACN,YAAa,2BACb,WAAY,EAAY,IACtB,EAAO,IAAI,EAAa,OAAO,EAAY,EAAO,CAAG,IAE5C,CACL,MAAO,EACR,EACD,CACL,CAAC,EACF,CCjBJ,SAAgB,EACd,EACA,EACA,CACA,OAAO,EAAO,IAAI,WAAa,CAC7B,IAAM,EAAe,MAAO,EAEtB,EAAS,EAAO,QAAU,OAEhC,OAAO,MAAO,EAAoB,CAChC,KACA,KAAM,qBACN,YAAa,0CACb,WAAY,EAAY,IACtB,EAAO,IACL,EAAa,aAAa,EAAY,EAAO,CAC5C,GAAe,CAEd,IAAM,EAAW,IAAW,MAAQ,YAAc,aAC5C,EAAY,IAAW,MAAQ,MAAQ,MAGvC,EAAW,EAAK,UAAU,SAMhC,MAAO,CACL,MAAO,EACP,KAAM,EACN,SAPA,GAAY,OAAO,GAAa,SAC5B,EAAS,QAAQ,WA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N,YAAa,oCACb,WAAY,EAAY,IACtB,EAAO,IAAI,EAAa,KAAK,EAAY,EAAO,CAAG,IAE1C,CACL,MAAO,EACR,EACD,CACL,CAAC,EACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["formatToMimeType: Record<TranscodeVideoParams[\"format\"], string>","formatToExtension: Record<TranscodeVideoParams[\"format\"], string>"],"sources":["../src/describe-video-node.ts","../src/resize-node.ts","../src/thumbnail-node.ts","../src/transcode-node.ts","../src/trim-node.ts"],"sourcesContent":["import {\n createTransformNode,\n STORAGE_OUTPUT_TYPE_ID,\n VideoPlugin,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n/**\n * Creates a Describe Video metadata extraction node\n *\n * Extracts comprehensive metadata from the video file including duration,\n * resolution, codec, bitrate, and audio information. The metadata is stored\n * in the file context for downstream nodes while passing through the original bytes.\n *\n * @param id - Unique node identifier\n * @returns Effect that resolves to the configured node\n *\n * @example\n * ```typescript\n * const node = yield* createDescribeVideoNode(\"describe-1\");\n * ```\n */\nexport function createDescribeVideoNode(id: string) {\n return Effect.gen(function* () {\n const videoService = yield* VideoPlugin;\n\n return yield* createTransformNode({\n id,\n name: \"Describe Video\",\n description:\n \"Extracts video metadata (duration, resolution, codec, etc.)\",\n nodeTypeId: STORAGE_OUTPUT_TYPE_ID,\n transform: (inputBytes, file) =>\n Effect.gen(function* () {\n // Extract metadata\n const metadata = yield* videoService.describe(inputBytes);\n\n // Store metadata in file context for downstream nodes\n return {\n bytes: inputBytes, // Pass through original bytes unchanged\n metadata: {\n ...file.metadata,\n videoInfo: metadata,\n },\n };\n }),\n });\n });\n}\n","import {\n createTransformNode,\n type ResizeVideoParams,\n STORAGE_OUTPUT_TYPE_ID,\n VideoPlugin,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n/**\n * Creates a Resize video processing node\n *\n * Changes video resolution while optionally maintaining aspect ratio.\n *\n * @param id - Unique node identifier\n * @param params - Resize parameters\n * @returns Effect that resolves to the configured node\n *\n * @example\n * ```typescript\n * const node = yield* createResizeNode(\"resize-1\", {\n * width: 1280,\n * height: 720,\n * aspectRatio: \"keep\",\n * scaling: \"bicubic\"\n * });\n * ```\n */\nexport function createVideoResizeNode(id: string, params: ResizeVideoParams) {\n return Effect.gen(function* () {\n const videoService = yield* VideoPlugin;\n\n return yield* createTransformNode({\n id,\n name: \"Resize Video\",\n description: \"Changes video resolution\",\n nodeTypeId: STORAGE_OUTPUT_TYPE_ID,\n transform: (inputBytes, _file) =>\n Effect.map(videoService.resize(inputBytes, params), (resizedBytes) => {\n // Pass through video bytes (no metadata changes needed)\n return {\n bytes: resizedBytes,\n };\n }),\n });\n });\n}\n","import {\n createTransformNode,\n type ExtractFrameVideoParams,\n STORAGE_OUTPUT_TYPE_ID,\n VideoPlugin,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n/**\n * Creates a Thumbnail generation node\n *\n * Extracts a single frame from the video as an image (JPEG or PNG).\n *\n * @param id - Unique node identifier\n * @param params - Frame extraction parameters\n * @returns Effect that resolves to the configured node\n *\n * @example\n * ```typescript\n * const node = yield* createThumbnailNode(\"thumbnail-1\", {\n * timestamp: 15,\n * format: \"jpeg\",\n * quality: 85\n * });\n * ```\n */\nexport function createVideoThumbnailNode(\n id: string,\n params: ExtractFrameVideoParams,\n) {\n return Effect.gen(function* () {\n const videoService = yield* VideoPlugin;\n\n const format = params.format || \"jpeg\";\n\n return yield* createTransformNode({\n id,\n name: \"Generate Thumbnail\",\n description: \"Extracts a frame from video as an image\",\n nodeTypeId: STORAGE_OUTPUT_TYPE_ID,\n transform: (inputBytes, file) =>\n Effect.map(\n videoService.extractFrame(inputBytes, params),\n (imageBytes) => {\n // Map output to image MIME type and extension\n const mimeType = format === \"png\" ? \"image/png\" : \"image/jpeg\";\n const extension = format === \"png\" ? \"png\" : \"jpg\";\n\n // Update file extension\n const fileName = file.metadata?.fileName;\n const newFileName =\n fileName && typeof fileName === \"string\"\n ? fileName.replace(/\\.[^.]+$/, `.${extension}`)\n : undefined;\n\n return {\n bytes: imageBytes,\n type: mimeType,\n fileName: newFileName,\n };\n },\n ),\n });\n });\n}\n","import {\n createTransformNode,\n STORAGE_OUTPUT_TYPE_ID,\n type TranscodeVideoParams,\n VideoPlugin,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n// Map video format to MIME type\nconst formatToMimeType: Record<TranscodeVideoParams[\"format\"], string> = {\n mp4: \"video/mp4\",\n webm: \"video/webm\",\n mov: \"video/quicktime\",\n avi: \"video/x-msvideo\",\n};\n\n// Map video format to file extension\nconst formatToExtension: Record<TranscodeVideoParams[\"format\"], string> = {\n mp4: \"mp4\",\n webm: \"webm\",\n mov: \"mov\",\n avi: \"avi\",\n};\n\n/**\n * Creates a Transcode video processing node\n *\n * Converts video to specified format and codec, optionally adjusting bitrates.\n *\n * @param id - Unique node identifier\n * @param params - Transcode parameters\n * @returns Effect that resolves to the configured node\n *\n * @example\n * ```typescript\n * const node = yield* createTranscodeNode(\"transcode-1\", {\n * format: \"webm\",\n * codec: \"vp9\",\n * videoBitrate: \"1000k\"\n * });\n * ```\n */\nexport function createTranscodeVideoNode(\n id: string,\n params: TranscodeVideoParams,\n) {\n return Effect.gen(function* () {\n const videoService = yield* VideoPlugin;\n\n return yield* createTransformNode({\n id,\n name: \"Transcode\",\n description: \"Converts video to specified format and codec\",\n nodeTypeId: STORAGE_OUTPUT_TYPE_ID,\n transform: (inputBytes, file) =>\n Effect.map(\n videoService.transcode(inputBytes, params),\n (transcodedBytes) => {\n // Update metadata if format changes\n const newType = formatToMimeType[params.format];\n const newExtension = formatToExtension[params.format];\n\n // Update file extension\n const fileName = file.metadata?.fileName;\n const newFileName =\n fileName && typeof fileName === \"string\"\n ? fileName.replace(/\\.[^.]+$/, `.${newExtension}`)\n : undefined;\n\n return {\n bytes: transcodedBytes,\n type: newType,\n fileName: newFileName,\n };\n },\n ),\n });\n });\n}\n","import { UploadistaError } from \"@uploadista/core/errors\";\nimport {\n createTransformNode,\n STORAGE_OUTPUT_TYPE_ID,\n type TrimVideoParams,\n VideoPlugin,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n/**\n * Creates a Trim video processing node\n *\n * Extracts a segment from the video by time range.\n *\n * @param id - Unique node identifier\n * @param params - Trim parameters\n * @returns Effect that resolves to the configured node\n *\n * @example\n * ```typescript\n * const node = yield* createTrimNode(\"trim-1\", {\n * startTime: 10,\n * endTime: 30\n * });\n *\n * // Or using duration\n * const node2 = yield* createTrimNode(\"trim-2\", {\n * startTime: 10,\n * duration: 20\n * });\n * ```\n */\nexport function createTrimVideoNode(id: string, params: TrimVideoParams) {\n return Effect.gen(function* () {\n const videoService = yield* VideoPlugin;\n\n // Validate params\n if (params.endTime !== undefined && params.endTime <= params.startTime) {\n return yield* UploadistaError.fromCode(\"VALIDATION_ERROR\", {\n body: \"endTime must be greater than startTime\",\n details: { params },\n }).toEffect();\n }\n\n if (\n params.duration !== undefined &&\n params.endTime !== undefined &&\n params.duration !== params.endTime - params.startTime\n ) {\n return yield* UploadistaError.fromCode(\"VALIDATION_ERROR\", {\n body: \"Cannot specify both endTime and duration with conflicting values\",\n details: { params },\n }).toEffect();\n }\n\n if (params.duration !== undefined && params.duration <= 0) {\n return yield* UploadistaError.fromCode(\"VALIDATION_ERROR\", {\n body: \"duration must be greater than 0\",\n details: { params },\n }).toEffect();\n }\n\n return yield* createTransformNode({\n id,\n name: \"Trim Video\",\n description: \"Extracts a segment from the video\",\n nodeTypeId: STORAGE_OUTPUT_TYPE_ID,\n transform: (inputBytes, _file) =>\n Effect.map(videoService.trim(inputBytes, params), (trimmedBytes) => {\n // Pass through video bytes\n return {\n bytes: trimmedBytes,\n };\n }),\n });\n });\n}\n"],"mappings":"mMAsBA,SAAgB,EAAwB,EAAY,CAClD,OAAO,EAAO,IAAI,WAAa,CAC7B,IAAM,EAAe,MAAO,EAE5B,OAAO,MAAO,EAAoB,CAChC,KACA,KAAM,iBACN,YACE,8DAC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EACZ,WAAY,EAAY,IACtB,EAAO,IACL,EAAa,UAAU,EAAY,EAAO,CACzC,GAAoB,CAEnB,IAAM,EAAU,EAAiB,EAAO,QAClC,EAAe,EAAkB,EAAO,QAGxC,EAAW,EAAK,UAAU,SAMhC,MAAO,CACL,MAAO,EACP,KAAM,EACN,SAPA,GAAY,OAAO,GAAa,SAC5B,EAAS,QAAQ,WAAY,IAAI,IAAe,CAChD,IAAA,GAML,EAEJ,CACJ,CAAC,EACF,CC7CJ,SAAgB,EAAoB,EAAY,EAAyB,CACvE,OAAO,EAAO,IAAI,WAAa,CAC7B,IAAM,EAAe,MAAO,EA4B5B,OAzBI,EAAO,UAAY,IAAA,IAAa,EAAO,SAAW,EAAO,UACpD,MAAO,EAAgB,SAAS,mBAAoB,CACzD,KAAM,yCACN,QAAS,CAAE,SAAQ,CACpB,CAAC,CAAC,UAAU,CAIb,EAAO,WAAa,IAAA,IACpB,EAAO,UAAY,IAAA,IACnB,EAAO,WAAa,EAAO,QAAU,EAAO,UAErC,MAAO,EAAgB,SAAS,mBAAoB,CACzD,KAAM,mEACN,QAAS,CAAE,SAAQ,CACpB,CAAC,CAAC,UAAU,CAGX,EAAO,WAAa,IAAA,IAAa,EAAO,UAAY,EAC/C,MAAO,EAAgB,SAAS,mBAAoB,CACzD,KAAM,kCACN,QAAS,CAAE,SAAQ,CACpB,CAAC,CAAC,UAAU,CAGR,MAAO,EAAoB,CAChC,KACA,KAAM,aACN,YAAa,oCACb,WAAY,EACZ,WAAY,EAAY,IACtB,EAAO,IAAI,EAAa,KAAK,EAAY,EAAO,CAAG,IAE1C,CACL,MAAO,EACR,EACD,CACL,CAAC,EACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadista/flow-videos-nodes",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.17-beta.2",
|
|
5
5
|
"description": "Video processing nodes for Uploadista Flow",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Uploadista",
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"effect": "3.19.4",
|
|
18
18
|
"zod": "4.1.12",
|
|
19
|
-
"@uploadista/core": "0.0.
|
|
19
|
+
"@uploadista/core": "0.0.17-beta.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@effect/vitest": "0.27.0",
|
|
23
23
|
"@types/node": "24.10.1",
|
|
24
24
|
"tsdown": "0.16.5",
|
|
25
|
-
"vitest": "4.0.
|
|
26
|
-
"@uploadista/typescript-config": "0.0.
|
|
25
|
+
"vitest": "4.0.10",
|
|
26
|
+
"@uploadista/typescript-config": "0.0.17-beta.2"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "tsdown",
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTransformNode,
|
|
3
|
+
STORAGE_OUTPUT_TYPE_ID,
|
|
4
|
+
VideoPlugin,
|
|
5
|
+
} from "@uploadista/core/flow";
|
|
2
6
|
import { Effect } from "effect";
|
|
3
7
|
|
|
4
8
|
/**
|
|
@@ -25,6 +29,7 @@ export function createDescribeVideoNode(id: string) {
|
|
|
25
29
|
name: "Describe Video",
|
|
26
30
|
description:
|
|
27
31
|
"Extracts video metadata (duration, resolution, codec, etc.)",
|
|
32
|
+
nodeTypeId: STORAGE_OUTPUT_TYPE_ID,
|
|
28
33
|
transform: (inputBytes, file) =>
|
|
29
34
|
Effect.gen(function* () {
|
|
30
35
|
// Extract metadata
|
package/src/resize-node.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTransformNode,
|
|
3
3
|
type ResizeVideoParams,
|
|
4
|
+
STORAGE_OUTPUT_TYPE_ID,
|
|
4
5
|
VideoPlugin,
|
|
5
6
|
} from "@uploadista/core/flow";
|
|
6
7
|
import { Effect } from "effect";
|
|
@@ -32,6 +33,7 @@ export function createVideoResizeNode(id: string, params: ResizeVideoParams) {
|
|
|
32
33
|
id,
|
|
33
34
|
name: "Resize Video",
|
|
34
35
|
description: "Changes video resolution",
|
|
36
|
+
nodeTypeId: STORAGE_OUTPUT_TYPE_ID,
|
|
35
37
|
transform: (inputBytes, _file) =>
|
|
36
38
|
Effect.map(videoService.resize(inputBytes, params), (resizedBytes) => {
|
|
37
39
|
// Pass through video bytes (no metadata changes needed)
|
package/src/thumbnail-node.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTransformNode,
|
|
3
3
|
type ExtractFrameVideoParams,
|
|
4
|
+
STORAGE_OUTPUT_TYPE_ID,
|
|
4
5
|
VideoPlugin,
|
|
5
6
|
} from "@uploadista/core/flow";
|
|
6
7
|
import { Effect } from "effect";
|
|
@@ -36,6 +37,7 @@ export function createVideoThumbnailNode(
|
|
|
36
37
|
id,
|
|
37
38
|
name: "Generate Thumbnail",
|
|
38
39
|
description: "Extracts a frame from video as an image",
|
|
40
|
+
nodeTypeId: STORAGE_OUTPUT_TYPE_ID,
|
|
39
41
|
transform: (inputBytes, file) =>
|
|
40
42
|
Effect.map(
|
|
41
43
|
videoService.extractFrame(inputBytes, params),
|
package/src/transcode-node.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTransformNode,
|
|
3
|
+
STORAGE_OUTPUT_TYPE_ID,
|
|
3
4
|
type TranscodeVideoParams,
|
|
4
5
|
VideoPlugin,
|
|
5
6
|
} from "@uploadista/core/flow";
|
|
@@ -50,6 +51,7 @@ export function createTranscodeVideoNode(
|
|
|
50
51
|
id,
|
|
51
52
|
name: "Transcode",
|
|
52
53
|
description: "Converts video to specified format and codec",
|
|
54
|
+
nodeTypeId: STORAGE_OUTPUT_TYPE_ID,
|
|
53
55
|
transform: (inputBytes, file) =>
|
|
54
56
|
Effect.map(
|
|
55
57
|
videoService.transcode(inputBytes, params),
|
package/src/trim-node.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UploadistaError } from "@uploadista/core/errors";
|
|
2
2
|
import {
|
|
3
3
|
createTransformNode,
|
|
4
|
+
STORAGE_OUTPUT_TYPE_ID,
|
|
4
5
|
type TrimVideoParams,
|
|
5
6
|
VideoPlugin,
|
|
6
7
|
} from "@uploadista/core/flow";
|
|
@@ -63,6 +64,7 @@ export function createTrimVideoNode(id: string, params: TrimVideoParams) {
|
|
|
63
64
|
id,
|
|
64
65
|
name: "Trim Video",
|
|
65
66
|
description: "Extracts a segment from the video",
|
|
67
|
+
nodeTypeId: STORAGE_OUTPUT_TYPE_ID,
|
|
66
68
|
transform: (inputBytes, _file) =>
|
|
67
69
|
Effect.map(videoService.trim(inputBytes, params), (trimmedBytes) => {
|
|
68
70
|
// Pass through video bytes
|