@umituz/web-cloudflare 1.2.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 +10 -5
- package/package.json +2 -2
- 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/index.ts +1 -3
- /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/README.md
CHANGED
|
@@ -175,15 +175,15 @@ const versions = await wrangler.versionsList();
|
|
|
175
175
|
await wrangler.versionsRollback(versions[0].id);
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
-
**Note:** Wrangler CLI
|
|
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
179
|
|
|
180
180
|
## 📚 Subpath Exports
|
|
181
181
|
|
|
182
182
|
### Services
|
|
183
183
|
|
|
184
184
|
```typescript
|
|
185
|
-
// Workers service
|
|
186
|
-
import {
|
|
185
|
+
// Workers service (now in domains/)
|
|
186
|
+
import { WorkersService, workersService } from '@umituz/web-cloudflare/workers';
|
|
187
187
|
|
|
188
188
|
// KV cache
|
|
189
189
|
import { KVService } from '@umituz/web-cloudflare/kv';
|
|
@@ -649,13 +649,18 @@ Contributions are welcome!
|
|
|
649
649
|
├── src/
|
|
650
650
|
│ ├── config/ # Config patterns and types
|
|
651
651
|
│ ├── domains/ # Domain-driven design structure
|
|
652
|
-
│ │
|
|
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
|
|
653
658
|
│ │ ├── entities/ # Domain entities
|
|
654
659
|
│ │ ├── services/ # Domain services
|
|
655
660
|
│ │ ├── types/ # Domain types
|
|
656
661
|
│ │ └── index.ts # Domain exports
|
|
657
662
|
│ ├── infrastructure/
|
|
658
|
-
│ │ ├── services/ # Services (
|
|
663
|
+
│ │ ├── services/ # Services (kv, r2, d1, etc.)
|
|
659
664
|
│ │ ├── router/ # Express-like router
|
|
660
665
|
│ │ ├── middleware/ # Middleware collection
|
|
661
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",
|
|
@@ -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/index.ts
CHANGED
|
@@ -27,9 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
// Domains
|
|
29
29
|
export * from "./domains/wrangler";
|
|
30
|
-
|
|
31
|
-
// Infrastructure services
|
|
32
|
-
export * from "./infrastructure/services/workers";
|
|
30
|
+
export * from "./domains/workers";
|
|
33
31
|
export * from "./infrastructure/services/kv";
|
|
34
32
|
export * from "./infrastructure/services/r2";
|
|
35
33
|
export * from "./infrastructure/services/d1";
|
|
File without changes
|
|
File without changes
|