@umituz/web-cloudflare 1.4.3 → 1.4.4

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 (24) hide show
  1. package/README.md +24 -29
  2. package/package.json +5 -5
  3. package/src/domains/analytics/index.ts +13 -0
  4. package/src/{infrastructure/services/analytics → domains/analytics/services}/analytics.service.ts +1 -1
  5. package/src/{infrastructure/services/analytics → domains/analytics/services}/index.ts +1 -0
  6. package/src/domains/analytics/types/index.ts +5 -0
  7. package/src/domains/analytics/types/service.interface.ts +12 -0
  8. package/src/domains/images/index.ts +13 -0
  9. package/src/{infrastructure/services/images → domains/images/services}/images.service.ts +3 -3
  10. package/src/{infrastructure/services/images → domains/images/services}/index.ts +1 -0
  11. package/src/domains/images/types/index.ts +5 -0
  12. package/src/domains/images/types/service.interface.ts +13 -0
  13. package/src/domains/kv/index.ts +13 -0
  14. package/src/{infrastructure/services/kv → domains/kv/services}/index.ts +1 -0
  15. package/src/{infrastructure/services/kv → domains/kv/services}/kv.service.ts +2 -2
  16. package/src/domains/kv/types/index.ts +5 -0
  17. package/src/domains/kv/types/service.interface.ts +13 -0
  18. package/src/domains/workflows/index.ts +10 -0
  19. package/src/domains/workflows/services/index.ts +6 -0
  20. package/src/{infrastructure/services/workflows/index.ts → domains/workflows/services/workflows.service.ts} +1 -1
  21. package/src/index.ts +4 -4
  22. /package/src/{domain/entities/analytics.entity.ts → domains/analytics/entities/index.ts} +0 -0
  23. /package/src/{domain/entities/image.entity.ts → domains/images/entities/index.ts} +0 -0
  24. /package/src/{domain/entities/kv.entity.ts → domains/kv/entities/index.ts} +0 -0
package/README.md CHANGED
@@ -177,7 +177,16 @@ const versions = await wrangler.versionsList();
177
177
  await wrangler.versionsRollback(versions[0].id);
