@umituz/web-cloudflare 1.0.1

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.
Files changed (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +621 -0
  3. package/package.json +87 -0
  4. package/src/config/patterns.ts +469 -0
  5. package/src/config/types.ts +648 -0
  6. package/src/domain/entities/analytics.entity.ts +47 -0
  7. package/src/domain/entities/d1.entity.ts +37 -0
  8. package/src/domain/entities/image.entity.ts +48 -0
  9. package/src/domain/entities/index.ts +11 -0
  10. package/src/domain/entities/kv.entity.ts +34 -0
  11. package/src/domain/entities/r2.entity.ts +55 -0
  12. package/src/domain/entities/worker.entity.ts +35 -0
  13. package/src/domain/index.ts +7 -0
  14. package/src/domain/interfaces/index.ts +6 -0
  15. package/src/domain/interfaces/services.interface.ts +82 -0
  16. package/src/index.ts +53 -0
  17. package/src/infrastructure/constants/index.ts +13 -0
  18. package/src/infrastructure/domain/ai-gateway.entity.ts +169 -0
  19. package/src/infrastructure/domain/workflows.entity.ts +108 -0
  20. package/src/infrastructure/middleware/index.ts +405 -0
  21. package/src/infrastructure/router/index.ts +549 -0
  22. package/src/infrastructure/services/ai-gateway/index.ts +416 -0
  23. package/src/infrastructure/services/analytics/analytics.service.ts +189 -0
  24. package/src/infrastructure/services/analytics/index.ts +7 -0
  25. package/src/infrastructure/services/d1/d1.service.ts +191 -0
  26. package/src/infrastructure/services/d1/index.ts +7 -0
  27. package/src/infrastructure/services/images/images.service.ts +227 -0
  28. package/src/infrastructure/services/images/index.ts +7 -0
  29. package/src/infrastructure/services/kv/index.ts +7 -0
  30. package/src/infrastructure/services/kv/kv.service.ts +116 -0
  31. package/src/infrastructure/services/r2/index.ts +7 -0
  32. package/src/infrastructure/services/r2/r2.service.ts +164 -0
  33. package/src/infrastructure/services/workers/index.ts +7 -0
  34. package/src/infrastructure/services/workers/workers.service.ts +164 -0
  35. package/src/infrastructure/services/workflows/index.ts +437 -0
  36. package/src/infrastructure/utils/helpers.ts +732 -0
  37. package/src/infrastructure/utils/index.ts +6 -0
  38. package/src/infrastructure/utils/utils.util.ts +150 -0
  39. package/src/presentation/hooks/cloudflare.hooks.ts +314 -0
  40. package/src/presentation/hooks/index.ts +6 -0
  41. package/src/worker.example.ts +41 -0
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Image Entity
3
+ * @description Cloudflare Images configuration and types
4
+ */
5
+
6
+ export interface ImageConfig {
7
+ readonly account: string;
8
+ readonly customDomain?: string;
9
+ }
10
+
11
+ export interface ImageVariant {
12
+ readonly variant: string;
13
+ readonly width?: number;
14
+ readonly height?: number;
15
+ readonly fit?: "scale-down" | "contain" | "cover" | "crop" | "pad";
16
+ readonly format?: "jpeg" | "png" | "gif" | "webp" | "avif";
17
+ readonly quality?: number;
18
+ }
19
+
20
+ export interface ImageUploadResult {
21
+ readonly id: string;
22
+ readonly filename: string;
23
+ readonly uploaded: Date;
24
+ readonly variants: readonly string[];
25
+ readonly requireSignedURLs: boolean;
26
+ }
27
+
28
+ export interface ImageUploadOptions {
29
+ readonly metadata?: Record<string, string>;
30
+ readonly requireSignedURLs?: boolean;
31
+ readonly variants?: readonly ImageVariant[];
32
+ }
33
+
34
+ export interface ImageTransformation {
35
+ readonly width?: number;
36
+ readonly height?: number;
37
+ readonly fit?: "scale-down" | "contain" | "cover" | "crop" | "pad";
38
+ readonly format?: "jpeg" | "png" | "gif" | "webp" | "avif";
39
+ readonly quality?: number;
40
+ readonly rotate?: number;
41
+ readonly flip?: boolean;
42
+ readonly flop?: boolean;
43
+ }
44
+
45
+ export interface SignedURL {
46
+ readonly url: string;
47
+ readonly expiresAt: Date;
48
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Cloudflare Domain Entities
3
+ * Subpath: @umituz/web-cloudflare/domain
4
+ */
5
+
6
+ export type { WorkerConfig, WorkerResponse, WorkerRequest } from "./worker.entity";
7
+ export type { KVNamespaceConfig, KVEntry } from "./kv.entity";
8
+ export type { R2BucketConfig, R2Object, R2UploadResult } from "./r2.entity";
9
+ export type { D1DatabaseConfig, D1QueryResult } from "./d1.entity";
10
+ export type { ImageConfig, ImageVariant } from "./image.entity";
11
+ export type { AnalyticsConfig, AnalyticsEvent } from "./analytics.entity";
@@ -0,0 +1,34 @@
1
+ /**
2
+ * KV Entity
3
+ * @description Cloudflare KV configuration and types
4
+ */
5
+
6
+ export interface KVNamespaceConfig {
7
+ readonly namespace: string;
8
+ readonly ttl?: number;
9
+ }
10
+
11
+ export interface KVEntry<T = unknown> {
12
+ readonly key: string;
13
+ readonly value: T;
14
+ readonly metadata?: Record<string, unknown>;
15
+ readonly expiration?: number;
16
+ }
17
+
18
+ export interface KVListOptions {
19
+ readonly limit?: number;
20
+ readonly cursor?: string;
21
+ readonly prefix?: string;
22
+ }
23
+
24
+ export interface KVListResult {
25
+ readonly keys: readonly KVKey[];
26
+ readonly list_complete: boolean;
27
+ readonly cursor?: string;
28
+ }
29
+
30
+ export interface KVKey {
31
+ readonly name: string;
32
+ readonly metadata?: Record<string, unknown>;
33
+ readonly expiration?: number;
34
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * R2 Entity
3
+ * @description Cloudflare R2 storage configuration and types
4
+ */
5
+
6
+ export interface R2BucketConfig {
7
+ readonly bucket: string;
8
+ readonly customDomain?: string;
9
+ }
10
+
11
+ export interface R2Object {
12
+ readonly key: string;
13
+ readonly size: number;
14
+ readonly uploaded: Date;
15
+ readonly httpMetadata?: R2HTTPMetadata;
16
+ readonly customMetadata?: Record<string, string>;
17
+ }
18
+
19
+ export interface R2HTTPMetadata {
20
+ readonly contentType?: string;
21
+ readonly cacheControl?: string;
22
+ readonly contentEncoding?: string;
23
+ readonly contentLanguage?: string;
24
+ readonly cacheExpiry?: Date;
25
+ }
26
+
27
+ export interface R2UploadResult {
28
+ readonly key: string;
29
+ readonly size: number;
30
+ readonly etag?: string;
31
+ readonly version?: string;
32
+ }
33
+
34
+ export interface R2ListOptions {
35
+ readonly limit?: number;
36
+ readonly prefix?: string;
37
+ readonly cursor?: string;
38
+ }
39
+
40
+ export interface R2ListResult {
41
+ readonly objects: readonly R2Object[];
42
+ readonly truncated: boolean;
43
+ readonly cursor?: string;
44
+ }
45
+
46
+ export interface R2PutOptions {
47
+ readonly httpMetadata?: R2HTTPMetadata;
48
+ readonly customMetadata?: Record<string, string>;
49
+ readonly checksum?: string;
50
+ }
51
+
52
+ export interface R2PresignedURL {
53
+ readonly url: string;
54
+ readonly expiresAt: Date;
55
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Worker Entity
3
+ * @description Cloudflare Worker configuration and types
4
+ */
5
+
6
+ export interface WorkerRequest extends Request {
7
+ cf?: IncomingRequestCfProperties;
8
+ }
9
+
10
+ export interface WorkerResponse extends Response {
11
+ waitUntil?: (promise: Promise<unknown>) => void;
12
+ }
13
+
14
+ export interface WorkerConfig {
15
+ readonly name: string;
16
+ readonly routes?: string[];
17
+ readonly schedule?: string;
18
+ readonly bindings?: WorkerBindings;
19
+ }
20
+
21
+ export interface WorkerBindings {
22
+ readonly kv?: Record<string, KVNamespace>;
23
+ readonly r2?: Record<string, R2Bucket>;
24
+ readonly d1?: Record<string, D1Database>;
25
+ readonly env?: Record<string, string>;
26
+ }
27
+
28
+ export interface IncomingRequestCfProperties {
29
+ readonly colo?: string;
30
+ readonly country?: string;
31
+ readonly httpProtocol?: string;
32
+ readonly requestPriority?: string;
33
+ readonly tlsVersion?: string;
34
+ readonly tlsCipher?: string;
35
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Domain Layer
3
+ * Subpath: @umituz/web-cloudflare/domain
4
+ */
5
+
6
+ export * from "./entities";
7
+ export * from "./interfaces";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Cloudflare Domain Interfaces
3
+ * Subpath: @umituz/web-cloudflare/domain
4
+ */
5
+
6
+ export type { IWorkerService, IKVService, IR2Service, ID1Service, IImageService, IAnalyticsService } from "./services.interface";
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Service Interfaces
3
+ * @description Abstract interfaces for Cloudflare services
4
+ */
5
+
6
+ import type { WorkerRequest, WorkerResponse } from "../entities/worker.entity";
7
+ import type { KVEntry, KVListOptions, KVListResult } from "../entities/kv.entity";
8
+ import type { R2Object, R2ListOptions, R2ListResult, R2PutOptions, R2PresignedURL } from "../entities/r2.entity";
9
+ import type { D1QueryResult, D1BatchResult } from "../entities/d1.entity";
10
+ import type { ImageUploadResult, ImageUploadOptions, ImageTransformation, SignedURL } from "../entities/image.entity";
11
+ import type { AnalyticsEvent, AnalyticsData } from "../entities/analytics.entity";
12
+
13
+ /**
14
+ * Worker Service Interface
15
+ */
16
+ export interface IWorkerService {
17
+ fetch(request: WorkerRequest, env?: Env): Promise<WorkerResponse>;
18
+ scheduled(event: ScheduledEvent, env?: Env): Promise<void>;
19
+ }
20
+
21
+ /**
22
+ * KV Service Interface
23
+ */
24
+ export interface IKVService {
25
+ get<T>(key: string): Promise<T | null>;
26
+ put<T>(key: string, value: T, options?: { ttl?: number }): Promise<void>;
27
+ delete(key: string): Promise<boolean>;
28
+ list(options?: KVListOptions): Promise<KVListResult>;
29
+ }
30
+
31
+ /**
32
+ * R2 Service Interface
33
+ */
34
+ export interface IR2Service {
35
+ get(key: string): Promise<R2Object | null>;
36
+ put(key: string, data: ReadableStream | ArrayBuffer | string, options?: R2PutOptions): Promise<void>;
37
+ delete(key: string): Promise<boolean>;
38
+ list(options?: R2ListOptions): Promise<R2ListResult>;
39
+ getPresignedURL(key: string, expiresIn?: number): Promise<R2PresignedURL>;
40
+ }
41
+
42
+ /**
43
+ * D1 Service Interface
44
+ */
45
+ export interface ID1Service {
46
+ query<T>(sql: string, params?: readonly unknown[]): Promise<D1QueryResult<T>>;
47
+ batch(statements: readonly { sql: string; params?: readonly unknown[] }[]): Promise<D1BatchResult>;
48
+ execute<T>(sql: string, params?: readonly unknown[]): Promise<D1QueryResult<T>>;
49
+ }
50
+
51
+ /**
52
+ * Image Service Interface
53
+ */
54
+ export interface IImageService {
55
+ upload(file: File | Blob, options?: ImageUploadOptions): Promise<ImageUploadResult>;
56
+ getSignedURL(imageId: string, expiresIn?: number): Promise<SignedURL>;
57
+ getTransformedURL(imageId: string, transform: ImageTransformation): Promise<string>;
58
+ delete(imageId: string): Promise<boolean>;
59
+ }
60
+
61
+ /**
62
+ * Analytics Service Interface
63
+ */
64
+ export interface IAnalyticsService {
65
+ trackEvent(event: AnalyticsEvent): Promise<void>;
66
+ trackPageview(url: string, title: string, referrer?: string): Promise<void>;
67
+ getAnalytics(): Promise<AnalyticsData>;
68
+ }
69
+
70
+ /**
71
+ * Environment types
72
+ */
73
+ export interface Env {
74
+ readonly KV?: Record<string, KVNamespace>;
75
+ readonly R2?: Record<string, R2Bucket>;
76
+ readonly D1?: Record<string, D1Database>;
77
+ }
78
+
79
+ export interface ScheduledEvent {
80
+ readonly scheduledTime: number;
81
+ readonly cron: string;
82
+ }
package/src/index.ts ADDED
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @umituz/web-cloudflare
3
+ * Comprehensive Cloudflare Workers integration with config-based patterns
4
+ *
5
+ * ONEMLI: App'ler bu root barrel'i kullanMAMALI.
6
+ * Subpath import kullanin: "@umituz/web-cloudflare/workers"
7
+ *
8
+ * Available subpath exports:
9
+ * - ./workers - Workers service
10
+ * - ./kv - KV cache service
11
+ * - ./r2 - R2 storage service
12
+ * - ./d1 - D1 database service
13
+ * - ./images - Images optimization service
14
+ * - ./analytics - Analytics service
15
+ * - ./workflows - Workflows orchestration service
16
+ * - ./ai-gateway - AI Gateway service
17
+ * - ./workers-ai - Workers AI service
18
+ * - ./router - Express-like router
19
+ * - ./middleware - Middleware collection
20
+ * - ./utils - Utility helpers
21
+ * - ./helpers - Helper functions (alias for ./utils)
22
+ * - ./config - Configuration patterns
23
+ * - ./patterns - Configuration patterns (alias for ./config)
24
+ * - ./types - TypeScript types
25
+ * - ./domain - Domain entities
26
+ */
27
+
28
+ // Domain entities
29
+ export * from "./domain/entities";
30
+ export * from "./domain/interfaces";
31
+
32
+ // Infrastructure services
33
+ export * from "./infrastructure/services/workers";
34
+ export * from "./infrastructure/services/kv";
35
+ export * from "./infrastructure/services/r2";
36
+ export * from "./infrastructure/services/d1";
37
+ export * from "./infrastructure/services/images";
38
+ export * from "./infrastructure/services/analytics";
39
+ export * from "./infrastructure/services/workflows";
40
+ export * from "./infrastructure/services/ai-gateway";
41
+
42
+ // Infrastructure - Router, Middleware, Utils
43
+ export * from "./infrastructure/router";
44
+ export * from "./infrastructure/middleware";
45
+ export * from "./infrastructure/utils/helpers";
46
+ export * from "./infrastructure/constants";
47
+
48
+ // Config - Patterns and Types
49
+ export * from "./config/patterns";
50
+ export * from "./config/types";
51
+
52
+ // Presentation hooks
53
+ export * from "./presentation/hooks";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Cloudflare Constants
3
+ * Subpath: @umituz/web-cloudflare/infrastructure
4
+ */
5
+
6
+ export const DEFAULT_TTL = 3600; // 1 hour in seconds
7
+ export const MAX_CACHE_AGE = 5184000; // 60 days in seconds
8
+ export const DEFAULT_KV_LIMIT = 1000;
9
+ export const DEFAULT_R2_UPLOAD_TIMEOUT = 30000; // 30 seconds
10
+ export const DEFAULT_SIGNED_URL_EXPIRATION = 3600; // 1 hour
11
+ export const MAX_IMAGE_SIZE = 10 * 1024 * 1024; // 10MB
12
+ export const ALLOWED_IMAGE_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp", "image/avif"] as const;
13
+ export const CLOUDFLARE_API_ENDPOINT = "https://api.cloudflare.com/client/v4";
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Cloudflare AI Gateway Domain Entity
3
+ * @description AI Gateway for routing, caching, and analytics
4
+ */
5
+
6
+ export interface AIGatewayConfig {
7
+ gatewayId: string;
8
+ providers: AIProvider[];
9
+ cacheEnabled?: boolean;
10
+ cacheTTL?: number; // seconds
11
+ rateLimiting?: boolean;
12
+ analytics?: boolean;
13
+ }
14
+
15
+ export interface AIProvider {
16
+ id: string;
17
+ name: string;
18
+ type: 'workers-ai' | 'openai' | 'anthropic' | 'cohere' | 'custom';
19
+ baseURL: string;
20
+ apiKey: string;
21
+ models: string[];
22
+ fallbackProvider?: string;
23
+ weight?: number; // For load balancing
24
+ }
25
+
26
+ export interface AIRequest {
27
+ provider: string;
28
+ model: string;
29
+ prompt: string;
30
+ parameters?: AIParameters;
31
+ stream?: boolean;
32
+ cacheKey?: string;
33
+ }
34
+
35
+ export interface AIParameters {
36
+ temperature?: number;
37
+ maxTokens?: number;
38
+ topP?: number;
39
+ topK?: number;
40
+ stopSequences?: string[];
41
+ responseFormat?: 'text' | 'json' | 'json_object';
42
+ metadata?: Record<string, unknown>;
43
+ }
44
+
45
+ export interface AIResponse {
46
+ id: string;
47
+ provider: string;
48
+ model: string;
49
+ content: string;
50
+ usage: {
51
+ promptTokens: number;
52
+ completionTokens: number;
53
+ totalTokens: number;
54
+ };
55
+ cached: boolean;
56
+ timestamp: number;
57
+ }
58
+
59
+ export interface AIAnalytics {
60
+ totalRequests: number;
61
+ totalTokens: number;
62
+ cacheHitRate: number;
63
+ averageResponseTime: number;
64
+ providerUsage: Record<string, number>;
65
+ errorRate: number;
66
+ }
67
+
68
+ // Workers AI specific models
69
+ export interface WorkersAIModel {
70
+ id: string;
71
+ name: string;
72
+ type: 'text-generation' | 'image-generation' | 'embedding' | 'translation' | 'classification';
73
+ contextWindow?: number;
74
+ pricing?: {
75
+ inputPrice: number; // per 1M tokens
76
+ outputPrice: number; // per 1M tokens
77
+ };
78
+ }
79
+
80
+ export interface WorkersAIRequest {
81
+ model: string;
82
+ inputs: WorkersAIInputs;
83
+ }
84
+
85
+ export interface WorkersAIInputs {
86
+ text_generation?: {
87
+ prompt: string;
88
+ max_tokens?: number;
89
+ temperature?: number;
90
+ top_p?: number;
91
+ top_k?: number;
92
+ frequency_penalty?: number;
93
+ presence_penalty?: number;
94
+ stop_sequences?: string[];
95
+ };
96
+ image_generation?: {
97
+ prompt: string;
98
+ width?: number;
99
+ height?: number;
100
+ steps?: number;
101
+ seed?: number;
102
+ };
103
+ embedding?: {
104
+ text: string;
105
+ model?: string;
106
+ };
107
+ translation?: {
108
+ text: string;
109
+ source_lang: string;
110
+ target_lang: string;
111
+ };
112
+ }
113
+
114
+ export interface WorkersAIResponse {
115
+ success: boolean;
116
+ data?: {
117
+ output?: string | string[];
118
+ embedding?: number[];
119
+ image?: string; // base64
120
+ };
121
+ error?: string;
122
+ model: string;
123
+ }
124
+
125
+ // Available Workers AI models
126
+ export const WORKERS_AI_MODELS: Record<string, WorkersAIModel> = {
127
+ '@cf/meta/llama-3.1-8b-instruct': {
128
+ id: '@cf/meta/llama-3.1-8b-instruct',
129
+ name: 'Llama 3.1 8B Instruct',
130
+ type: 'text-generation',
131
+ contextWindow: 128000,
132
+ },
133
+ '@cf/mistral/mistral-7b-instruct': {
134
+ id: '@cf/mistral/mistral-7b-instruct',
135
+ name: 'Mistral 7B Instruct',
136
+ type: 'text-generation',
137
+ contextWindow: 8192,
138
+ },
139
+ '@cf/qwen/qwen2-7b-instruct': {
140
+ id: '@cf/qwen/qwen2-7b-instruct',
141
+ name: 'Qwen2 7B Instruct',
142
+ type: 'text-generation',
143
+ contextWindow: 32768,
144
+ },
145
+ '@cf/google/deeplab-v3-plus': {
146
+ id: '@cf/google/deeplab-v3-plus',
147
+ name: 'DeepLab V3+',
148
+ type: 'classification',
149
+ },
150
+ '@cf/openai/clip-vit-base-patch32': {
151
+ id: '@cf/openai/clip-vit-base-patch32',
152
+ name: 'CLIP ViT Base',
153
+ type: 'embedding',
154
+ },
155
+ };
156
+
157
+ // Emotion control for script generation (from voice cloning app)
158
+ export interface EmotionControl {
159
+ emotion: 'neutral' | 'happy' | 'sad' | 'angry' | 'excited' | 'calm' | 'surprised';
160
+ intensity: number; // 0-1
161
+ }
162
+
163
+ export interface ScriptGenerationRequest {
164
+ topic: string;
165
+ emotion: EmotionControl;
166
+ duration: number; // seconds
167
+ style?: 'formal' | 'casual' | 'enthusiastic' | 'professional';
168
+ keywords?: string[];
169
+ }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Cloudflare Workflows Domain Entity
3
+ * @description Workflow types for long-running, retryable operations
4
+ */
5
+
6
+ export interface WorkflowDefinition {
7
+ id: string;
8
+ name: string;
9
+ description: string;
10
+ version: string;
11
+ steps: WorkflowStep[];
12
+ retryConfig?: RetryConfig;
13
+ timeout?: number; // seconds
14
+ }
15
+
16
+ export interface WorkflowStep {
17
+ id: string;
18
+ name: string;
19
+ handler: string; // Function name to execute
20
+ inputs?: Record<string, unknown>;
21
+ outputs?: Record<string, unknown>;
22
+ retryPolicy?: StepRetryPolicy;
23
+ timeout?: number; // seconds
24
+ dependencies?: string[]; // Step IDs that must complete first
25
+ }
26
+
27
+ export interface StepRetryPolicy {
28
+ maxAttempts: number;
29
+ backoffMultiplier: number;
30
+ initialDelay: number; // milliseconds
31
+ maxDelay: number; // milliseconds
32
+ }
33
+
34
+ export interface RetryConfig {
35
+ maxRetries: number;
36
+ backoffMultiplier: number;
37
+ initialDelay: number;
38
+ maxDelay: number;
39
+ }
40
+
41
+ export interface WorkflowExecution {
42
+ id: string;
43
+ workflowId: string;
44
+ status: 'pending' | 'running' | 'completed' | 'failed' | 'retrying';
45
+ currentStep?: string;
46
+ completedSteps: string[];
47
+ failedSteps: string[];
48
+ inputs: Record<string, unknown>;
49
+ outputs?: Record<string, unknown>;
50
+ error?: string;
51
+ startedAt: number;
52
+ completedAt?: number;
53
+ retryCount: number;
54
+ }
55
+
56
+ export interface WorkflowInstanceState {
57
+ executionId: string;
58
+ stepId: string;
59
+ data: Record<string, unknown>;
60
+ timestamp: number;
61
+ }
62
+
63
+ // Predefined workflow templates
64
+ export interface WorkflowTemplate {
65
+ type: 'media-processing' | 'batch-operations' | 'ai-generation' | 'scheduled-tasks';
66
+ definition: Partial<WorkflowDefinition>;
67
+ }
68
+
69
+ export interface MediaProcessingWorkflow {
70
+ inputs: {
71
+ mediaUrl: string;
72
+ operations: Array<{
73
+ type: 'transcode' | 'optimize' | 'thumbnail' | 'analyze';
74
+ params?: Record<string, unknown>;
75
+ }>;
76
+ };
77
+ outputs: {
78
+ processedUrls: string[];
79
+ metadata?: Record<string, unknown>;
80
+ };
81
+ }
82
+
83
+ export interface AIGenerationWorkflow {
84
+ inputs: {
85
+ prompt: string;
86
+ model: string;
87
+ parameters?: Record<string, unknown>;
88
+ };
89
+ outputs: {
90
+ result: string;
91
+ tokens: number;
92
+ model: string;
93
+ };
94
+ }
95
+
96
+ export interface BatchOperationWorkflow {
97
+ inputs: {
98
+ operation: string;
99
+ items: unknown[];
100
+ batchSize?: number;
101
+ parallelism?: number;
102
+ };
103
+ outputs: {
104
+ successful: number;
105
+ failed: number;
106
+ results: unknown[];
107
+ };
108
+ }