@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.
- package/README.md +24 -29
- package/package.json +5 -5
- package/src/domains/analytics/index.ts +13 -0
- package/src/{infrastructure/services/analytics → domains/analytics/services}/analytics.service.ts +1 -1
- package/src/{infrastructure/services/analytics → domains/analytics/services}/index.ts +1 -0
- package/src/domains/analytics/types/index.ts +5 -0
- package/src/domains/analytics/types/service.interface.ts +12 -0
- package/src/domains/images/index.ts +13 -0
- package/src/{infrastructure/services/images → domains/images/services}/images.service.ts +3 -3
- package/src/{infrastructure/services/images → domains/images/services}/index.ts +1 -0
- package/src/domains/images/types/index.ts +5 -0
- package/src/domains/images/types/service.interface.ts +13 -0
- package/src/domains/kv/index.ts +13 -0
- package/src/{infrastructure/services/kv → domains/kv/services}/index.ts +1 -0
- package/src/{infrastructure/services/kv → domains/kv/services}/kv.service.ts +2 -2
- package/src/domains/kv/types/index.ts +5 -0
- package/src/domains/kv/types/service.interface.ts +13 -0
- package/src/domains/workflows/index.ts +10 -0
- package/src/domains/workflows/services/index.ts +6 -0
- package/src/{infrastructure/services/workflows/index.ts → domains/workflows/services/workflows.service.ts} +1 -1
- package/src/index.ts +4 -4
- /package/src/{domain/entities/analytics.entity.ts → domains/analytics/entities/index.ts} +0 -0
- /package/src/{domain/entities/image.entity.ts → domains/images/entities/index.ts} +0 -0
- /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:**
|
|
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
|
-
│ │
|
|
680
|
-
│ │
|
|
681
|
-
│ │
|
|
682
|
-
│ │
|
|
683
|
-
│ │ └──
|
|
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
|
+
"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/
|
|
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/
|
|
15
|
-
"./analytics": "./src/
|
|
16
|
-
"./workflows": "./src/
|
|
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",
|
package/src/{infrastructure/services/analytics → domains/analytics/services}/analytics.service.ts
RENAMED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @description Cloudflare Web Analytics operations
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { AnalyticsEvent, AnalyticsPageviewEvent, AnalyticsCustomEvent, AnalyticsData } from "
|
|
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 {
|
|
@@ -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
|
+
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @description Cloudflare Images operations
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { ImageUploadResult, ImageUploadOptions, ImageTransformation, SignedURL } from "
|
|
6
|
+
import type { ImageUploadResult, ImageUploadOptions, ImageTransformation, SignedURL } from "../entities";
|
|
7
7
|
import type { IImageService } from "../../../domain/interfaces/services.interface";
|
|
8
|
-
import { validationUtils, transformUtils } from "
|
|
9
|
-
import { MAX_IMAGE_SIZE, ALLOWED_IMAGE_TYPES } from "
|
|
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;
|
|
@@ -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
|
+
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* @description Cloudflare KV key-value storage operations
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { KVEntry, KVListOptions, KVListResult } from "
|
|
6
|
+
import type { KVEntry, KVListOptions, KVListResult } from "../entities";
|
|
7
7
|
import type { IKVService } from "../../../domain/interfaces/services.interface";
|
|
8
|
-
import { validationUtils, cacheUtils } from "
|
|
8
|
+
import { validationUtils, cacheUtils } from "../../../infrastructure/utils";
|
|
9
9
|
|
|
10
10
|
export interface KVCacheOptions {
|
|
11
11
|
readonly namespace: string;
|
|
@@ -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
|
+
}
|
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 "./
|
|
35
|
-
export * from "./
|
|
36
|
-
export * from "./
|
|
37
|
-
export * from "./
|
|
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";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|