@cyclonedx/cyclonedx-library 6.1.2 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist.d/_helpers/uri.d.ts +32 -0
- package/dist.d/_helpers/uri.d.ts.map +1 -0
- package/dist.d/serialize/bomRefDiscriminator.d.ts +1 -1
- package/dist.d/serialize/bomRefDiscriminator.d.ts.map +1 -1
- package/dist.d/serialize/json/normalize.d.ts.map +1 -1
- package/dist.d/serialize/xml/normalize.d.ts.map +1 -1
- package/dist.d/serialize/xmlSerializer.web.d.ts.map +1 -1
- package/dist.d/spdx.d.ts.map +1 -1
- package/dist.node/_helpers/uri.js +41 -0
- package/dist.node/_helpers/uri.js.map +1 -0
- package/dist.node/serialize/bomRefDiscriminator.js +5 -3
- package/dist.node/serialize/bomRefDiscriminator.js.map +1 -1
- package/dist.node/serialize/json/normalize.js +10 -7
- package/dist.node/serialize/json/normalize.js.map +1 -1
- package/dist.node/serialize/xml/normalize.js +8 -8
- package/dist.node/serialize/xml/normalize.js.map +1 -1
- package/dist.node/spdx.js +2 -2
- package/dist.node/spdx.js.map +1 -1
- package/dist.node/spec/_protocol.js.map +1 -1
- package/dist.web/lib.dev.js +83 -25
- package/dist.web/lib.dev.js.map +1 -1
- package/dist.web/lib.js +1 -1
- package/dist.web/lib.js.map +1 -1
- package/libs/universal-node-xml/stringifiers/xmlbuilder2.js +7 -5
- package/package.json +3 -3
- package/src/_helpers/uri.ts +51 -0
- package/src/serialize/bomRefDiscriminator.ts +7 -7
- package/src/serialize/json/normalize.ts +13 -7
- package/src/serialize/xml/normalize.ts +11 -8
- package/src/serialize/xmlSerializer.web.ts +9 -5
- package/src/spdx.ts +5 -4
- package/src/spec/_protocol.ts +5 -0
|
@@ -38,14 +38,14 @@ module.exports = typeof create === 'function'
|
|
|
38
38
|
/* eslint-enable jsdoc/valid-types */
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* @param {Element}
|
|
41
|
+
* @param {Element} rootElement
|
|
42
42
|
* @param {string|number|undefined} [space]
|
|
43
43
|
* @return {string}
|
|
44
44
|
*/
|
|
45
|
-
function stringify (
|
|
45
|
+
function stringify (rootElement, { space } = {}) {
|
|
46
46
|
const indent = makeIndent(space)
|
|
47
47
|
const doc = create({ encoding: 'UTF-8' })
|
|
48
|
-
addEle(doc,
|
|
48
|
+
addEle(doc, rootElement)
|
|
49
49
|
return doc.end({
|
|
50
50
|
format: 'xml',
|
|
51
51
|
newline: '\n',
|
|
@@ -63,9 +63,11 @@ function addEle (parent, element, parentNS = null) {
|
|
|
63
63
|
if (element.type !== 'element') { return }
|
|
64
64
|
const ns = getNS(element) ?? parentNS
|
|
65
65
|
const ele = parent.ele(ns, element.name, element.attributes)
|
|
66
|
-
if (
|
|
66
|
+
if (element.children === undefined) {
|
|
67
|
+
/* pass */
|
|
68
|
+
} else if (typeof element.children === 'string' || typeof element.children === 'number') {
|
|
67
69
|
ele.txt(element.children.toString())
|
|
68
|
-
} else
|
|
70
|
+
} else {
|
|
69
71
|
for (const child of element.children) {
|
|
70
72
|
addEle(ele, child, ns)
|
|
71
73
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyclonedx/cyclonedx-library",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Core functionality of CycloneDX for JavaScript (Node.js or WebBrowser).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"deepmerge": "^4.2.2",
|
|
85
85
|
"eslint": "8.55.0",
|
|
86
86
|
"eslint-config-standard": "17.1.0",
|
|
87
|
-
"eslint-config-standard-with-typescript": "
|
|
87
|
+
"eslint-config-standard-with-typescript": "42.0.0",
|
|
88
88
|
"eslint-plugin-header": "3.1.1",
|
|
89
89
|
"eslint-plugin-jsdoc": "46.9.0",
|
|
90
90
|
"eslint-plugin-simple-import-sort": "10.0.0",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"ts-loader": "9.5.1",
|
|
96
96
|
"typedoc": "^0.25.0",
|
|
97
97
|
"typedoc-plugin-missing-exports": "^2.0.1",
|
|
98
|
-
"typescript": "5.3.
|
|
98
|
+
"typescript": "5.3.3",
|
|
99
99
|
"webpack": "5.89.0",
|
|
100
100
|
"webpack-cli": "5.1.4",
|
|
101
101
|
"webpack-node-externals": "3.0.0"
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
This file is part of CycloneDX JavaScript Library.
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
|
|
16
|
+
SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
Copyright (c) OWASP Foundation. All Rights Reserved.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const escapeMap: Readonly<Record<string, string>> = Object.freeze({
|
|
21
|
+
' ': '%20',
|
|
22
|
+
'[': '%5B',
|
|
23
|
+
']': '%5D',
|
|
24
|
+
'<': '%3C',
|
|
25
|
+
'>': '%3E',
|
|
26
|
+
'{': '%7B',
|
|
27
|
+
'}': '%7D'
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Make a string valid to
|
|
32
|
+
* - XML::anyURI spec.
|
|
33
|
+
* - JSON::iri-reference spec.
|
|
34
|
+
*
|
|
35
|
+
* BEST EFFORT IMPLEMENTATION
|
|
36
|
+
*
|
|
37
|
+
* @see http://www.w3.org/TR/xmlschema-2/#anyURI
|
|
38
|
+
* @see http://www.datypic.com/sc/xsd/t-xsd_anyURI.html
|
|
39
|
+
* @see https://datatracker.ietf.org/doc/html/rfc2396
|
|
40
|
+
* @see https://datatracker.ietf.org/doc/html/rfc3987
|
|
41
|
+
*/
|
|
42
|
+
export function escapeUri<T extends (string | undefined)> (value: T): T {
|
|
43
|
+
if (value === undefined) {
|
|
44
|
+
return value
|
|
45
|
+
}
|
|
46
|
+
for (const [s, r] of Object.entries(escapeMap)) {
|
|
47
|
+
/* @ts-expect-error -- TS does not properly detect that value is to be forced as string, here */
|
|
48
|
+
value = value.replace(s, r)
|
|
49
|
+
}
|
|
50
|
+
return value
|
|
51
|
+
}
|
|
@@ -20,14 +20,12 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
|
|
|
20
20
|
import type { BomRef } from '../models'
|
|
21
21
|
|
|
22
22
|
export class BomRefDiscriminator {
|
|
23
|
-
readonly #originalValues:
|
|
23
|
+
readonly #originalValues: ReadonlyArray<readonly [BomRef, string | undefined]>
|
|
24
24
|
|
|
25
25
|
readonly #prefix: string
|
|
26
26
|
|
|
27
27
|
constructor (bomRefs: Iterable<BomRef>, prefix: string = 'BomRef') {
|
|
28
|
-
this.#originalValues =
|
|
29
|
-
Array.from(bomRefs, r => [r, r.value])
|
|
30
|
-
)
|
|
28
|
+
this.#originalValues = Array.from(bomRefs, r => [r, r.value])
|
|
31
29
|
this.#prefix = prefix
|
|
32
30
|
}
|
|
33
31
|
|
|
@@ -35,9 +33,11 @@ export class BomRefDiscriminator {
|
|
|
35
33
|
return this.#prefix
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
/** Iterate over the
|
|
39
|
-
[Symbol.iterator] (): IterableIterator<BomRef> {
|
|
40
|
-
|
|
36
|
+
/** Iterate over the {@link BomRef}s. */
|
|
37
|
+
* [Symbol.iterator] (): IterableIterator<BomRef> {
|
|
38
|
+
for (const [bomRef] of this.#originalValues) {
|
|
39
|
+
yield bomRef
|
|
40
|
+
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
discriminate (): void {
|
|
@@ -21,6 +21,7 @@ import { isNotUndefined } from '../../_helpers/notUndefined'
|
|
|
21
21
|
import type { SortableIterable } from '../../_helpers/sortable'
|
|
22
22
|
import type { Stringable } from '../../_helpers/stringable'
|
|
23
23
|
import { treeIteratorSymbol } from '../../_helpers/tree'
|
|
24
|
+
import { escapeUri } from '../../_helpers/uri'
|
|
24
25
|
import * as Models from '../../models'
|
|
25
26
|
import { isSupportedSpdxId } from '../../spdx'
|
|
26
27
|
import { Version as SpecVersion } from '../../spec'
|
|
@@ -311,8 +312,10 @@ export class OrganizationalContactNormalizer extends BaseJsonNormalizer<Models.O
|
|
|
311
312
|
|
|
312
313
|
export class OrganizationalEntityNormalizer extends BaseJsonNormalizer<Models.OrganizationalEntity> {
|
|
313
314
|
normalize (data: Models.OrganizationalEntity, options: NormalizerOptions): Normalized.OrganizationalEntity {
|
|
314
|
-
const urls = normalizeStringableIter(
|
|
315
|
-
.
|
|
315
|
+
const urls = normalizeStringableIter(
|
|
316
|
+
Array.from(data.url, (s) => escapeUri(s.toString())),
|
|
317
|
+
options
|
|
318
|
+
).filter(JsonSchema.isIriReference)
|
|
316
319
|
return {
|
|
317
320
|
name: data.name || undefined,
|
|
318
321
|
url: urls.length > 0
|
|
@@ -438,7 +441,7 @@ export class LicenseNormalizer extends BaseJsonNormalizer<Models.License> {
|
|
|
438
441
|
}
|
|
439
442
|
|
|
440
443
|
#normalizeNamedLicense (data: Models.NamedLicense, options: NormalizerOptions): Normalized.NamedLicense {
|
|
441
|
-
const url = data.url?.toString()
|
|
444
|
+
const url = escapeUri(data.url?.toString())
|
|
442
445
|
return {
|
|
443
446
|
license: {
|
|
444
447
|
name: data.name,
|
|
@@ -453,13 +456,16 @@ export class LicenseNormalizer extends BaseJsonNormalizer<Models.License> {
|
|
|
453
456
|
}
|
|
454
457
|
|
|
455
458
|
#normalizeSpdxLicense (data: Models.SpdxLicense, options: NormalizerOptions): Normalized.SpdxLicense {
|
|
459
|
+
const url = escapeUri(data.url?.toString())
|
|
456
460
|
return {
|
|
457
461
|
license: {
|
|
458
462
|
id: data.id,
|
|
459
463
|
text: data.text === undefined
|
|
460
464
|
? undefined
|
|
461
465
|
: this._factory.makeForAttachment().normalize(data.text, options),
|
|
462
|
-
url:
|
|
466
|
+
url: JsonSchema.isIriReference(url)
|
|
467
|
+
? url
|
|
468
|
+
: undefined
|
|
463
469
|
}
|
|
464
470
|
}
|
|
465
471
|
}
|
|
@@ -493,7 +499,7 @@ export class LicenseNormalizer extends BaseJsonNormalizer<Models.License> {
|
|
|
493
499
|
|
|
494
500
|
export class SWIDNormalizer extends BaseJsonNormalizer<Models.SWID> {
|
|
495
501
|
normalize (data: Models.SWID, options: NormalizerOptions): Normalized.SWID {
|
|
496
|
-
const url = data.url?.toString()
|
|
502
|
+
const url = escapeUri(data.url?.toString())
|
|
497
503
|
return {
|
|
498
504
|
tagId: data.tagId,
|
|
499
505
|
name: data.name,
|
|
@@ -514,7 +520,7 @@ export class ExternalReferenceNormalizer extends BaseJsonNormalizer<Models.Exter
|
|
|
514
520
|
normalize (data: Models.ExternalReference, options: NormalizerOptions): Normalized.ExternalReference | undefined {
|
|
515
521
|
return this._factory.spec.supportsExternalReferenceType(data.type)
|
|
516
522
|
? {
|
|
517
|
-
url: data.url.toString(),
|
|
523
|
+
url: escapeUri(data.url.toString()),
|
|
518
524
|
type: data.type,
|
|
519
525
|
hashes: this._factory.spec.supportsExternalReferenceHashes && data.hashes.size > 0
|
|
520
526
|
? this._factory.makeForHash().normalizeIterable(data.hashes, options)
|
|
@@ -726,7 +732,7 @@ export class VulnerabilityRatingNormalizer extends BaseJsonNormalizer<Models.Vul
|
|
|
726
732
|
|
|
727
733
|
export class VulnerabilityAdvisoryNormalizer extends BaseJsonNormalizer<Models.Vulnerability.Advisory> {
|
|
728
734
|
normalize (data: Models.Vulnerability.Advisory, options: NormalizerOptions): Normalized.Vulnerability.Advisory | undefined {
|
|
729
|
-
const url = data.url.toString()
|
|
735
|
+
const url = escapeUri(data.url.toString())
|
|
730
736
|
if (!JsonSchema.isIriReference(url)) {
|
|
731
737
|
// invalid value -> cannot render
|
|
732
738
|
return undefined
|
|
@@ -21,6 +21,7 @@ import { isNotUndefined } from '../../_helpers/notUndefined'
|
|
|
21
21
|
import type { SortableIterable } from '../../_helpers/sortable'
|
|
22
22
|
import type { Stringable } from '../../_helpers/stringable'
|
|
23
23
|
import { treeIteratorSymbol } from '../../_helpers/tree'
|
|
24
|
+
import { escapeUri } from '../../_helpers/uri'
|
|
24
25
|
import * as Models from '../../models'
|
|
25
26
|
import { isSupportedSpdxId } from '../../spdx'
|
|
26
27
|
import { Version as SpecVersion } from '../../spec'
|
|
@@ -388,8 +389,10 @@ export class OrganizationalEntityNormalizer extends BaseXmlNormalizer<Models.Org
|
|
|
388
389
|
name: elementName,
|
|
389
390
|
children: [
|
|
390
391
|
makeOptionalTextElement(data.name, 'name'),
|
|
391
|
-
...makeTextElementIter(
|
|
392
|
-
.
|
|
392
|
+
...makeTextElementIter(Array.from(
|
|
393
|
+
data.url, (s): string => escapeUri(s.toString())
|
|
394
|
+
), options, 'url'
|
|
395
|
+
).filter(({ children: u }) => XmlSchema.isAnyURI(u)),
|
|
393
396
|
...this._factory.makeForOrganizationalContact().normalizeIterable(data.contact, options, 'contact')
|
|
394
397
|
].filter(isNotUndefined)
|
|
395
398
|
}
|
|
@@ -554,7 +557,7 @@ export class LicenseNormalizer extends BaseXmlNormalizer<Models.License> {
|
|
|
554
557
|
}
|
|
555
558
|
|
|
556
559
|
#normalizeNamedLicense (data: Models.NamedLicense, options: NormalizerOptions): SimpleXml.Element {
|
|
557
|
-
const url = data.url?.toString()
|
|
560
|
+
const url = escapeUri(data.url?.toString())
|
|
558
561
|
return {
|
|
559
562
|
type: 'element',
|
|
560
563
|
name: 'license',
|
|
@@ -571,7 +574,7 @@ export class LicenseNormalizer extends BaseXmlNormalizer<Models.License> {
|
|
|
571
574
|
}
|
|
572
575
|
|
|
573
576
|
#normalizeSpdxLicense (data: Models.SpdxLicense, options: NormalizerOptions): SimpleXml.Element {
|
|
574
|
-
const url = data.url?.toString()
|
|
577
|
+
const url = escapeUri(data.url?.toString())
|
|
575
578
|
return {
|
|
576
579
|
type: 'element',
|
|
577
580
|
name: 'license',
|
|
@@ -614,7 +617,7 @@ export class LicenseNormalizer extends BaseXmlNormalizer<Models.License> {
|
|
|
614
617
|
|
|
615
618
|
export class SWIDNormalizer extends BaseXmlNormalizer<Models.SWID> {
|
|
616
619
|
normalize (data: Models.SWID, options: NormalizerOptions, elementName: string): SimpleXml.Element {
|
|
617
|
-
const url = data.url?.toString()
|
|
620
|
+
const url = escapeUri(data.url?.toString())
|
|
618
621
|
return {
|
|
619
622
|
type: 'element',
|
|
620
623
|
name: elementName,
|
|
@@ -641,7 +644,7 @@ export class SWIDNormalizer extends BaseXmlNormalizer<Models.SWID> {
|
|
|
641
644
|
|
|
642
645
|
export class ExternalReferenceNormalizer extends BaseXmlNormalizer<Models.ExternalReference> {
|
|
643
646
|
normalize (data: Models.ExternalReference, options: NormalizerOptions, elementName: string): SimpleXml.Element | undefined {
|
|
644
|
-
const url = data.url.toString()
|
|
647
|
+
const url = escapeUri(data.url.toString())
|
|
645
648
|
const hashes: SimpleXml.Element | undefined = this._factory.spec.supportsExternalReferenceHashes && data.hashes.size > 0
|
|
646
649
|
? {
|
|
647
650
|
type: 'element',
|
|
@@ -874,7 +877,7 @@ export class VulnerabilityNormalizer extends BaseXmlNormalizer<Models.Vulnerabil
|
|
|
874
877
|
|
|
875
878
|
export class VulnerabilitySourceNormalizer extends BaseXmlNormalizer<Models.Vulnerability.Source> {
|
|
876
879
|
normalize (data: Models.Vulnerability.Source, options: NormalizerOptions, elementName: string): SimpleXml.Element {
|
|
877
|
-
const url = data.url?.toString()
|
|
880
|
+
const url = escapeUri(data.url?.toString())
|
|
878
881
|
return {
|
|
879
882
|
type: 'element',
|
|
880
883
|
name: elementName,
|
|
@@ -940,7 +943,7 @@ export class VulnerabilityRatingNormalizer extends BaseXmlNormalizer<Models.Vuln
|
|
|
940
943
|
|
|
941
944
|
export class VulnerabilityAdvisoryNormalizer extends BaseXmlNormalizer<Models.Vulnerability.Advisory> {
|
|
942
945
|
normalize (data: Models.Vulnerability.Advisory, options: NormalizerOptions, elementName: string): SimpleXml.Element | undefined {
|
|
943
|
-
const url = data.url.toString()
|
|
946
|
+
const url = escapeUri(data.url.toString())
|
|
944
947
|
if (!XmlSchema.isAnyURI(url)) {
|
|
945
948
|
// invalid value -> cannot render
|
|
946
949
|
return undefined
|
|
@@ -36,11 +36,11 @@ export class XmlSerializer extends XmlBaseSerializer {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
#buildXmlDocument (
|
|
39
|
-
|
|
39
|
+
rootElement: SimpleXml.Element
|
|
40
40
|
): XMLDocument {
|
|
41
41
|
const namespace = null
|
|
42
42
|
const doc = document.implementation.createDocument(namespace, null)
|
|
43
|
-
doc.appendChild(this.#buildElement(
|
|
43
|
+
doc.appendChild(this.#buildElement(rootElement, doc, namespace))
|
|
44
44
|
return doc
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -58,7 +58,7 @@ export class XmlSerializer extends XmlBaseSerializer {
|
|
|
58
58
|
this.#setAttributes(node, element.attributes)
|
|
59
59
|
}
|
|
60
60
|
if (isNotUndefined(element.children)) {
|
|
61
|
-
this.#
|
|
61
|
+
this.#addChildren(node, element.children, ns)
|
|
62
62
|
}
|
|
63
63
|
return node
|
|
64
64
|
}
|
|
@@ -72,14 +72,18 @@ export class XmlSerializer extends XmlBaseSerializer {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
#
|
|
75
|
+
#addChildren (node: Element, children: SimpleXml.ElementChildren, parentNS: string | null = null): void {
|
|
76
|
+
if (children === undefined) {
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
|
|
76
80
|
if (typeof children === 'string' || typeof children === 'number') {
|
|
77
81
|
node.textContent = children.toString()
|
|
78
82
|
return
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
const doc = node.ownerDocument
|
|
82
|
-
for (const child of
|
|
86
|
+
for (const child of children) {
|
|
83
87
|
if (child.type === 'element') {
|
|
84
88
|
node.appendChild(this.#buildElement(child, doc, parentNS))
|
|
85
89
|
}
|
package/src/spdx.ts
CHANGED
|
@@ -20,7 +20,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
|
|
|
20
20
|
import * as spdxExpressionParse from 'spdx-expression-parse'
|
|
21
21
|
|
|
22
22
|
/* @ts-expect-error: TS6059 -- this works as long as the file/path is available in dist-package. */
|
|
23
|
-
import { enum as _spdxSpecEnum } from '../res/schema/spdx.SNAPSHOT.schema.json'
|
|
23
|
+
import { enum as _spdxSpecEnum } from '../res/schema/spdx.SNAPSHOT.schema.json' with { type: 'json' }
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* One of the known SPDX licence identifiers.
|
|
@@ -33,18 +33,19 @@ export type SpdxId = string
|
|
|
33
33
|
|
|
34
34
|
const spdxIds: ReadonlySet<SpdxId> = new Set(_spdxSpecEnum)
|
|
35
35
|
|
|
36
|
-
const spdxLowerToActual:
|
|
36
|
+
const spdxLowerToActual: Readonly<Record<string, SpdxId>> = Object.freeze(Object.fromEntries(
|
|
37
37
|
_spdxSpecEnum.map(spdxId => [spdxId.toLowerCase(), spdxId])
|
|
38
|
-
)
|
|
38
|
+
))
|
|
39
39
|
|
|
40
40
|
export function isSupportedSpdxId (value: SpdxId | any): value is SpdxId {
|
|
41
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-argument */
|
|
41
42
|
return spdxIds.has(value)
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
/** Try to convert a `string`-like to a valid/known {@link SpdxId}. */
|
|
45
46
|
export function fixupSpdxId (value: string | any): SpdxId | undefined {
|
|
46
47
|
return typeof value === 'string' && value.length > 0
|
|
47
|
-
? spdxLowerToActual
|
|
48
|
+
? spdxLowerToActual[value.toLowerCase()]
|
|
48
49
|
: undefined
|
|
49
50
|
}
|
|
50
51
|
|
package/src/spec/_protocol.ts
CHANGED
|
@@ -109,14 +109,17 @@ export class _Spec implements _SpecProtocol {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
supportsFormat (f: Format | any): boolean {
|
|
112
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-argument */
|
|
112
113
|
return this.#formats.has(f)
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
supportsComponentType (ct: ComponentType | any): boolean {
|
|
117
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-argument */
|
|
116
118
|
return this.#componentTypes.has(ct)
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
supportsHashAlgorithm (ha: HashAlgorithm | any): boolean {
|
|
122
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-argument */
|
|
120
123
|
return this.#hashAlgorithms.has(ha)
|
|
121
124
|
}
|
|
122
125
|
|
|
@@ -126,6 +129,7 @@ export class _Spec implements _SpecProtocol {
|
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
supportsExternalReferenceType (ert: ExternalReferenceType | any): boolean {
|
|
132
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-argument */
|
|
129
133
|
return this.#externalReferenceTypes.has(ert)
|
|
130
134
|
}
|
|
131
135
|
|
|
@@ -151,6 +155,7 @@ export class _Spec implements _SpecProtocol {
|
|
|
151
155
|
}
|
|
152
156
|
|
|
153
157
|
supportsVulnerabilityRatingMethod (rm: Vulnerability.RatingMethod | any): boolean {
|
|
158
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-argument */
|
|
154
159
|
return this.#vulnerabilityRatingMethods.has(rm)
|
|
155
160
|
}
|
|
156
161
|
|