Skip to content

Commit 2f715cf

Browse files
committed
release: v3.5.0
2 parents 005119b + 6d9fd85 commit 2f715cf

145 files changed

Lines changed: 7964 additions & 56 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ coverage/
33
.nyc_output/
44
.travis.yml
55
.env
6-
**/.DS_Store
6+
**/.DS_Store
7+
.claude
8+
.claude-flow
9+
.mcp.json
10+
CLAUDE.md

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,37 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
#### [v3.5.0](https://github.com/Ziut3k-dev/api_cloudflare_client/compare/v3.4.2...v3.5.0)
8+
9+
> 13 May 2026
10+
11+
##### New Resources (17)
12+
13+
- **Accounts** — account management (`browse`, `read`, `edit`)
14+
- **AccountMembers** — member management with role assignment (`browse`, `read`, `add`, `edit`, `del`)
15+
- **AccountRoles** — list and read account roles (`browse`, `read`)
16+
- **ZoneSSL** — SSL certificate pack management (`browse`, `read`, `add`, `edit`, `del`)
17+
- **RateLimits** — zone-level rate limiting rules (`browse`, `read`, `add`, `edit`, `del`)
18+
- **WaitingRooms** — traffic queue management (`browse`, `read`, `add`, `edit`, `del`, `getEvents`, `getStatus`)
19+
- **LoadBalancers** — zone-level load balancer configuration (`browse`, `read`, `add`, `edit`, `del`)
20+
- **LoadBalancerPools** — account-level origin pools with health checks (`browse`, `read`, `add`, `edit`, `del`, `health`, `preview`)
21+
- **LoadBalancerMonitors** — health monitor configuration (`browse`, `read`, `add`, `edit`, `del`, `preview`, `references`)
22+
- **EmailRouting** — email routing rules and catch-all (`get`, `enable`, `disable`, `browseRules`, `readRule`, `addRule`, `editRule`, `delRule`, `getCatchAll`, `editCatchAll`)
23+
- **R2Buckets** — Cloudflare R2 object storage buckets (`browse`, `read`, `add`, `del`)
24+
- **D1Database** — Cloudflare D1 SQL database management (`browse`, `read`, `add`, `del`, `query`, `raw`)
25+
- **Queues** — Cloudflare Queues with consumer management (`browse`, `read`, `add`, `edit`, `del`, `browseConsumers`, `addConsumer`, `editConsumer`, `delConsumer`)
26+
- **Turnstile** — CAPTCHA widget management with secret rotation (`browse`, `read`, `add`, `edit`, `del`, `rotateSecret`)
27+
- **Logpush** — log delivery job management with destination validation (`browseJobs`, `readJob`, `addJob`, `editJob`, `delJob`, `getOwnershipChallenge`, `validateOwnership`, `validateDestination`)
28+
- **AuditLogs** — account audit log access with full filter support (`browse`)
29+
- **Tunnels** — Cloudflare Tunnel (cfd_tunnel) management with configuration (`browse`, `read`, `add`, `edit`, `del`, `getToken`, `getConnections`, `cleanConnections`, `getConfig`, `editConfig`)
30+
31+
##### Fixes & Improvements
32+
33+
- Added missing `Stream` resource instantiation in main `Cloudflare` class
34+
- Added complete TypeScript type definitions for all new resources in `index.d.ts`
35+
- Added unit test suites (`.spec.ts`) for all 17 new resources — 100+ new test cases
36+
- Reorganized `index.ts` with grouped property declarations for better readability
37+
738
#### [v3.4.2](https://github.com/Ziut3k-dev/api_cloudflare_client/compare/v3.4.1...v3.4.2)
839

940
> 16 October 2024

