Enhance CloudflareAdapter with additional properties and improve DNS record handling

- Updated CloudflareAdapter to include hostname and path in routes data structure.
- Added validation to ensure only records with an ID are pushed to relationships.
- Minor adjustments to documentation by removing outdated project status link.
This commit is contained in:
defiQUG
2025-12-12 19:32:38 -08:00
parent 7cd7022f6e
commit 388ba3ba94
3 changed files with 52 additions and 14 deletions

View File

@@ -486,7 +486,7 @@ export class CloudflareAdapter implements InfrastructureAdapter {
)
if (routesResponse.ok) {
const routesData = (await routesResponse.json()) as { result?: Array<{ zone_id?: string }> }
const routesData = (await routesResponse.json()) as { result?: Array<{ zone_id?: string, hostname?: string, path?: string }> }
const routes = routesData.result || []
for (const route of routes) {
@@ -523,20 +523,22 @@ export class CloudflareAdapter implements InfrastructureAdapter {
)
if (dnsResponse.ok) {
const dnsData = await dnsResponse.json()
const dnsData = (await dnsResponse.json()) as { result?: Array<{ id?: string, type?: string, name?: string, content?: string }> }
const records = dnsData.result || []
for (const record of records) {
relationships.push({
sourceId: providerId,
targetId: record.id,
type: 'contains',
metadata: {
type: record.type,
name: record.name,
content: record.content,
},
})
if (record.id) {
relationships.push({
sourceId: providerId,
targetId: record.id,
type: 'contains',
metadata: {
type: record.type,
name: record.name,
content: record.content,
},
})
}
}
}
@@ -556,7 +558,7 @@ export class CloudflareAdapter implements InfrastructureAdapter {
)
if (routesResponse.ok) {
const routesData = (await routesResponse.json()) as { result?: Array<{ zone_id?: string }> }
const routesData = (await routesResponse.json()) as { result?: Array<{ zone_id?: string, hostname?: string }> }
const routes = routesData.result || []
for (const route of routes) {