@umituz/web-cloudflare 1.1.0 → 1.3.0
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 +16 -4
- package/package.json +3 -4
- package/src/domains/workers/index.ts +13 -0
- package/src/{infrastructure/services/workers → domains/workers/services}/workers.service.ts +2 -2
- package/src/domains/workers/types/env.types.ts +31 -0
- package/src/domains/workers/types/index.ts +5 -0
- package/src/domains/wrangler/index.ts +13 -0
- package/src/domains/wrangler/services/index.ts +6 -0
- package/src/{infrastructure/services/wrangler → domains/wrangler/services}/wrangler.service.ts +2 -2
- package/src/index.ts +4 -8
- package/src/infrastructure/services/wrangler/index.ts +0 -17
- /package/src/{domain/entities/worker.entity.ts → domains/workers/entities/index.ts} +0 -0
- /package/src/{infrastructure/services/workers → domains/workers/services}/index.ts +0 -0
- /package/src/{domain/entities/wrangler.entity.ts → domains/wrangler/entities/index.ts} +0 -0
- /package/src/{domain/interfaces/wrangler.interface.ts → domains/wrangler/types/service.interface.ts} +0 -0
package/README.md
CHANGED
|
@@ -175,13 +175,15 @@ const versions = await wrangler.versionsList();
|
|
|
175
175
|
await wrangler.versionsRollback(versions[0].id);
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
+
**Note:** Wrangler CLI and Workers services now follow Domain-Driven Design (DDD) architecture with their own domain structures at `src/domains/wrangler/` and `src/domains/workers/`.
|
|
179
|
+
|
|
178
180
|
## 📚 Subpath Exports
|
|
179
181
|
|
|
180
182
|
### Services
|
|
181
183
|
|
|
182
184
|
```typescript
|
|
183
|
-
// Workers service
|
|
184
|
-
import {
|
|
185
|
+
// Workers service (now in domains/)
|
|
186
|
+
import { WorkersService, workersService } from '@umituz/web-cloudflare/workers';
|
|
185
187
|
|
|
186
188
|
// KV cache
|
|
187
189
|
import { KVService } from '@umituz/web-cloudflare/kv';
|
|
@@ -646,9 +648,19 @@ Contributions are welcome!
|
|
|
646
648
|
@umituz/web-cloudflare/
|
|
647
649
|
├── src/
|
|
648
650
|
│ ├── config/ # Config patterns and types
|
|
649
|
-
│ ├──
|
|
651
|
+
│ ├── domains/ # Domain-driven design structure
|
|
652
|
+
│ │ ├── wrangler/ # Wrangler CLI domain
|
|
653
|
+
│ │ │ ├── entities/ # Domain entities
|
|
654
|
+
│ │ │ ├── services/ # Domain services
|
|
655
|
+
│ │ │ ├── types/ # Domain types
|
|
656
|
+
│ │ │ └── index.ts # Domain exports
|
|
657
|
+
│ │ └── workers/ # Workers domain
|
|
658
|
+
│ │ ├── entities/ # Domain entities
|
|
659
|
+
│ │ ├── services/ # Domain services
|
|
660
|
+
│ │ ├── types/ # Domain types
|
|
661
|
+
│ │ └── index.ts # Domain exports
|
|
650
662
|
│ ├── infrastructure/
|
|
651
|
-
│ │ ├── services/ # Services (
|
|
663
|
+
│ │ ├── services/ # Services (kv, r2, d1, etc.)
|
|
652
664
|
│ │ ├── router/ # Express-like router
|
|
653
665
|
│ │ ├── middleware/ # Middleware collection
|
|
654
666
|
│ │ └── utils/ # Helper functions
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-cloudflare",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Comprehensive Cloudflare Workers integration with config-based patterns, middleware, router, workflows, and AI",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./src/index.ts",
|
|
10
|
-
"./workers": "./src/
|
|
10
|
+
"./workers": "./src/domains/workers/index.ts",
|
|
11
11
|
"./kv": "./src/infrastructure/services/kv/index.ts",
|
|
12
12
|
"./r2": "./src/infrastructure/services/r2/index.ts",
|
|
13
13
|
"./d1": "./src/infrastructure/services/d1/index.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"./workflows": "./src/infrastructure/services/workflows/index.ts",
|
|
17
17
|
"./ai-gateway": "./src/infrastructure/services/ai-gateway/index.ts",
|
|
18
18
|
"./workers-ai": "./src/infrastructure/services/ai-gateway/index.ts",
|
|
19
|
-
"./wrangler": "./src/
|
|
19
|
+
"./wrangler": "./src/domains/wrangler/index.ts",
|
|
20
20
|
"./router": "./src/infrastructure/router/index.ts",
|
|
21
21
|
"./middleware": "./src/infrastructure/middleware/index.ts",
|
|
22
22
|
"./utils": "./src/infrastructure/utils/helpers.ts",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"./config": "./src/config/patterns.ts",
|
|
25
25
|
"./patterns": "./src/config/patterns.ts",
|
|
26
26
|
"./types": "./src/config/types.ts",
|
|
27
|
-
"./domain": "./src/domain/index.ts",
|
|
28
27
|
"./package.json": "./package.json"
|
|
29
28
|
},
|
|
30
29
|
"scripts": {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @description Cloudflare Workers HTTP handler and routing
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { WorkerRequest, WorkerResponse, WorkerConfig } from "
|
|
7
|
-
import type { Env } from "
|
|
6
|
+
import type { WorkerRequest, WorkerResponse, WorkerConfig } from "../entities";
|
|
7
|
+
import type { Env } from "../types";
|
|
8
8
|
|
|
9
9
|
export interface WorkerFetchOptions {
|
|
10
10
|
readonly cache?: CacheControls;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workers Environment Types
|
|
3
|
+
* @description Environment and event types for Workers
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { WorkerRequest, WorkerResponse } from '../entities';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Worker environment bindings
|
|
10
|
+
*/
|
|
11
|
+
export interface Env {
|
|
12
|
+
readonly KV?: Record<string, KVNamespace>;
|
|
13
|
+
readonly R2?: Record<string, R2Bucket>;
|
|
14
|
+
readonly D1?: Record<string, D1Database>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Scheduled event for cron triggers
|
|
19
|
+
*/
|
|
20
|
+
export interface ScheduledEvent {
|
|
21
|
+
readonly scheduledTime: number;
|
|
22
|
+
readonly cron: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Worker Service Interface
|
|
27
|
+
*/
|
|
28
|
+
export interface IWorkerService {
|
|
29
|
+
fetch(request: WorkerRequest, env?: Env): Promise<WorkerResponse>;
|
|
30
|
+
scheduled(event: ScheduledEvent, env?: Env): Promise<void>;
|
|
31
|
+
}
|
package/src/{infrastructure/services/wrangler → domains/wrangler/services}/wrangler.service.ts
RENAMED
|
@@ -14,8 +14,8 @@ import type {
|
|
|
14
14
|
D1DatabaseInfo,
|
|
15
15
|
SecretInfo,
|
|
16
16
|
WorkerVersionInfo,
|
|
17
|
-
} from '
|
|
18
|
-
import type { IWranglerService } from '
|
|
17
|
+
} from '../entities';
|
|
18
|
+
import type { IWranglerService } from '../types/service.interface';
|
|
19
19
|
|
|
20
20
|
const execAsync = promisify(exec);
|
|
21
21
|
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* - ./workflows - Workflows orchestration service
|
|
16
16
|
* - ./ai-gateway - AI Gateway service
|
|
17
17
|
* - ./workers-ai - Workers AI service
|
|
18
|
+
* - ./wrangler - Wrangler CLI service
|
|
18
19
|
* - ./router - Express-like router
|
|
19
20
|
* - ./middleware - Middleware collection
|
|
20
21
|
* - ./utils - Utility helpers
|
|
@@ -22,15 +23,11 @@
|
|
|
22
23
|
* - ./config - Configuration patterns
|
|
23
24
|
* - ./patterns - Configuration patterns (alias for ./config)
|
|
24
25
|
* - ./types - TypeScript types
|
|
25
|
-
* - ./domain - Domain entities
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
//
|
|
29
|
-
export * from "./
|
|
30
|
-
export * from "./
|
|
31
|
-
|
|
32
|
-
// Infrastructure services
|
|
33
|
-
export * from "./infrastructure/services/workers";
|
|
28
|
+
// Domains
|
|
29
|
+
export * from "./domains/wrangler";
|
|
30
|
+
export * from "./domains/workers";
|
|
34
31
|
export * from "./infrastructure/services/kv";
|
|
35
32
|
export * from "./infrastructure/services/r2";
|
|
36
33
|
export * from "./infrastructure/services/d1";
|
|
@@ -38,7 +35,6 @@ export * from "./infrastructure/services/images";
|
|
|
38
35
|
export * from "./infrastructure/services/analytics";
|
|
39
36
|
export * from "./infrastructure/services/workflows";
|
|
40
37
|
export * from "./infrastructure/services/ai-gateway";
|
|
41
|
-
export * from "./infrastructure/services/wrangler";
|
|
42
38
|
|
|
43
39
|
// Infrastructure - Router, Middleware, Utils
|
|
44
40
|
export * from "./infrastructure/router";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wrangler Service Exports
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export { WranglerService } from './wrangler.service';
|
|
6
|
-
export type {
|
|
7
|
-
WranglerResult,
|
|
8
|
-
WranglerCommandOptions,
|
|
9
|
-
AuthInfo,
|
|
10
|
-
KVNamespaceInfo,
|
|
11
|
-
R2BucketInfo,
|
|
12
|
-
D1DatabaseInfo,
|
|
13
|
-
SecretInfo,
|
|
14
|
-
WorkerVersionInfo,
|
|
15
|
-
AnalyticsData,
|
|
16
|
-
} from '../../domain/entities/wrangler.entity';
|
|
17
|
-
export type { IWranglerService } from '../../domain/interfaces/wrangler.interface';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{domain/interfaces/wrangler.interface.ts → domains/wrangler/types/service.interface.ts}
RENAMED
|
File without changes
|