__tests__/AccountMembers.spec.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import AccountMembers from '../lib/resources/AccountMembers';
2+
import {
3+
describe,
4+
test,
5+
beforeEach,
6+
expect,
7+
afterEach,
8+
jest
9+
} from '@jest/globals';
10+
11+
const mockApiClient = {
12+
request: jest.fn<any>(),
13+
};
14+
15+
describe('AccountMembers Unit Tests', () => {
16+
let instance: AccountMembers;
17+
18+
beforeEach(() => {
19+
instance = new AccountMembers(mockApiClient as any);
20+
});
21+
22+
test('browse should call request', async () => {
23+
mockApiClient.request.mockResolvedValueOnce({ success: true });
24+
await instance.browse('test-account-id');
25+
expect(mockApiClient.request).toHaveBeenCalled();
26+
});
27+
28+
test('read should call request', async () => {
29+
mockApiClient.request.mockResolvedValueOnce({ success: true });
30+
await instance.read('test-account-id', 'test-member-id');
31+
expect(mockApiClient.request).toHaveBeenCalled();
32+
});
33+
34+
test('add should call request', async () => {
35+
mockApiClient.request.mockResolvedValueOnce({ success: true });
36+
await instance.add('test-account-id', { email: 'user@example.com', roles: ['role-id'] });
37+
expect(mockApiClient.request).toHaveBeenCalled();
38+
});
39+
40+
test('edit should call request', async () => {
41+
mockApiClient.request.mockResolvedValueOnce({ success: true });
42+
await instance.edit('test-account-id', 'test-member-id', { roles: [{ id: 'role-id' }] });
43+
expect(mockApiClient.request).toHaveBeenCalled();
44+
});
45+
46+
test('del should call request', async () => {
47+
mockApiClient.request.mockResolvedValueOnce({ success: true });
48+
await instance.del('test-account-id', 'test-member-id');
49+
expect(mockApiClient.request).toHaveBeenCalled();
50+
});
51+
52+
afterEach(() => {
53+
mockApiClient.request.mockClear();
54+
});
55+
});

__tests__/AccountRoles.spec.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import AccountRoles from '../lib/resources/AccountRoles';
2+
import {
3+
describe,
4+
test,
5+
beforeEach,
6+
expect,
7+
afterEach,
8+
jest
9+
} from '@jest/globals';
10+
11+
const mockApiClient = {
12+
request: jest.fn<any>(),
13+
};
14+
15+
describe('AccountRoles Unit Tests', () => {
16+
let instance: AccountRoles;
17+
18+
beforeEach(() => {
19+
instance = new AccountRoles(mockApiClient as any);
20+
});
21+
22+
test('browse should call request', async () => {
23+
mockApiClient.request.mockResolvedValueOnce({ success: true });
24+
await instance.browse('test-account-id');
25+
expect(mockApiClient.request).toHaveBeenCalled();
26+
});
27+
28+
test('read should call request', async () => {
29+
mockApiClient.request.mockResolvedValueOnce({ success: true });
30+
await instance.read('test-account-id', 'test-role-id');
31+
expect(mockApiClient.request).toHaveBeenCalled();
32+
});
33+
34+
afterEach(() => {
35+
mockApiClient.request.mockClear();
36+
});
37+
});

__tests__/Accounts.spec.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import Accounts from '../lib/resources/Accounts';
2+
import {
3+
describe,
4+
test,
5+
beforeEach,
6+
expect,
7+
afterEach,
8+
jest
9+
} from '@jest/globals';
10+
11+
const mockApiClient = {
12+
request: jest.fn<any>(),
13+
};
14+
15+
describe('Accounts Unit Tests', () => {
16+
let instance: Accounts;
17+
18+
beforeEach(() => {
19+
instance = new Accounts(mockApiClient as any);
20+
});
21+
22+
test('browse should call request', async () => {
23+
mockApiClient.request.mockResolvedValueOnce({ success: true });
24+
await instance.browse();
25+
expect(mockApiClient.request).toHaveBeenCalled();
26+
});
27+
28+
test('browse with pagination should call request', async () => {
29+
mockApiClient.request.mockResolvedValueOnce({ success: true });
30+
await instance.browse(2, 10);
31+
expect(mockApiClient.request).toHaveBeenCalled();
32+
});
33+
34+
test('read should call request', async () => {
35+
mockApiClient.request.mockResolvedValueOnce({ success: true });
36+
await instance.read('test-account-id');
37+
expect(mockApiClient.request).toHaveBeenCalled();
38+
});
39+
40+
test('edit should call request', async () => {
41+
mockApiClient.request.mockResolvedValueOnce({ success: true });
42+
await instance.edit('test-account-id', { name: 'Updated Account' });
43+
expect(mockApiClient.request).toHaveBeenCalled();
44+
});
45+
46+
afterEach(() => {
47+
mockApiClient.request.mockClear();
48+
});
49+
});

