@@ -98,6 +98,9 @@ const schemaUrl: ReadonlyMap<SpecVersion, string> = new Map([
98
98
interface Normalizer {
99
99
normalize : ( data : object , options : NormalizerOptions ) => object | undefined
100
100
101
+ /** @since 1.5.1 */
102
+ normalizeIterable ?: ( data : Iterable < object > , options : NormalizerOptions ) => object [ ]
103
+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
101
104
normalizeRepository ?: ( data : Iterable < object > , options : NormalizerOptions ) => object [ ]
102
105
}
103
106
@@ -129,7 +132,7 @@ export class BomNormalizer extends Base {
129
132
serialNumber : data . serialNumber ,
130
133
metadata : this . _factory . makeForMetadata ( ) . normalize ( data . metadata , options ) ,
131
134
components : data . components . size > 0
132
- ? this . _factory . makeForComponent ( ) . normalizeRepository ( data . components , options )
135
+ ? this . _factory . makeForComponent ( ) . normalizeIterable ( data . components , options )
133
136
// spec < 1.4 requires `component` to be array
134
137
: [ ] ,
135
138
dependencies : this . _factory . spec . supportsDependencyGraph
@@ -145,10 +148,10 @@ export class MetadataNormalizer extends Base {
145
148
return {
146
149
timestamp : data . timestamp ?. toISOString ( ) ,
147
150
tools : data . tools . size > 0
148
- ? this . _factory . makeForTool ( ) . normalizeRepository ( data . tools , options )
151
+ ? this . _factory . makeForTool ( ) . normalizeIterable ( data . tools , options )
149
152
: undefined ,
150
153
authors : data . authors . size > 0
151
- ? this . _factory . makeForOrganizationalContact ( ) . normalizeRepository ( data . authors , options )
154
+ ? this . _factory . makeForOrganizationalContact ( ) . normalizeIterable ( data . authors , options )
152
155
: undefined ,
153
156
component : data . component === undefined
154
157
? undefined
@@ -170,21 +173,25 @@ export class ToolNormalizer extends Base {
170
173
name : data . name || undefined ,
171
174
version : data . version || undefined ,
172
175
hashes : data . hashes . size > 0
173
- ? this . _factory . makeForHash ( ) . normalizeRepository ( data . hashes , options )
176
+ ? this . _factory . makeForHash ( ) . normalizeIterable ( data . hashes , options )
174
177
: undefined ,
175
178
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 )
177
180
: undefined
178
181
}
179
182
}
180
183
181
- normalizeRepository ( data : Models . ToolRepository , options : NormalizerOptions ) : Normalized . Tool [ ] {
184
+ /** @since 1.5.1 */
185
+ normalizeIterable ( data : Models . ToolRepository , options : NormalizerOptions ) : Normalized . Tool [ ] {
182
186
return (
183
187
options . sortLists ?? false
184
188
? data . sorted ( )
185
189
: Array . from ( data )
186
190
) . map ( t => this . normalize ( t , options ) )
187
191
}
192
+
193
+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
194
+ normalizeRepository = this . normalizeIterable
188
195
}
189
196
190
197
export class HashNormalizer extends Base {
@@ -198,7 +205,8 @@ export class HashNormalizer extends Base {
198
205
: undefined
199
206
}
200
207
201
- normalizeRepository ( data : Models . HashDictionary , options : NormalizerOptions ) : Normalized . Hash [ ] {
208
+ /** @since 1.5.1 */
209
+ normalizeIterable ( data : Models . HashDictionary , options : NormalizerOptions ) : Normalized . Hash [ ] {
202
210
return (
203
211
options . sortLists ?? false
204
212
? data . sorted ( )
@@ -207,6 +215,9 @@ export class HashNormalizer extends Base {
207
215
h => this . normalize ( h , options )
208
216
) . filter ( isNotUndefined )
209
217
}
218
+
219
+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
220
+ normalizeRepository = this . normalizeIterable
210
221
}
211
222
212
223
export class OrganizationalContactNormalizer extends Base {
@@ -220,13 +231,17 @@ export class OrganizationalContactNormalizer extends Base {
220
231
}
221
232
}
222
233
223
- normalizeRepository ( data : Models . OrganizationalContactRepository , options : NormalizerOptions ) : Normalized . OrganizationalContact [ ] {
234
+ /** @since 1.5.1 */
235
+ normalizeIterable ( data : Models . OrganizationalContactRepository , options : NormalizerOptions ) : Normalized . OrganizationalContact [ ] {
224
236
return (
225
237
options . sortLists ?? false
226
238
? data . sorted ( )
227
239
: Array . from ( data )
228
240
) . map ( c => this . normalize ( c , options ) )
229
241
}
242
+
243
+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
244
+ normalizeRepository = this . normalizeIterable
230
245
}
231
246
232
247
export class OrganizationalEntityNormalizer extends Base {
@@ -240,7 +255,7 @@ export class OrganizationalEntityNormalizer extends Base {
240
255
? urls
241
256
: undefined ,
242
257
contact : data . contact . size > 0
243
- ? this . _factory . makeForOrganizationalContact ( ) . normalizeRepository ( data . contact , options )
258
+ ? this . _factory . makeForOrganizationalContact ( ) . normalizeIterable ( data . contact , options )
244
259
: undefined
245
260
}
246
261
}
@@ -267,10 +282,10 @@ export class ComponentNormalizer extends Base {
267
282
description : data . description || undefined ,
268
283
scope : data . scope ,
269
284
hashes : data . hashes . size > 0
270
- ? this . _factory . makeForHash ( ) . normalizeRepository ( data . hashes , options )
285
+ ? this . _factory . makeForHash ( ) . normalizeIterable ( data . hashes , options )
271
286
: undefined ,
272
287
licenses : data . licenses . size > 0
273
- ? this . _factory . makeForLicense ( ) . normalizeRepository ( data . licenses , options )
288
+ ? this . _factory . makeForLicense ( ) . normalizeIterable ( data . licenses , options )
274
289
: undefined ,
275
290
copyright : data . copyright || undefined ,
276
291
cpe : data . cpe || undefined ,
@@ -279,19 +294,20 @@ export class ComponentNormalizer extends Base {
279
294
? undefined
280
295
: this . _factory . makeForSWID ( ) . normalize ( data . swid , options ) ,
281
296
externalReferences : data . externalReferences . size > 0
282
- ? this . _factory . makeForExternalReference ( ) . normalizeRepository ( data . externalReferences , options )
297
+ ? this . _factory . makeForExternalReference ( ) . normalizeIterable ( data . externalReferences , options )
283
298
: undefined ,
284
299
properties : spec . supportsProperties ( data ) && data . properties . size > 0
285
- ? this . _factory . makeForProperty ( ) . normalizeRepository ( data . properties , options )
300
+ ? this . _factory . makeForProperty ( ) . normalizeIterable ( data . properties , options )
286
301
: undefined ,
287
302
components : data . components . size > 0
288
- ? this . normalizeRepository ( data . components , options )
303
+ ? this . normalizeIterable ( data . components , options )
289
304
: undefined
290
305
}
291
306
: undefined
292
307
}
293
308
294
- normalizeRepository ( data : Models . ComponentRepository , options : NormalizerOptions ) : Normalized . Component [ ] {
309
+ /** @since 1.5.1 */
310
+ normalizeIterable ( data : Models . ComponentRepository , options : NormalizerOptions ) : Normalized . Component [ ] {
295
311
return (
296
312
options . sortLists ?? false
297
313
? data . sorted ( )
@@ -300,6 +316,9 @@ export class ComponentNormalizer extends Base {
300
316
c => this . normalize ( c , options )
301
317
) . filter ( isNotUndefined )
302
318
}
319
+
320
+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
321
+ normalizeRepository = this . normalizeIterable
303
322
}
304
323
305
324
export class LicenseNormalizer extends Base {
@@ -347,13 +366,17 @@ export class LicenseNormalizer extends Base {
347
366
}
348
367
}
349
368
350
- normalizeRepository ( data : Models . LicenseRepository , options : NormalizerOptions ) : Normalized . License [ ] {
369
+ /** @since 1.5.1 */
370
+ normalizeIterable ( data : Models . LicenseRepository , options : NormalizerOptions ) : Normalized . License [ ] {
351
371
return (
352
372
options . sortLists ?? false
353
373
? data . sorted ( )
354
374
: Array . from ( data )
355
375
) . map ( c => this . normalize ( c , options ) )
356
376
}
377
+
378
+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
379
+ normalizeRepository = this . normalizeIterable
357
380
}
358
381
359
382
export class SWIDNormalizer extends Base {
@@ -386,7 +409,8 @@ export class ExternalReferenceNormalizer extends Base {
386
409
: undefined
387
410
}
388
411
389
- normalizeRepository ( data : Models . ExternalReferenceRepository , options : NormalizerOptions ) : Normalized . ExternalReference [ ] {
412
+ /** @since 1.5.1 */
413
+ normalizeIterable ( data : Models . ExternalReferenceRepository , options : NormalizerOptions ) : Normalized . ExternalReference [ ] {
390
414
return (
391
415
options . sortLists ?? false
392
416
? data . sorted ( )
@@ -395,6 +419,9 @@ export class ExternalReferenceNormalizer extends Base {
395
419
r => this . normalize ( r , options )
396
420
) . filter ( isNotUndefined )
397
421
}
422
+
423
+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
424
+ normalizeRepository = this . normalizeIterable
398
425
}
399
426
400
427
export class AttachmentNormalizer extends Base {
@@ -415,13 +442,17 @@ export class PropertyNormalizer extends Base {
415
442
}
416
443
}
417
444
418
- normalizeRepository ( data : Models . PropertyRepository , options : NormalizerOptions ) : Normalized . Property [ ] {
445
+ /** @since 1.5.1 */
446
+ normalizeIterable ( data : Models . PropertyRepository , options : NormalizerOptions ) : Normalized . Property [ ] {
419
447
return (
420
448
options . sortLists ?? false
421
449
? data . sorted ( )
422
450
: Array . from ( data )
423
451
) . map ( p => this . normalize ( p , options ) )
424
452
}
453
+
454
+ /** @deprecated use {@see normalizeIterable} instead of {@see normalizeRepository} */
455
+ normalizeRepository = this . normalizeIterable
425
456
}
426
457
427
458
export class DependencyGraphNormalizer extends Base {
0 commit comments