Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/_optPlug.node/__jsonValidators/ajv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

import { readFile } from 'node:fs/promises'

import Ajv, { type Options as AjvOptions } from 'ajv'
import addFormats from 'ajv-formats'
/* @ts-expect-error TS7016 */
import addFormats2019 from 'ajv-formats-draft2019'
import { readFile } from 'fs/promises'

import type { ValidationError } from '../../validation/types'
import type { Functionality, Validator } from '../jsonValidator'
Expand Down
5 changes: 3 additions & 2 deletions src/_optPlug.node/__xmlValidators/libxmljs2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

import { readFile } from 'fs/promises'
import { readFile } from 'node:fs/promises'
import { pathToFileURL } from 'node:url'

import { type ParserOptions, parseXml } from 'libxmljs2'
import { pathToFileURL } from 'url'

import type { ValidationError } from '../../validation/types'
import type { Functionality, Validator } from '../xmlValidator'
Expand Down
1 change: 1 addition & 0 deletions src/models/externalReference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import type { ExternalReferenceType } from '../enums/externalReferenceType'
import type { BomLink } from './bomLink'
import { HashDictionary } from './hash'


export interface OptionalExternalReferenceProperties {
hashes?: ExternalReference['hashes']
comment?: ExternalReference['comment']
Expand Down
2 changes: 1 addition & 1 deletion src/resources.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

import { resolve } from 'path'
import { resolve } from 'node:path'

import { Version } from './spec/enums'

Expand Down
10 changes: 8 additions & 2 deletions tests/_data/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const { Enums, Models, Types } = require('../../')
/**
* @returns {Models.Bom}
*/
module.exports.createComplexStructure = function () {
function createComplexStructure () {
const bomSerialNumberRaw = 'ac35b126-ef3a-11ed-a05b-0242ac120003'
const bom = new Models.Bom({
version: 7,
Expand Down Expand Up @@ -613,7 +613,7 @@ module.exports.createComplexStructure = function () {
/**
* @returns {Models.Bom}
*/
module.exports.createAllTools = function () {
function createAllTools () {
const bomSerialNumberRaw = '8fd9e244-73b6-4cd3-ab3a-a0fefdee5c9e'
const bom = new Models.Bom({
version: 7,
Expand Down Expand Up @@ -670,3 +670,9 @@ module.exports.createAllTools = function () {
)
return bom
}


module.exports = {
createAllTools,
createComplexStructure
}
4 changes: 2 additions & 2 deletions tests/_data/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const fs = require('fs')
const path = require('path')
const fs = require('node:fs')
const path = require('node:path')

/* eslint-disable jsdoc/valid-types */

Expand Down
4 changes: 2 additions & 2 deletions tests/_data/serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const fs = require('fs')
const path = require('path')
const fs = require('node:fs')
const path = require('node:path')

/* eslint-disable jsdoc/valid-types */

Expand Down
4 changes: 2 additions & 2 deletions tests/_data/spdx.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const fs = require('fs')
const assert = require('assert')
const assert = require('node:assert')
const fs = require('node:fs')

const { _Resources: { FILES: { SPDX: { JSON_SCHEMA: SPDX_JSON_SCHEMA } } } } = require('../../')

Expand Down
8 changes: 4 additions & 4 deletions tests/_data/specLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const fs = require('fs')
const path = require('path')
const fs = require('node:fs')
const path = require('node:path')

const resPath = path.resolve(__dirname, '..', '..', 'res', 'schema')

Expand Down Expand Up @@ -72,7 +72,7 @@ function getSpecEnum (resourceFile, ...path) {
}

module.exports = {
loadSpec,
getSpecElement,
getSpecEnum
getSpecEnum,
loadSpec
}
5 changes: 3 additions & 2 deletions tests/_data/specLoader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const assert = require('node:assert')

const { suite, test } = require('mocha')

const { loadSpec, getSpecElement, getSpecEnum } = require('./specLoader')
const { getSpecElement, getSpecEnum, loadSpec } = require('./specLoader')

suite('test helpers: specLoader', () => {

Expand Down
3 changes: 2 additions & 1 deletion tests/_helpers/stringFunctions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const assert = require('node:assert')

const { suite, test } = require('mocha')

const stringFunctions = require('./stringFunctions')
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/Enums.ComponentScope.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const { suite, test } = require('mocha')
const assert = require('node:assert')

const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')
const { suite, test } = require('mocha')

const {
Enums: { ComponentScope },
Spec: { Version },
_Resources: { FILES: { CDX: { JSON_SCHEMA: CDX_JSON_SCHEMA } } }
} = require('../../')
const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')

suite('functional: ComponentScope enum', () => {
const specVersions = new Set([
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/Enums.ComponentType.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const { suite, test } = require('mocha')
const assert = require('node:assert')

const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')
const { suite, test } = require('mocha')

const {
Enums: { ComponentType },
Spec: { Version, SpecVersionDict },
_Resources: { FILES: { CDX: { JSON_SCHEMA: CDX_JSON_SCHEMA } } }
} = require('../../')
const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')

suite('functional: ComponentType enum', () => {
const specVersions = new Set([
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/Enums.ExternalReferenceType.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const { suite, test } = require('mocha')
const assert = require('node:assert')

const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')
const { suite, test } = require('mocha')

const {
Enums: { ExternalReferenceType },
Spec: { Version, SpecVersionDict },
_Resources: { FILES: { CDX: { JSON_SCHEMA: CDX_JSON_SCHEMA } } }
} = require('../../')
const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')

suite('functional: ExternalReferenceType enum', () => {
const specVersions = new Set([
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/Enums.HashAlogorithms.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const { suite, test } = require('mocha')
const assert = require('node:assert')

const { getSpecEnum } = require('../_data/specLoader')
const { capitaliseFirstLetter } = require('../_helpers/stringFunctions')
const { suite, test } = require('mocha')

const {
Enums: { HashAlgorithm },
Spec: { Version, SpecVersionDict },
_Resources: { FILES: { CDX: { JSON_SCHEMA: CDX_JSON_SCHEMA } } }
} = require('../../')
const { getSpecEnum } = require('../_data/specLoader')
const { capitaliseFirstLetter } = require('../_helpers/stringFunctions')

suite('functional: HashAlgorithm enum', () => {
const specVersions = new Set([
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/Enums.LicenseAcknowledgement.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const { suite, test } = require('mocha')
const assert = require('node:assert')

const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')
const { suite, test } = require('mocha')

const {
Enums: { LicenseAcknowledgement },
Spec: { Version },
_Resources: { FILES: { CDX: { JSON_SCHEMA: CDX_JSON_SCHEMA } } }
} = require('../../')
const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')

suite('functional: LicenseAcknowledgement enum', () => {
const specVersions = new Set([
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/Enums.LifecyclePhase.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const { suite, test } = require('mocha')
const assert = require('node:assert')

const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')
const { suite, test } = require('mocha')

const {
Enums: { LifecyclePhase },
Spec: { Version },
_Resources: { FILES: { CDX: { JSON_SCHEMA: CDX_JSON_SCHEMA } } }
} = require('../../')
const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')

suite('functional: LifecyclePhase enum', () => {
const specVersions = new Set([
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/Enums.Vulnerability.AffectStatus.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const { suite, test } = require('mocha')
const assert = require('node:assert')

const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')
const { suite, test } = require('mocha')

const {
Enums: { Vulnerability: { AffectStatus } },
Spec: { Version },
_Resources: { FILES: { CDX: { JSON_SCHEMA: CDX_JSON_SCHEMA } } }
} = require('../../')
const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')

suite('functional: Vulnerability.AffectStatus enum', () => {
const specVersions = new Set([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const { suite, test } = require('mocha')
const assert = require('node:assert')

const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')
const { suite, test } = require('mocha')

const {
Enums: { Vulnerability: { AnalysisJustification } },
Spec: { Version },
_Resources: { FILES: { CDX: { JSON_SCHEMA: CDX_JSON_SCHEMA } } }
} = require('../../')
const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')

suite('functional: Vulnerability.AnalysisJustification enum', () => {
const specVersions = new Set([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const { suite, test } = require('mocha')
const assert = require('node:assert')

const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')
const { suite, test } = require('mocha')

const {
Enums: { Vulnerability: { AnalysisResponse } },
Spec: { Version },
_Resources: { FILES: { CDX: { JSON_SCHEMA: CDX_JSON_SCHEMA } } }
} = require('../../')
const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')

suite('functional: Vulnerability.AnalysisResponse enum', () => {
const specVersions = new Set([
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/Enums.Vulnerability.AnalysisState.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const { suite, test } = require('mocha')
const assert = require('node:assert')

const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')
const { suite, test } = require('mocha')

const {
Enums: { Vulnerability: { AnalysisState } },
Spec: { Version },
_Resources: { FILES: { CDX: { JSON_SCHEMA: CDX_JSON_SCHEMA } } }
} = require('../../')
const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')

suite('functional: Vulnerability.AnalysisState enum', () => {
const specVersions = new Set([
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/Enums.Vulnerability.RatingMethod.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const assert = require('assert')
const { suite, test } = require('mocha')
const assert = require('node:assert')

const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')
const { suite, test } = require('mocha')

const {
Enums: { Vulnerability: { RatingMethod } },
Spec: { Version, SpecVersionDict },
_Resources: { FILES: { CDX: { JSON_SCHEMA: CDX_JSON_SCHEMA } } }
} = require('../../')
const { getSpecEnum } = require('../_data/specLoader')
const { upperCamelCase } = require('../_helpers/stringFunctions')

suite('functional: Vulnerability.RatingMethod enum', () => {
const specVersions = new Set([
Expand Down
Loading