@@ -59,7 +59,7 @@ export abstract class Resource<T extends StringIndexedObject> {
5959
6060 async onInitialize ( ) : Promise < void > { }
6161
62- async validateResource ( parameters : unknown ) : Promise < ValidationResult > {
62+ async validateResource ( parameters : Partial < T > ) : Promise < ValidationResult > {
6363 if ( this . schemaValidator ) {
6464 const isValid = this . schemaValidator ( parameters ) ;
6565
@@ -215,12 +215,12 @@ export abstract class Resource<T extends StringIndexedObject> {
215215 await this . applyDestroy ( plan as DestroyPlan < T > ) ;
216216 }
217217
218- private validateRefreshResults ( refresh : Partial < T > | null , desiredMap : Map < keyof T , T [ keyof T ] > ) {
218+ private validateRefreshResults ( refresh : Partial < T > | null , desired : Partial < T > ) {
219219 if ( ! refresh ) {
220220 return ;
221221 }
222222
223- const desiredKeys = new Set < keyof T > ( desiredMap . keys ( ) ) ;
223+ const desiredKeys = new Set ( Object . keys ( refresh ) ) as Set < keyof T > ;
224224 const refreshKeys = new Set ( Object . keys ( refresh ) ) as Set < keyof T > ;
225225
226226 if ( ! setsEqual ( desiredKeys , refreshKeys ) ) {
@@ -278,11 +278,8 @@ Additional: ${[...refreshKeys].filter(k => !desiredKeys.has(k))};`
278278 }
279279
280280 private async refreshNonStatefulParameters ( resourceParameters : Partial < T > ) : Promise < Partial < T > | null > {
281- const entriesToRefresh = new Map < keyof T , T [ keyof T ] > (
282- Object . entries ( resourceParameters )
283- )
284- const currentParameters = await this . refresh ( entriesToRefresh ) ;
285- this . validateRefreshResults ( currentParameters , entriesToRefresh ) ;
281+ const currentParameters = await this . refresh ( resourceParameters ) ;
282+ this . validateRefreshResults ( currentParameters , resourceParameters ) ;
286283 return currentParameters ;
287284 }
288285
@@ -340,13 +337,13 @@ Additional: ${[...refreshKeys].filter(k => !desiredKeys.has(k))};`
340337 }
341338 }
342339
343- async validate ( parameters : unknown ) : Promise < ValidationResult > {
340+ async validate ( parameters : Partial < T > ) : Promise < ValidationResult > {
344341 return {
345342 isValid : true ,
346343 }
347344 } ;
348345
349- abstract refresh ( values : Map < keyof T , T [ keyof T ] > ) : Promise < Partial < T > | null > ;
346+ abstract refresh ( parameters : Partial < T > ) : Promise < Partial < T > | null > ;
350347
351348 abstract applyCreate ( plan : CreatePlan < T > ) : Promise < void > ;
352349
0 commit comments