File tree Expand file tree Collapse file tree
packages/server/src/utils/dns Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,23 +169,33 @@ export const cloudflareClient: DnsClient<CloudflareConfig> = {
169169 } ;
170170
171171 const existing = await cfFetch <
172- { id : string ; type : string ; content : string ; priority ?: number } [ ]
172+ {
173+ id : string ;
174+ type : string ;
175+ content : string ;
176+ priority ?: number ;
177+ data ?: Record < string , unknown > ;
178+ } [ ]
173179 > (
174180 config ,
175181 `/zones/${ record . zoneId } /dns_records?type=${ record . type } &name=${ encodeURIComponent ( record . name ) } ` ,
176182 ) ;
177183
178184 const built = buildValue ( record ) ;
179- const normalizedRecord = {
180- type : record . type ,
181- content : built . content ?? record . content . trim ( ) ,
182- priority : built . priority ,
183- } ;
184- const expectedContent = inlinePriority ( normalizedRecord ) ;
185185
186- const existingRecord = existing . find (
187- ( r ) => inlinePriority ( r ) === expectedContent ,
188- ) ;
186+ const existingRecord = existing . find ( ( r ) => {
187+ if ( built . data ) {
188+ return Object . entries ( built . data ) . every (
189+ ( [ k , v ] ) => r . data && r . data [ k ] === v ,
190+ ) ;
191+ }
192+ const normalizedRecord = {
193+ type : record . type ,
194+ content : built . content ?? record . content . trim ( ) ,
195+ priority : built . priority ,
196+ } ;
197+ return inlinePriority ( r ) === inlinePriority ( normalizedRecord ) ;
198+ } ) ;
189199 if ( existingRecord ) {
190200 const updated = await cfFetch < { id : string } > (
191201 config ,
You can’t perform that action at this time.
0 commit comments