178
178
  ```
179
179
 
180
- **Note:** Wrangler CLI, Workers, AI Gateway, R2, and D1 services now follow Domain-Driven Design (DDD) architecture with their own domain structures at `src/domains/wrangler/`, `src/domains/workers/`, `src/domains/ai-gateway/`, `src/domains/r2/`, and `src/domains/d1/`.
180
+ **Note:** All services now follow Domain-Driven Design (DDD) architecture with their own domain structures:
181
+ - Wrangler CLI: `src/domains/wrangler/`
182
+ - Workers: `src/domains/workers/`
183
+ - AI Gateway: `src/domains/ai-gateway/`
184
+ - R2: `src/domains/r2/`
185
+ - D1: `src/domains/d1/`
186
+ - KV: `src/domains/kv/`
187
+ - Images: `src/domains/images/`
188
+ - Analytics: `src/domains/analytics/`
189
+ - Workflows: `src/domains/workflows/`
181
190
 
182
191
  ## 📚 Subpath Exports
183
192
 
@@ -187,8 +196,8 @@ await wrangler.versionsRollback(versions[0].id);
187
196
  // Workers service (now in domains/)
188
197
  import { WorkersService, workersService } from '@umituz/web-cloudflare/workers';
189
198
 
190
- // KV cache
191
- import { KVService } from '@umituz/web-cloudflare/kv';
199
+ // KV cache (now in domains/)
200
+ import { KVService, kvService } from '@umituz/web-cloudflare/kv';
192
201
 
193
202
  // R2 storage (now in domains/)
194
203
  import { R2Service, r2Service } from '@umituz/web-cloudflare/r2';
@@ -196,11 +205,14 @@ import { R2Service, r2Service } from '@umituz/web-cloudflare/r2';
196
205
  // D1 database (now in domains/)
197
206
  import { D1Service, d1Service } from '@umituz/web-cloudflare/d1';
198
207
 
199
- // Images optimization
200
- import { ImagesService } from '@umituz/web-cloudflare/images';
208
+ // Images optimization (now in domains/)
209
+ import { ImagesService, imagesService } from '@umituz/web-cloudflare/images';
201
210
 
202
- // Analytics
203
- import { AnalyticsService } from '@umituz/web-cloudflare/analytics';
211
+ // Analytics (now in domains/)
212
+ import { AnalyticsService, analyticsService } from '@umituz/web-cloudflare/analytics';
213
+
214
+ // Workflows (now in domains/)
215
+ import { WorkflowService } from '@umituz/web-cloudflare/workflows';
204
216
 
205
217
  // Wrangler CLI
206
218
  import { WranglerService } from '@umituz/web-cloudflare/wrangler';
@@ -661,32 +673,15 @@ Contributions are welcome!
661
673
  │ ├── config/ # Config patterns and types
662
674
  │ ├── domains/ # Domain-driven design structure
663
675
  │ │ ├── wrangler/ # Wrangler CLI domain
664
- │ │ │ ├── entities/ # Domain entities
665
- │ │ │ ├── services/ # Domain services
666
- │ │ │ ├── types/ # Domain types
667
- │ │ │ └── index.ts # Domain exports
668
676
  │ │ ├── workers/ # Workers domain
669
- │ │ │ ├── entities/ # Domain entities
670
- │ │ │ ├── services/ # Domain services
671
- │ │ │ ├── types/ # Domain types
672
- │ │ │ ├── examples/ # Example files
673
- │ │ │ └── index.ts # Domain exports
674
677
  │ │ ├── ai-gateway/ # AI Gateway domain
675
- │ │ │ ├── entities/ # Domain entities
676
- │ │ │ ├── services/ # Domain services
677
- │ │ │ └── index.ts # Domain exports
678
678
  │ │ ├── r2/ # R2 storage domain
679
- │ │ ├── entities/ # Domain entities
680
- │ │ ├── services/ # Domain services
681
- │ │ ├── types/ # Domain types
682
- │ │ │ └── index.ts # Domain exports
683
- │ │ └── d1/ # D1 database domain
684
- │ │ ├── entities/ # Domain entities
685
- │ │ ├── services/ # Domain services
686
- │ │ ├── types/ # Domain types
687
- │ │ └── index.ts # Domain exports
679
+ │ │ ├── d1/ # D1 database domain
680
+ │ │ ├── kv/ # KV storage domain
681
+ │ │ ├── images/ # Images optimization domain
682
+ │ │ ├── analytics/ # Analytics domain
683
+ │ │ └── workflows/ # Workflows domain
688
684
  │ ├── infrastructure/
689
- │ │ ├── services/ # Services (kv, images, analytics, workflows)
690
685
  │ │ ├── router/ # Express-like router
691
686
  │ │ ├── middleware/ # Middleware collection
692
687
  │ │ └── utils/ # Helper functions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-cloudflare",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "Comprehensive Cloudflare Workers integration with config-based patterns, middleware, router, workflows, and AI (Patch-only versioning: only z in x.y.z increments)",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -8,12 +8,12 @@
8
8
  "exports": {
9
9
  ".": "./src/index.ts",
10
10
  "./workers": "./src/domains/workers/index.ts",
11
- "./kv": "./src/infrastructure/services/kv/index.ts",
11
+ "./kv": "./src/domains/kv/index.ts",
12
12
  "./r2": "./src/domains/r2/index.ts",
13
13
  "./d1": "./src/domains/d1/index.ts",
14
- "./images": "./src/infrastructure/services/images/index.ts",
15
- "./analytics": "./src/infrastructure/services/analytics/index.ts",
16
- "./workflows": "./src/infrastructure/services/workflows/index.ts",
14
+ "./images": "./src/domains/images/index.ts",
15
+ "./analytics": "./src/domains/analytics/index.ts",
16
+ "./workflows": "./src/domains/workflows/index.ts",
17
17
  "./ai-gateway": "./src/domains/ai-gateway/index.ts",
18
18
  "./workers-ai": "./src/domains/ai-gateway/index.ts",
19
19
  "./wrangler": "./src/domains/wrangler/index.ts",
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Analytics Domain
3
+ * Complete Cloudflare Analytics integration
4
+ */
5
+
6
+ // Entities
7
+ export * from './entities';
8
+
9
+ // Types
10
+ export * from './types';
11
+
12
+ // Services
13
+ export * from './services';
@@ -3,7 +3,7 @@
3
3
  * @description Cloudflare Web Analytics operations
4
4
  */
5
5
 
6
- import type { AnalyticsEvent, AnalyticsPageviewEvent, AnalyticsCustomEvent, AnalyticsData } from "../../../domain/entities/analytics.entity";
6
+ import type { AnalyticsEvent, AnalyticsPageviewEvent, AnalyticsCustomEvent, AnalyticsData } from "../entities";
7
7
  import type { IAnalyticsService } from "../../../domain/interfaces/services.interface";
8
8
 
9
9
  export interface AnalyticsClientOptions {
@@ -5,3 +5,4 @@
5
5
 
6
6
  export { AnalyticsService, analyticsService } from "./analytics.service";
7
7
  export type { AnalyticsClientOptions } from "./analytics.service";
8
+ export type { IAnalyticsService } from '../types';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Analytics Domain Types
3
+ */
4
+
5
+ export * from './service.interface';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Analytics Service Interface
3
+ * @description Abstract interface for Analytics operations
4
+ */
5
+
6
+ import type { AnalyticsEvent, AnalyticsData } from '../entities';
7
+
8
+ export interface IAnalyticsService {
9
+ trackEvent(event: AnalyticsEvent): Promise<void>;
10
+ trackPageview(url: string, title: string, referrer?: string): Promise<void>;
11
+ getAnalytics(): Promise<AnalyticsData>;
12
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Images Domain
3
+ * Complete Cloudflare Images integration
4
+ */
5
+
6
+ // Entities
7
+ export * from './entities';
8
+
9
+ // Types
10
+ export * from './types';
11
+
12
+ // Services
13
+ export * from './services';
@@ -3,10 +3,10 @@
3
3
  * @description Cloudflare Images operations
4
4
  */
5
5
 
6
- import type { ImageUploadResult, ImageUploadOptions, ImageTransformation, SignedURL } from "../../../domain/entities/image.entity";
6
+ import type { ImageUploadResult, ImageUploadOptions, ImageTransformation, SignedURL } from "../entities";
7
7
  import type { IImageService } from "../../../domain/interfaces/services.interface";
8
- import { validationUtils, transformUtils } from "../../utils";
9
- import { MAX_IMAGE_SIZE, ALLOWED_IMAGE_TYPES } from "../../constants";
8
+ import { validationUtils, transformUtils } from "../../../infrastructure/utils";
9
+ import { MAX_IMAGE_SIZE, ALLOWED_IMAGE_TYPES } from "../../../infrastructure/constants";
10
10
 
11
11
  export interface ImagesClientOptions {
12
12
  readonly accountId: string;
@@ -5,3 +5,4 @@
5
5
 
6
6
  export { ImagesService, imagesService } from "./images.service";
7
7
  export type { ImagesClientOptions } from "./images.service";
8
+ export type { IImageService } from '../types';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Images Domain Types
3
+ */
4
+
5
+ export * from './service.interface';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Images Service Interface
3
+ * @description Abstract interface for Images operations
4
+ */
5
+
6
+ import type { ImageUploadResult, ImageUploadOptions, SignedURL, ImageTransformation } from '../entities';
7
+
8
+ export interface IImageService {
9
+ upload(file: File | Blob, options?: ImageUploadOptions): Promise<ImageUploadResult>;
10
+ getSignedURL(imageId: string, expiresIn?: number): Promise<SignedURL>;
11
+ getTransformedURL(imageId: string, transform: ImageTransformation): Promise<string>;
12
+ delete(imageId: string): Promise<boolean>;
13
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * KV Domain
3
+ * Complete Cloudflare KV key-value storage integration
4
+ */
5
+
6
+ // Entities
7
+ export * from './entities';
8
+
9
+ // Types
10
+ export * from './types';
11
+
12
+ // Services
13
+ export * from './services';
@@ -5,3 +5,4 @@
5
5
 
6
6
  export { KVService, kvService } from "./kv.service";
7
7
  export type { KVCacheOptions } from "./kv.service";
8
+ export type { IKVService } from '../types';
@@ -3,9 +3,9 @@
3
3
  * @description Cloudflare KV key-value storage operations
4
4
  */
5
5
 
6
- import type { KVEntry, KVListOptions, KVListResult } from "../../../domain/entities/kv.entity";
6
+ import type { KVEntry, KVListOptions, KVListResult } from "../entities";
7
7
  import type { IKVService } from "../../../domain/interfaces/services.interface";
8
- import { validationUtils, cacheUtils } from "../../utils";
8
+ import { validationUtils, cacheUtils } from "../../../infrastructure/utils";
9
9
 
10
10
  export interface KVCacheOptions {
11
11
  readonly namespace: string;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * KV Domain Types
3
+ */
4
+
5
+ export * from './service.interface';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * KV Service Interface
3
+ * @description Abstract interface for KV storage operations
4
+ */
5
+
6
+ import type { KVListOptions, KVListResult } from '../entities';
7
+
8
+ export interface IKVService {
9
+ get<T>(key: string): Promise<T | null>;
10
+ put<T>(key: string, value: T, options?: { ttl?: number }): Promise<void>;
11
+ delete(key: string): Promise<boolean>;
12
+ list(options?: KVListOptions): Promise<KVListResult>;
13
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Workflows Domain
3
+ * Complete workflow orchestration integration
4
+ */
5
+
6
+ // Entities
7
+ export * from './entities';
8
+
9
+ // Services
10
+ export * from './services';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Workflows Service
3
+ * Subpath: @umituz/web-cloudflare/workflows
4
+ */
5
+
6
+ export * from './workflows.service';
@@ -11,7 +11,7 @@ import type {
11
11
  MediaProcessingWorkflow,
12
12
  AIGenerationWorkflow,
13
13
  BatchOperationWorkflow,
14
- } from '../../domain/workflows.entity';
14
+ } from '../entities';
15
15
 
16
16
  export interface WorkflowServiceConfig {
17
17
  KV?: KVNamespace;
package/src/index.ts CHANGED
@@ -31,10 +31,10 @@ export * from "./domains/workers";
31
31
  export * from "./domains/ai-gateway";
32
32
  export * from "./domains/r2";
33
33
  export * from "./domains/d1";
34
- export * from "./infrastructure/services/kv";
35
- export * from "./infrastructure/services/images";
36
- export * from "./infrastructure/services/analytics";
37
- export * from "./infrastructure/services/workflows";
34
+ export * from "./domains/kv";
35
+ export * from "./domains/images";
36
+ export * from "./domains/analytics";
37
+ export * from "./domains/workflows";
38
38
 
39
39
  // Infrastructure - Router, Middleware, Utils
40
40
  export * from "./infrastructure/router";