__tests__/AuditLogs.spec.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import AuditLogs from '../lib/resources/AuditLogs';
2+
import {
3+
describe,
4+
test,
5+
beforeEach,
6+
expect,
7+
afterEach,
8+
jest
9+
} from '@jest/globals';
10+
11+
const mockApiClient = {
12+
request: jest.fn<any>(),
13+
};
14+
15+
describe('AuditLogs Unit Tests', () => {
16+
let instance: AuditLogs;
17+
18+
beforeEach(() => {
19+
instance = new AuditLogs(mockApiClient as any);
20+
});
21+
22+
test('browse should call request', async () => {
23+
mockApiClient.request.mockResolvedValueOnce({ success: true });
24+
await instance.browse('test-account-id');
25+
expect(mockApiClient.request).toHaveBeenCalled();
26+
});
27+
28+
test('browse with filters should call request', async () => {
29+
mockApiClient.request.mockResolvedValueOnce({ success: true });
30+
await instance.browse('test-account-id', {
31+
since: '2024-01-01T00:00:00Z',
32+
before: '2024-12-31T23:59:59Z',
33+
actor_email: 'admin@example.com',
34+
action_type: 'zone.create',
35+
page: 1,
36+
per_page: 25,
37+
direction: 'desc',
38+
});
39+
expect(mockApiClient.request).toHaveBeenCalled();
40+
});
41+
42+
test('browse with partial filters should call request', async () => {
43+
mockApiClient.request.mockResolvedValueOnce({ success: true });
44+
await instance.browse('test-account-id', { actor_ip: '198.51.100.0' });
45+
expect(mockApiClient.request).toHaveBeenCalled();
46+
});
47+
48+
afterEach(() => {
49+
mockApiClient.request.mockClear();
50+
});
51+
});

__tests__/D1Database.spec.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import D1Database from '../lib/resources/D1Database';
2+
import {
3+
describe,
4+
test,
5+
beforeEach,
6+
expect,
7+
afterEach,
8+
jest
9+
} from '@jest/globals';
10+
11+
const mockApiClient = {
12+
request: jest.fn<any>(),
13+
};
14+
15+
describe('D1Database Unit Tests', () => {
16+
let instance: D1Database;
17+
18+
beforeEach(() => {
19+
instance = new D1Database(mockApiClient as any);
20+
});
21+
22+
test('browse should call request', async () => {
23+
mockApiClient.request.mockResolvedValueOnce({ success: true });
24+
await instance.browse('test-account-id');
25+
expect(mockApiClient.request).toHaveBeenCalled();
26+
});
27+
28+
test('browse with pagination should call request', async () => {
29+
mockApiClient.request.mockResolvedValueOnce({ success: true });
30+
await instance.browse('test-account-id', 1, 50);
31+
expect(mockApiClient.request).toHaveBeenCalled();
32+
});
33+
34+
test('read should call request', async () => {
35+
mockApiClient.request.mockResolvedValueOnce({ success: true });
36+
await instance.read('test-account-id', 'test-database-id');
37+
expect(mockApiClient.request).toHaveBeenCalled();
38+
});
39+
40+
test('add should call request', async () => {
41+
mockApiClient.request.mockResolvedValueOnce({ success: true });
42+
await instance.add('test-account-id', { name: 'my-database' });
43+
expect(mockApiClient.request).toHaveBeenCalled();
44+
});
45+
46+
test('del should call request', async () => {
47+
mockApiClient.request.mockResolvedValueOnce({ success: true });
48+
await instance.del('test-account-id', 'test-database-id');
49+
expect(mockApiClient.request).toHaveBeenCalled();
50+
});
51+
52+
test('query should call request', async () => {
53+
mockApiClient.request.mockResolvedValueOnce({ success: true });
54+
await instance.query('test-account-id', 'test-database-id', 'SELECT * FROM users');
55+
expect(mockApiClient.request).toHaveBeenCalled();
56+
});
57+
58+
test('query with params should call request', async () => {
59+
mockApiClient.request.mockResolvedValueOnce({ success: true });
60+
await instance.query('test-account-id', 'test-database-id', 'SELECT * FROM users WHERE id = ?', [1]);
61+
expect(mockApiClient.request).toHaveBeenCalled();
62+
});
63+
64+
test('raw should call request', async () => {
65+
mockApiClient.request.mockResolvedValueOnce({ success: true });
66+
await instance.raw('test-account-id', 'test-database-id', 'SELECT 1');
67+
expect(mockApiClient.request).toHaveBeenCalled();
68+
});
69+
70+
afterEach(() => {
71+
mockApiClient.request.mockClear();
72+
});
73+
});

0 commit comments

Comments
 (0)