@@ -98,6 +98,9 @@ const schemaUrl: ReadonlyMap<SpecVersion, string> = new Map([
9898interface Normalizer {
9999 normalize : ( data : object , options : NormalizerOptions ) => object | undefined
100100
101+ /** @since 1.5.1 */
102+ normalizeIterable ?: ( data : Iterable < object > , options : NormalizerOptions ) => object [ ]
103+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
101104 normalizeRepository ?: ( data : Iterable < object > , options : NormalizerOptions ) => object [ ]
102105}
103106
@@ -129,7 +132,7 @@ export class BomNormalizer extends Base {
129132 serialNumber : data . serialNumber ,
130133 metadata : this . _factory . makeForMetadata ( ) . normalize ( data . metadata , options ) ,
131134 components : data . components . size > 0
132- ? this . _factory . makeForComponent ( ) . normalizeRepository ( data . components , options )
135+ ? this . _factory . makeForComponent ( ) . normalizeIterable ( data . components , options )
133136 // spec < 1.4 requires `component` to be array
134137 : [ ] ,
135138 dependencies : this . _factory . spec . supportsDependencyGraph
@@ -145,10 +148,10 @@ export class MetadataNormalizer extends Base {
145148 return {
146149 timestamp : data . timestamp ?. toISOString ( ) ,
147150 tools : data . tools . size > 0
148- ? this . _factory . makeForTool ( ) . normalizeRepository ( data . tools , options )
151+ ? this . _factory . makeForTool ( ) . normalizeIterable ( data . tools , options )
149152 : undefined ,
150153 authors : data . authors . size > 0
151- ? this . _factory . makeForOrganizationalContact ( ) . normalizeRepository ( data . authors , options )
154+ ? this . _factory . makeForOrganizationalContact ( ) . normalizeIterable ( data . authors , options )
152155 : undefined ,
153156 component : data . component === undefined
154157 ? undefined
@@ -170,21 +173,25 @@ export class ToolNormalizer extends Base {
170173 name : data . name || undefined ,
171174 version : data . version || undefined ,
172175 hashes : data . hashes . size > 0
173- ? this . _factory . makeForHash ( ) . normalizeRepository ( data . hashes , options )
176+ ? this . _factory . makeForHash ( ) . normalizeIterable ( data . hashes , options )
174177 : undefined ,
175178 externalReferences : this . _factory . spec . supportsToolReferences && data . externalReferences . size > 0
176- ? this . _factory . makeForExternalReference ( ) . normalizeRepository ( data . externalReferences , options )
179+ ? this . _factory . makeForExternalReference ( ) . normalizeIterable ( data . externalReferences , options )
177180 : undefined
178181 }
179182 }
180183
181- normalizeRepository ( data : Models . ToolRepository , options : NormalizerOptions ) : Normalized . Tool [ ] {
184+ /** @since 1.5.1 */
185+ normalizeIterable ( data : Models . ToolRepository , options : NormalizerOptions ) : Normalized . Tool [ ] {
182186 return (
183187 options . sortLists ?? false
184188 ? data . sorted ( )
185189 : Array . from ( data )
186190 ) . map ( t => this . normalize ( t , options ) )
187191 }
192+
193+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
194+ normalizeRepository = this . normalizeIterable
188195}
189196
190197export class HashNormalizer extends Base {
@@ -198,7 +205,8 @@ export class HashNormalizer extends Base {
198205 : undefined
199206 }
200207
201- normalizeRepository ( data : Models . HashDictionary , options : NormalizerOptions ) : Normalized . Hash [ ] {
208+ /** @since 1.5.1 */
209+ normalizeIterable ( data : Models . HashDictionary , options : NormalizerOptions ) : Normalized . Hash [ ] {
202210 return (
203211 options . sortLists ?? false
204212 ? data . sorted ( )
@@ -207,6 +215,9 @@ export class HashNormalizer extends Base {
207215 h => this . normalize ( h , options )
208216 ) . filter ( isNotUndefined )
209217 }
218+
219+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
220+ normalizeRepository = this . normalizeIterable
210221}
211222
212223export class OrganizationalContactNormalizer extends Base {
@@ -220,13 +231,17 @@ export class OrganizationalContactNormalizer extends Base {
220231 }
221232 }
222233
223- normalizeRepository ( data : Models . OrganizationalContactRepository , options : NormalizerOptions ) : Normalized . OrganizationalContact [ ] {
234+ /** @since 1.5.1 */
235+ normalizeIterable ( data : Models . OrganizationalContactRepository , options : NormalizerOptions ) : Normalized . OrganizationalContact [ ] {
224236 return (
225237 options . sortLists ?? false
226238 ? data . sorted ( )
227239 : Array . from ( data )
228240 ) . map ( c => this . normalize ( c , options ) )
229241 }
242+
243+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
244+ normalizeRepository = this . normalizeIterable
230245}
231246
232247export class OrganizationalEntityNormalizer extends Base {
@@ -240,7 +255,7 @@ export class OrganizationalEntityNormalizer extends Base {
240255 ? urls
241256 : undefined ,
242257 contact : data . contact . size > 0
243- ? this . _factory . makeForOrganizationalContact ( ) . normalizeRepository ( data . contact , options )
258+ ? this . _factory . makeForOrganizationalContact ( ) . normalizeIterable ( data . contact , options )
244259 : undefined
245260 }
246261 }
@@ -267,10 +282,10 @@ export class ComponentNormalizer extends Base {
267282 description : data . description || undefined ,
268283 scope : data . scope ,
269284 hashes : data . hashes . size > 0
270- ? this . _factory . makeForHash ( ) . normalizeRepository ( data . hashes , options )
285+ ? this . _factory . makeForHash ( ) . normalizeIterable ( data . hashes , options )
271286 : undefined ,
272287 licenses : data . licenses . size > 0
273- ? this . _factory . makeForLicense ( ) . normalizeRepository ( data . licenses , options )
288+ ? this . _factory . makeForLicense ( ) . normalizeIterable ( data . licenses , options )
274289 : undefined ,
275290 copyright : data . copyright || undefined ,
276291 cpe : data . cpe || undefined ,
@@ -279,19 +294,20 @@ export class ComponentNormalizer extends Base {
279294 ? undefined
280295 : this . _factory . makeForSWID ( ) . normalize ( data . swid , options ) ,
281296 externalReferences : data . externalReferences . size > 0
282- ? this . _factory . makeForExternalReference ( ) . normalizeRepository ( data . externalReferences , options )
297+ ? this . _factory . makeForExternalReference ( ) . normalizeIterable ( data . externalReferences , options )
283298 : undefined ,
284299 properties : spec . supportsProperties ( data ) && data . properties . size > 0
285- ? this . _factory . makeForProperty ( ) . normalizeRepository ( data . properties , options )
300+ ? this . _factory . makeForProperty ( ) . normalizeIterable ( data . properties , options )
286301 : undefined ,
287302 components : data . components . size > 0
288- ? this . normalizeRepository ( data . components , options )
303+ ? this . normalizeIterable ( data . components , options )
289304 : undefined
290305 }
291306 : undefined
292307 }
293308
294- normalizeRepository ( data : Models . ComponentRepository , options : NormalizerOptions ) : Normalized . Component [ ] {
309+ /** @since 1.5.1 */
310+ normalizeIterable ( data : Models . ComponentRepository , options : NormalizerOptions ) : Normalized . Component [ ] {
295311 return (
296312 options . sortLists ?? false
297313 ? data . sorted ( )
@@ -300,6 +316,9 @@ export class ComponentNormalizer extends Base {
300316 c => this . normalize ( c , options )
301317 ) . filter ( isNotUndefined )
302318 }
319+
320+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
321+ normalizeRepository = this . normalizeIterable
303322}
304323
305324export class LicenseNormalizer extends Base {
@@ -347,13 +366,17 @@ export class LicenseNormalizer extends Base {
347366 }
348367 }
349368
350- normalizeRepository ( data : Models . LicenseRepository , options : NormalizerOptions ) : Normalized . License [ ] {
369+ /** @since 1.5.1 */
370+ normalizeIterable ( data : Models . LicenseRepository , options : NormalizerOptions ) : Normalized . License [ ] {
351371 return (
352372 options . sortLists ?? false
353373 ? data . sorted ( )
354374 : Array . from ( data )
355375 ) . map ( c => this . normalize ( c , options ) )
356376 }
377+
378+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
379+ normalizeRepository = this . normalizeIterable
357380}
358381
359382export class SWIDNormalizer extends Base {
@@ -386,7 +409,8 @@ export class ExternalReferenceNormalizer extends Base {
386409 : undefined
387410 }
388411
389- normalizeRepository ( data : Models . ExternalReferenceRepository , options : NormalizerOptions ) : Normalized . ExternalReference [ ] {
412+ /** @since 1.5.1 */
413+ normalizeIterable ( data : Models . ExternalReferenceRepository , options : NormalizerOptions ) : Normalized . ExternalReference [ ] {
390414 return (
391415 options . sortLists ?? false
392416 ? data . sorted ( )
@@ -395,6 +419,9 @@ export class ExternalReferenceNormalizer extends Base {
395419 r => this . normalize ( r , options )
396420 ) . filter ( isNotUndefined )
397421 }
422+
423+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
424+ normalizeRepository = this . normalizeIterable
398425}
399426
400427export class AttachmentNormalizer extends Base {
@@ -415,13 +442,17 @@ export class PropertyNormalizer extends Base {
415442 }
416443 }
417444
418- normalizeRepository ( data : Models . PropertyRepository , options : NormalizerOptions ) : Normalized . Property [ ] {
445+ /** @since 1.5.1 */
446+ normalizeIterable ( data : Models . PropertyRepository , options : NormalizerOptions ) : Normalized . Property [ ] {
419447 return (
420448 options . sortLists ?? false
421449 ? data . sorted ( )
422450 : Array . from ( data )
423451 ) . map ( p => this . normalize ( p , options ) )
424452 }
453+
454+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
455+ normalizeRepository = this . normalizeIterable
425456}
426457
427458export class DependencyGraphNormalizer extends Base {
0 commit comments