@cyclonedx/cyclonedx-library 6.9.4-beta.0 → 6.10.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.
Files changed (94) hide show
  1. package/README.md +2 -2
  2. package/dist.d/_optPlug.node/_wrapper.d.ts +22 -0
  3. package/dist.d/_optPlug.node/_wrapper.d.ts.map +1 -0
  4. package/dist.d/_optPlug.node/errors.d.ts +23 -0
  5. package/dist.d/_optPlug.node/errors.d.ts.map +1 -0
  6. package/dist.d/_optPlug.node/jsonValidator.d.ts +25 -0
  7. package/dist.d/_optPlug.node/jsonValidator.d.ts.map +1 -0
  8. package/dist.d/_optPlug.node/xmlStringify.d.ts +25 -0
  9. package/dist.d/_optPlug.node/xmlStringify.d.ts.map +1 -0
  10. package/dist.d/_optPlug.node/xmlValidator.d.ts +25 -0
  11. package/dist.d/_optPlug.node/xmlValidator.d.ts.map +1 -0
  12. package/dist.d/serialize/baseSerializer.d.ts +0 -4
  13. package/dist.d/serialize/baseSerializer.d.ts.map +1 -1
  14. package/dist.d/serialize/errors.d.ts +22 -0
  15. package/dist.d/serialize/errors.d.ts.map +1 -0
  16. package/dist.d/serialize/index.common.d.ts +1 -0
  17. package/dist.d/serialize/index.common.d.ts.map +1 -1
  18. package/dist.d/serialize/jsonSerializer.d.ts +1 -1
  19. package/dist.d/serialize/types.d.ts +1 -0
  20. package/dist.d/serialize/types.d.ts.map +1 -1
  21. package/dist.d/serialize/xmlBaseSerializer.d.ts +1 -1
  22. package/dist.d/serialize/xmlSerializer.node.d.ts +4 -0
  23. package/dist.d/serialize/xmlSerializer.node.d.ts.map +1 -1
  24. package/dist.d/validation/baseValidator.d.ts +0 -1
  25. package/dist.d/validation/baseValidator.d.ts.map +1 -1
  26. package/dist.d/validation/errors.d.ts +2 -3
  27. package/dist.d/validation/errors.d.ts.map +1 -1
  28. package/dist.d/validation/jsonValidator.node.d.ts.map +1 -1
  29. package/dist.d/validation/types.d.ts +1 -0
  30. package/dist.d/validation/types.d.ts.map +1 -1
  31. package/dist.d/validation/xmlValidator.node.d.ts.map +1 -1
  32. package/dist.node/_optPlug.node/__jsonValidators/ajv.js +47 -0
  33. package/dist.node/_optPlug.node/__jsonValidators/ajv.js.map +1 -0
  34. package/dist.node/_optPlug.node/__xmlStringifiers/xmlbuilder2.js +68 -0
  35. package/dist.node/_optPlug.node/__xmlStringifiers/xmlbuilder2.js.map +1 -0
  36. package/dist.node/_optPlug.node/__xmlValidators/libxmljs2.js +39 -0
  37. package/dist.node/_optPlug.node/__xmlValidators/libxmljs2.js.map +1 -0
  38. package/{libs/universal-node-xml/stringifiers/_helpers.js → dist.node/_optPlug.node/_wrapper.js} +22 -31
  39. package/dist.node/_optPlug.node/_wrapper.js.map +1 -0
  40. package/dist.node/_optPlug.node/errors.js +29 -0
  41. package/dist.node/_optPlug.node/errors.js.map +1 -0
  42. package/dist.node/_optPlug.node/jsonValidator.js +25 -0
  43. package/dist.node/_optPlug.node/jsonValidator.js.map +1 -0
  44. package/dist.node/_optPlug.node/xmlStringify.js +25 -0
  45. package/dist.node/_optPlug.node/xmlStringify.js.map +1 -0
  46. package/dist.node/_optPlug.node/xmlValidator.js +25 -0
  47. package/dist.node/_optPlug.node/xmlValidator.js.map +1 -0
  48. package/dist.node/serialize/baseSerializer.js.map +1 -1
  49. package/dist.node/serialize/errors.js +26 -0
  50. package/dist.node/serialize/errors.js.map +1 -0
  51. package/dist.node/serialize/index.common.js +1 -0
  52. package/dist.node/serialize/index.common.js.map +1 -1
  53. package/dist.node/serialize/xmlSerializer.node.js +12 -2
  54. package/dist.node/serialize/xmlSerializer.node.js.map +1 -1
  55. package/dist.node/validation/baseValidator.js.map +1 -1
  56. package/dist.node/validation/errors.js +2 -5
  57. package/dist.node/validation/errors.js.map +1 -1
  58. package/dist.node/validation/jsonValidator.node.js +26 -62
  59. package/dist.node/validation/jsonValidator.node.js.map +1 -1
  60. package/dist.node/validation/xmlValidator.node.js +23 -48
  61. package/dist.node/validation/xmlValidator.node.js.map +1 -1
  62. package/dist.web/lib.dev.js +77 -6
  63. package/dist.web/lib.dev.js.map +1 -1
  64. package/dist.web/lib.js +1 -1
  65. package/dist.web/lib.js.map +1 -1
  66. package/package.json +4 -4
  67. package/res/schema/README.md +8 -7
  68. package/res/schema/bom-1.2-strict.SNAPSHOT.schema.json +0 -3
  69. package/res/schema/bom-1.2.SNAPSHOT.schema.json +0 -4
  70. package/src/_helpers/README.md +2 -2
  71. package/src/_optPlug.node/README.md +11 -0
  72. package/src/_optPlug.node/__jsonValidators/ajv.ts +59 -0
  73. package/{libs/universal-node-xml/stringifiers/xmlbuilder2.js → src/_optPlug.node/__xmlStringifiers/xmlbuilder2.ts} +39 -31
  74. package/src/_optPlug.node/__xmlValidators/libxmljs2.ts +48 -0
  75. package/src/_optPlug.node/_wrapper.ts +51 -0
  76. package/{libs/universal-node-xml/index.d.ts → src/_optPlug.node/errors.ts} +6 -15
  77. package/src/_optPlug.node/jsonValidator.ts +31 -0
  78. package/src/_optPlug.node/xmlStringify.ts +31 -0
  79. package/src/_optPlug.node/xmlValidator.ts +31 -0
  80. package/src/serialize/baseSerializer.ts +0 -4
  81. package/src/serialize/errors.ts +22 -0
  82. package/src/serialize/index.common.ts +1 -0
  83. package/src/serialize/jsonSerializer.ts +1 -1
  84. package/src/serialize/types.ts +1 -0
  85. package/src/serialize/xmlBaseSerializer.ts +1 -1
  86. package/src/serialize/xmlSerializer.node.ts +17 -2
  87. package/src/validation/baseValidator.ts +0 -1
  88. package/src/validation/errors.ts +2 -8
  89. package/src/validation/jsonValidator.node.ts +25 -75
  90. package/src/validation/types.ts +1 -0
  91. package/src/validation/xmlValidator.node.ts +20 -55
  92. package/tsconfig.d.json +3 -1
  93. package/tsconfig.node.json +3 -0
  94. package/libs/universal-node-xml/index.js +0 -51
package/README.md CHANGED
@@ -198,7 +198,7 @@ See the [LICENSE][license_file] file for the full license.
198
198
  [examples]: https://github.com/CycloneDX/cyclonedx-javascript-library/tree/main/examples/README.md
199
199
  [link_rtfd]: https://cyclonedx-javascript-library.readthedocs.io
200
200
 
201
- [shield_npm-version]: https://img.shields.io/npm/v/@cyclonedx/cyclonedx-library?logo=npm&logoColor=white "npm"
201
+ [shield_npm-version]: https://img.shields.io/npm/v/%40cyclonedx%2fcyclonedx-library/latest?label=npm&logo=npm&logoColor=white "npm"
202
202
  [shield_rtfd]: https://img.shields.io/readthedocs/cyclonedx-javascript-library?logo=readthedocs&logoColor=white "Read the Docs"
203
203
  [shield_gh-workflow-test]: https://img.shields.io/github/actions/workflow/status/CycloneDX/cyclonedx-javascript-library/nodejs.yml?branch=main&logo=GitHub&logoColor=white "tests"
204
204
  [shield_coverage]: https://img.shields.io/codacy/coverage/ae6c086b53d54653ad5077b12ec22264?logo=Codacy&logoColor=white "test coverage"
@@ -210,7 +210,7 @@ See the [LICENSE][license_file] file for the full license.
210
210
  [shield_twitter-follow]: https://img.shields.io/badge/Twitter-follow-blue?logo=Twitter&logoColor=white "twitter follow"
211
211
 
212
212
  [link_website]: https://cyclonedx.org/
213
- [link_npm]: https://www.npmjs.com/package/@cyclonedx/cyclonedx-library
213
+ [link_npm]: https://www.npmjs.com/package/%40cyclonedx/cyclonedx-library
214
214
 
215
215
  [link_gh-workflow-test]: https://github.com/CycloneDX/cyclonedx-javascript-library/actions/workflows/nodejs.yml?query=branch%3Amain
216
216
  [link_codacy]: https://app.codacy.com/gh/CycloneDX/cyclonedx-javascript-library/dashboard
@@ -0,0 +1,22 @@
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
+ export type WillThrow = (() => never) & {
20
+ fails: true;
21
+ };
22
+ //# sourceMappingURL=_wrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_wrapper.d.ts","sourceRoot":"","sources":["../../src/_optPlug.node/_wrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAIF,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,CAAA"}
@@ -0,0 +1,23 @@
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
+ export declare class OptPlugError extends Error {
20
+ readonly cause: any | undefined;
21
+ constructor(message: string, cause?: any);
22
+ }
23
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/_optPlug.node/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAAA;gBAElB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;CAI1C"}
@@ -0,0 +1,25 @@
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
+ import type { ValidationError } from '../validation/types';
20
+ import { type WillThrow } from './_wrapper';
21
+ export type Validator = (data: string) => null | ValidationError;
22
+ export type Functionality = (schemaPath: string, schemaMap: Record<string, string>) => Promise<Validator>;
23
+ declare const _default: WillThrow | Functionality;
24
+ export default _default;
25
+ //# sourceMappingURL=jsonValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonValidator.d.ts","sourceRoot":"","sources":["../../src/_optPlug.node/jsonValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAkB,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtD,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,eAAe,CAAA;AAChE,MAAM,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;;AAEzG,wBAKsC"}
@@ -0,0 +1,25 @@
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
+ import type { SerializerOptions } from '../serialize/types';
20
+ import type { SimpleXml } from '../serialize/xml/types';
21
+ import { type WillThrow } from './_wrapper';
22
+ export type Functionality = (element: SimpleXml.Element, options?: SerializerOptions) => string;
23
+ declare const _default: WillThrow | Functionality;
24
+ export default _default;
25
+ //# sourceMappingURL=xmlStringify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xmlStringify.d.ts","sourceRoot":"","sources":["../../src/_optPlug.node/xmlStringify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAkB,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,KAAK,MAAM,CAAA;;AAE/F,wBAKsC"}
@@ -0,0 +1,25 @@
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
+ import type { ValidationError } from '../validation/types';
20
+ import { type WillThrow } from './_wrapper';
21
+ export type Validator = (data: string) => null | ValidationError;
22
+ export type Functionality = (schemaPath: string) => Promise<Validator>;
23
+ declare const _default: WillThrow | Functionality;
24
+ export default _default;
25
+ //# sourceMappingURL=xmlValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xmlValidator.d.ts","sourceRoot":"","sources":["../../src/_optPlug.node/xmlValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAkB,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtD,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,eAAe,CAAA;AAChE,MAAM,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;;AAEtE,wBAKsC"}
@@ -20,10 +20,6 @@ import type { Bom } from '../models';
20
20
  import type { NormalizerOptions, Serializer, SerializerOptions } from './types';
21
21
  export declare abstract class BaseSerializer<NormalizedBom> implements Serializer {
22
22
  #private;
23
- /**
24
- * @readonly
25
- * @throws {@link Error}
26
- */
27
23
  serialize(bom: Bom, options?: SerializerOptions & NormalizerOptions): string;
28
24
  /**
29
25
  * @throws {@link Error}
@@ -1 +1 @@
1
- {"version":3,"file":"baseSerializer.d.ts","sourceRoot":"","sources":["../../src/serialize/baseSerializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAGF,OAAO,KAAK,EAAE,GAAG,EAAU,MAAM,WAAW,CAAA;AAE5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE/E,8BAAsB,cAAc,CAAC,aAAa,CAAE,YAAW,UAAU;;IAoCvE;;;OAGG;IACI,SAAS,CAAE,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,GAAG,MAAM;IAOpF;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAE,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,aAAa;IAEpF;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAE,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM;CAClG"}
1
+ {"version":3,"file":"baseSerializer.d.ts","sourceRoot":"","sources":["../../src/serialize/baseSerializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAGF,OAAO,KAAK,EAAE,GAAG,EAAU,MAAM,WAAW,CAAA;AAE5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE/E,8BAAsB,cAAc,CAAC,aAAa,CAAE,YAAW,UAAU;;IAoChE,SAAS,CAAE,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,GAAG,MAAM;IAOpF;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAE,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,aAAa;IAEpF;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAE,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM;CAClG"}
@@ -0,0 +1,22 @@
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
+ import { OptPlugError } from '../_optPlug.node/errors';
20
+ export declare class MissingOptionalDependencyError extends OptPlugError {
21
+ }
22
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/serialize/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEtD,qBAAa,8BAA+B,SAAQ,YAAY;CAAG"}
@@ -17,6 +17,7 @@ SPDX-License-Identifier: Apache-2.0
17
17
  Copyright (c) OWASP Foundation. All Rights Reserved.
18
18
  */
19
19
  export * from './bomRefDiscriminator';
20
+ export * from './errors';
20
21
  export * as Types from './types';
21
22
  export * from './baseSerializer';
22
23
  export * as JSON from './json';
@@ -1 +1 @@
1
- {"version":3,"file":"index.common.d.ts","sourceRoot":"","sources":["../../src/serialize/index.common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAIF,cAAc,uBAAuB,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAIhC,cAAc,kBAAkB,CAAA;AAOhC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAOhC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAA;AAC5B,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.common.d.ts","sourceRoot":"","sources":["../../src/serialize/index.common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAIF,cAAc,uBAAuB,CAAA;AACrC,cAAc,UAAU,CAAA;AACxB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAIhC,cAAc,kBAAkB,CAAA;AAOhC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAOhC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAA;AAC5B,cAAc,qBAAqB,CAAA"}
@@ -27,7 +27,7 @@ import type { NormalizerOptions, SerializerOptions } from './types';
27
27
  export declare class JsonSerializer extends BaseSerializer<Normalized.Bom> {
28
28
  #private;
29
29
  /**
30
- * @throws {@link UnsupportedFormatError} if `normalizerFactory.spec` does not support {@link Format.JSON}.
30
+ * @throws {@link Spec.UnsupportedFormatError | UnsupportedFormatError} if `normalizerFactory.spec` does not support {@link Format.JSON}.
31
31
  */
32
32
  constructor(normalizerFactory: JsonSerializer['normalizerFactory']);
33
33
  get normalizerFactory(): NormalizerFactory;
@@ -31,6 +31,7 @@ export interface SerializerOptions {
31
31
  }
32
32
  export interface Serializer {
33
33
  /**
34
+ * @throws {@link Serialize.MissingOptionalDependencyError | MissingOptionalDependencyError}, when a required dependency was not installed
34
35
  * @throws {@link Error}
35
36
  */
36
37
  serialize: (bom: Bom, options?: SerializerOptions & NormalizerOptions) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/serialize/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAEpC,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,KAAK,MAAM,CAAA;CACjF"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/serialize/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAEpC,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,KAAK,MAAM,CAAA;CACjF"}
@@ -27,7 +27,7 @@ import type { SimpleXml } from './xml/types';
27
27
  export declare abstract class XmlBaseSerializer extends BaseSerializer<SimpleXml.Element> {
28
28
  #private;
29
29
  /**
30
- * @throws {@link UnsupportedFormatError} if `normalizerFactory.spec` does not support {@link Format.XML}.
30
+ * @throws {@link Spec.UnsupportedFormatError | UnsupportedFormatError} if `normalizerFactory.spec` does not support {@link Format.XML}.
31
31
  */
32
32
  constructor(normalizerFactory: XmlBaseSerializer['normalizerFactory']);
33
33
  get normalizerFactory(): NormalizerFactory;
@@ -23,6 +23,10 @@ import { XmlBaseSerializer } from './xmlBaseSerializer';
23
23
  * XML serializer for node.
24
24
  */
25
25
  export declare class XmlSerializer extends XmlBaseSerializer {
26
+ /**
27
+ * @throws {@link Serialize.MissingOptionalDependencyError | MissingOptionalDependencyError}
28
+ * @throws {@link Error}
29
+ */
26
30
  protected _serialize(normalizedBom: SimpleXml.Element, options?: SerializerOptions): string;
27
31
  }
28
32
  //# sourceMappingURL=xmlSerializer.node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"xmlSerializer.node.d.ts","sourceRoot":"","sources":["../../src/serialize/xmlSerializer.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAGF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD;;GAEG;AACH,qBAAa,aAAc,SAAQ,iBAAiB;IAClD,SAAS,CAAC,UAAU,CAClB,aAAa,EAAE,SAAS,CAAC,OAAO,EAChC,OAAO,GAAE,iBAAsB,GAC9B,MAAM;CAGV"}
1
+ {"version":3,"file":"xmlSerializer.node.d.ts","sourceRoot":"","sources":["../../src/serialize/xmlSerializer.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAKF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD;;GAEG;AACH,qBAAa,aAAc,SAAQ,iBAAiB;IAGlD;;;OAGG;IACH,SAAS,CAAC,UAAU,CAClB,aAAa,EAAE,SAAS,CAAC,OAAO,EAChC,OAAO,GAAE,iBAAsB,GAC9B,MAAM;CAUV"}
@@ -22,7 +22,6 @@ export declare abstract class BaseValidator implements Validator {
22
22
  #private;
23
23
  constructor(version: Version);
24
24
  get version(): Version;
25
- /** {@inheritDoc Validation.Types.Validator.validate} */
26
25
  abstract validate(data: string): Promise<null | ValidationError>;
27
26
  }
28
27
  //# sourceMappingURL=baseValidator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"baseValidator.d.ts","sourceRoot":"","sources":["../../src/validation/baseValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEzD,8BAAsB,aAAc,YAAW,SAAS;;gBAGzC,OAAO,EAAE,OAAO;IAI7B,IAAI,OAAO,IAAK,OAAO,CAEtB;IAED,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,eAAe,CAAC;CAClE"}
1
+ {"version":3,"file":"baseValidator.d.ts","sourceRoot":"","sources":["../../src/validation/baseValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEzD,8BAAsB,aAAc,YAAW,SAAS;;gBAGzC,OAAO,EAAE,OAAO;IAI7B,IAAI,OAAO,IAAK,OAAO,CAEtB;IAED,QAAQ,CAAC,QAAQ,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,eAAe,CAAC;CAClE"}
@@ -16,12 +16,11 @@ limitations under the License.
16
16
  SPDX-License-Identifier: Apache-2.0
17
17
  Copyright (c) OWASP Foundation. All Rights Reserved.
18
18
  */
19
+ import { OptPlugError } from '../_optPlug.node/errors';
19
20
  import type { Version } from '../spec';
20
21
  export declare class NotImplementedError extends Error {
21
22
  constructor(version: Version);
22
23
  }
23
- export declare class MissingOptionalDependencyError extends Error {
24
- readonly cause: any | undefined;
25
- constructor(message: string, cause?: any);
24
+ export declare class MissingOptionalDependencyError extends OptPlugError {
26
25
  }
27
26
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/validation/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,qBAAa,mBAAoB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,OAAO;CAG9B;AAED,qBAAa,8BAA+B,SAAQ,KAAK;IACvD,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAAA;gBAElB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;CAI1C"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/validation/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,qBAAa,mBAAoB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,OAAO;CAG9B;AAED,qBAAa,8BAA+B,SAAQ,YAAY;CAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"jsonValidator.node.d.ts","sourceRoot":"","sources":["../../src/validation/jsonValidator.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAOF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAsD9C,uBAAe,iBAAkB,SAAQ,aAAa;;IAqBpD;;;;;;;;;;OAUG;IACG,QAAQ,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,eAAe,CAAC;CAS/D;AACD,qBAAa,aAAc,SAAQ,iBAAiB;CAKnD;AAED,qBAAa,mBAAoB,SAAQ,iBAAiB;CAKzD"}
1
+ {"version":3,"file":"jsonValidator.node.d.ts","sourceRoot":"","sources":["../../src/validation/jsonValidator.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAKF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,uBAAe,iBAAkB,SAAQ,aAAa;;IA+BpD;;;;;;;;;;OAUG;IACG,QAAQ,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,eAAe,CAAC;CAG/D;AACD,qBAAa,aAAc,SAAQ,iBAAiB;CAKnD;AAED,qBAAa,mBAAoB,SAAQ,iBAAiB;CAKzD"}
@@ -29,6 +29,7 @@ export interface Validator {
29
29
  * Promise rejects with one of the following:
30
30
  * - {@link Validation.NotImplementedError | NotImplementedError}, when there is no validator available
31
31
  * - {@link Validation.MissingOptionalDependencyError | MissingOptionalDependencyError}, when a required dependency was not installed
32
+ * - {@link Error}
32
33
  */
33
34
  validate: (data: string) => Promise<null | ValidationError>;
34
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/validation/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;AAE9C,MAAM,WAAW,SAAS;IACxB;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,eAAe,CAAC,CAAA;CAC5D"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/validation/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;AAE9C,MAAM,WAAW,SAAS;IACxB;;;;;;;;;OASG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,eAAe,CAAC,CAAA;CAC5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"xmlValidator.node.d.ts","sourceRoot":"","sources":["../../src/validation/xmlValidator.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAOF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AA+B9C,qBAAa,YAAa,SAAQ,aAAa;;IAsB7C;;;;;;;;;;OAUG;IACG,QAAQ,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,eAAe,CAAC;CAU/D"}
1
+ {"version":3,"file":"xmlValidator.node.d.ts","sourceRoot":"","sources":["../../src/validation/xmlValidator.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAKF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,qBAAa,YAAa,SAAQ,aAAa;;IAyB7C;;;;;;;;;;OAUG;IACG,QAAQ,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,eAAe,CAAC;CAG/D"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /*!
3
+ This file is part of CycloneDX JavaScript Library.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+
17
+ SPDX-License-Identifier: Apache-2.0
18
+ Copyright (c) OWASP Foundation. All Rights Reserved.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const ajv_1 = require("ajv");
22
+ const ajv_formats_1 = require("ajv-formats");
23
+ const addFormats2019 = require("ajv-formats-draft2019");
24
+ const promises_1 = require("fs/promises");
25
+ const ajvOptions = Object.freeze({
26
+ useDefaults: false,
27
+ strict: false,
28
+ strictSchema: false,
29
+ addUsedSchema: false
30
+ });
31
+ exports.default = (async function (schemaPath, schemaMap = {}) {
32
+ const [schema, schemas] = await Promise.all([
33
+ (0, promises_1.readFile)(schemaPath, 'utf-8').then(c => JSON.parse(c)),
34
+ Promise.all(Object.entries(schemaMap).map(async ([k, v]) => await (0, promises_1.readFile)(v, 'utf-8').then(c => [k, JSON.parse(c)]))).then(es => Object.fromEntries(es))
35
+ ]);
36
+ const ajv = new ajv_1.default({ ...ajvOptions, schemas });
37
+ (0, ajv_formats_1.default)(ajv);
38
+ addFormats2019(ajv, { formats: ['idn-email'] });
39
+ ajv.addFormat('iri-reference', true);
40
+ const validator = ajv.compile(schema);
41
+ return function (data) {
42
+ return validator(JSON.parse(data))
43
+ ? null
44
+ : validator.errors;
45
+ };
46
+ });
47
+ //# sourceMappingURL=ajv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ajv.js","sourceRoot":"","sources":["../../../src/_optPlug.node/__jsonValidators/ajv.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;EAiBE;;AAEF,6BAAqD;AACrD,6CAAoC;AAEpC,wDAAuD;AACvD,0CAAsC;AAKtC,MAAM,UAAU,GAAe,MAAM,CAAC,MAAM,CAAC;IAE3C,WAAW,EAAE,KAAK;IAClB,MAAM,EAAE,KAAK;IACb,YAAY,EAAE,KAAK;IACnB,aAAa,EAAE,KAAK;CACrB,CAAC,CAAA;AAGF,kBAAe,CAAC,KAAK,WAAW,UAAkB,EAAE,YAAoC,EAAE;IACxF,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC1C,IAAA,mBAAQ,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CACvC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,IAAA,mBAAQ,EAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3E,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;KACtC,CAAC,CAAA;IAEF,MAAM,GAAG,GAAG,IAAI,aAAG,CAAC,EAAE,GAAG,UAAU,EAAE,OAAO,EAAE,CAAC,CAAA;IAC/C,IAAA,qBAAU,EAAC,GAAG,CAAC,CAAA;IACf,cAAc,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;IAE/C,GAAG,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,CAAA;IAEpC,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IAErC,OAAO,UAAU,IAAY;QAC3B,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,SAAS,CAAC,MAAM,CAAA;IACtB,CAAC,CAAA;AACH,CAAC,CAAyB,CAAA"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ /*!
3
+ This file is part of CycloneDX JavaScript Library.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+
17
+ SPDX-License-Identifier: Apache-2.0
18
+ Copyright (c) OWASP Foundation. All Rights Reserved.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const xmlbuilder2_1 = require("xmlbuilder2");
22
+ if (typeof xmlbuilder2_1.create !== 'function') {
23
+ throw new Error('`create` is not a function');
24
+ }
25
+ exports.default = (function (rootElement, { space } = {}) {
26
+ const indent = makeIndent(space);
27
+ const doc = (0, xmlbuilder2_1.create)({ encoding: 'UTF-8' });
28
+ addEle(doc, rootElement);
29
+ return doc.end({
30
+ format: 'xml',
31
+ newline: '\n',
32
+ prettyPrint: indent.length > 0,
33
+ indent
34
+ });
35
+ });
36
+ function addEle(parent, element, parentNS = null) {
37
+ if (element.type !== 'element') {
38
+ return;
39
+ }
40
+ const ns = getNS(element) ?? parentNS;
41
+ const ele = parent.ele(ns, element.name, element.attributes);
42
+ if (element.children === undefined) {
43
+ }
44
+ else if (typeof element.children === 'string' || typeof element.children === 'number') {
45
+ ele.txt(element.children.toString());
46
+ }
47
+ else {
48
+ for (const child of element.children) {
49
+ addEle(ele, child, ns);
50
+ }
51
+ }
52
+ }
53
+ function getNS(element) {
54
+ const ns = (element.namespace ?? element.attributes?.xmlns)?.toString() ?? '';
55
+ return ns.length > 0
56
+ ? ns
57
+ : null;
58
+ }
59
+ function makeIndent(space) {
60
+ if (typeof space === 'number') {
61
+ return ' '.repeat(Math.max(0, space));
62
+ }
63
+ if (typeof space === 'string') {
64
+ return space;
65
+ }
66
+ return '';
67
+ }
68
+ //# sourceMappingURL=xmlbuilder2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xmlbuilder2.js","sourceRoot":"","sources":["../../../src/_optPlug.node/__xmlStringifiers/xmlbuilder2.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;EAiBE;;AAEF,6CAAoC;AAOpC,IAAI,OAAO,oBAAM,KAAK,UAAU,EAAE,CAAC;IACjC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;AAC/C,CAAC;AAGD,kBAAe,CAAC,UACd,WAA8B,EAC9B,EAAE,KAAK,KAAwB,EAAE;IAEjC,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IAChC,MAAM,GAAG,GAAG,IAAA,oBAAM,EAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAA;IACzC,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IACxB,OAAO,GAAG,CAAC,GAAG,CAAC;QACb,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC;QAC9B,MAAM;KACP,CAAC,CAAA;AACJ,CAAC,CAAyB,CAAA;AAE1B,SAAS,MAAM,CACb,MAAkB,EAClB,OAA8C,EAC9C,WAA0B,IAAI;IAE9B,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAM;IACR,CAAC;IACD,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAA;IACrC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;IAC5D,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;IAErC,CAAC;SAAM,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACxF,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;IACtC,CAAC;SAAM,CAAC;QACN,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAA;QACxB,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAE,OAA0B;IACxC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;IAC7E,OAAO,EAAE,CAAC,MAAM,GAAG,CAAC;QAClB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,IAAI,CAAA;AACV,CAAC;AAED,SAAS,UAAU,CAAE,KAA4B;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;IACvC,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /*!
3
+ This file is part of CycloneDX JavaScript Library.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+
17
+ SPDX-License-Identifier: Apache-2.0
18
+ Copyright (c) OWASP Foundation. All Rights Reserved.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const promises_1 = require("fs/promises");
22
+ const libxmljs2_1 = require("libxmljs2");
23
+ const url_1 = require("url");
24
+ const xmlParseOptions = Object.freeze({
25
+ nonet: true,
26
+ compact: true,
27
+ noent: false,
28
+ dtdload: false
29
+ });
30
+ exports.default = (async function (schemaPath) {
31
+ const schema = (0, libxmljs2_1.parseXml)(await (0, promises_1.readFile)(schemaPath, 'utf-8'), { ...xmlParseOptions, baseUrl: (0, url_1.pathToFileURL)(schemaPath).toString() });
32
+ return function (data) {
33
+ const doc = (0, libxmljs2_1.parseXml)(data, xmlParseOptions);
34
+ return doc.validate(schema)
35
+ ? null
36
+ : doc.validationErrors;
37
+ };
38
+ });
39
+ //# sourceMappingURL=libxmljs2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"libxmljs2.js","sourceRoot":"","sources":["../../../src/_optPlug.node/__xmlValidators/libxmljs2.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;EAiBE;;AAEF,0CAAsC;AACtC,yCAAwD;AACxD,6BAAmC;AAKnC,MAAM,eAAe,GAA4B,MAAM,CAAC,MAAM,CAAC;IAC7D,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IAIb,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,KAAK;CACf,CAAC,CAAA;AAGF,kBAAe,CAAC,KAAK,WAAW,UAAkB;IAChD,MAAM,MAAM,GAAG,IAAA,oBAAQ,EAAC,MAAM,IAAA,mBAAQ,EAAC,UAAU,EAAE,OAAO,CAAC,EACzD,EAAE,GAAG,eAAe,EAAE,OAAO,EAAE,IAAA,mBAAa,EAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;IAExE,OAAO,UAAU,IAAY;QAC3B,MAAM,GAAG,GAAG,IAAA,oBAAQ,EAAC,IAAI,EAAE,eAAe,CAAC,CAAA;QAC3C,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;YACzB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAA;IAC1B,CAAC,CAAA;AACH,CAAC,CAAyB,CAAA"}
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /*!
2
3
  This file is part of CycloneDX JavaScript Library.
3
4
 
@@ -16,36 +17,26 @@ limitations under the License.
16
17
  SPDX-License-Identifier: Apache-2.0
17
18
  Copyright (c) OWASP Foundation. All Rights Reserved.
18
19
  */
19
-
20
- /* eslint-disable jsdoc/valid-types */
21
-
22
- /**
23
- * @typedef {import('../../../src/serialize/xml/types').SimpleXml.Element} Element
24
- */
25
-
26
- /* eslint-enable jsdoc/valid-types */
27
-
28
- /**
29
- * @param {Element} element
30
- * @return {string|string|null}
31
- */
32
- module.exports.getNS = function (element) {
33
- const ns = (element.namespace ?? element.attributes?.xmlns)?.toString() ?? ''
34
- return ns.length > 0
35
- ? ns
36
- : null
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const errors_1 = require("./errors");
22
+ function makeWIllThrow(message) {
23
+ const f = function () {
24
+ throw new errors_1.OptPlugError(message);
25
+ };
26
+ f.fails = true;
27
+ return Object.freeze(f);
37
28
  }
38
-
39
- /**
40
- * @param {string|number|*} [space]
41
- * @return {string}
42
- */
43
- module.exports.makeIndent = function (space) {
44
- if (typeof space === 'number') {
45
- return ' '.repeat(Math.max(0, space))
46
- }
47
- if (typeof space === 'string') {
48
- return space
49
- }
50
- return ''
29
+ function default_1(name, pf) {
30
+ for (const [, getF] of pf) {
31
+ try {
32
+ return getF();
33
+ }
34
+ catch {
35
+ }
36
+ }
37
+ return makeWIllThrow(`No ${name} available.\n` +
38
+ 'Please install one of the optional dependencies: ' +
39
+ pf.map(kv => kv[0]).join(' || '));
51
40
  }
41
+ exports.default = default_1;
42
+ //# sourceMappingURL=_wrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_wrapper.js","sourceRoot":"","sources":["../../src/_optPlug.node/_wrapper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;EAiBE;;AAEF,qCAAuC;AAIvC,SAAS,aAAa,CAAE,OAAe;IACrC,MAAM,CAAC,GAAc;QACnB,MAAM,IAAI,qBAAY,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC,CAAA;IACD,CAAC,CAAC,KAAK,GAAG,IAAI,CAAA;IACd,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AACzB,CAAC;AAKD,mBACE,IAAY,EACZ,EAA0C;IAE1C,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QAC1B,IAAI,CAAC;YACH,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;QAAC,MAAM,CAAC;QAET,CAAC;IACH,CAAC;IACD,OAAO,aAAa,CAClB,MAAM,IAAI,eAAe;QACzB,mDAAmD;QACnD,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CACjC,CAAA;AACH,CAAC;AAhBD,4BAgBC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /*!
3
+ This file is part of CycloneDX JavaScript Library.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+
17
+ SPDX-License-Identifier: Apache-2.0
18
+ Copyright (c) OWASP Foundation. All Rights Reserved.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.OptPlugError = void 0;
22
+ class OptPlugError extends Error {
23
+ constructor(message, cause) {
24
+ super(message);
25
+ this.cause = cause;
26
+ }
27
+ }
28
+ exports.OptPlugError = OptPlugError;
29
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/_optPlug.node/errors.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;EAiBE;;;AAEF,MAAa,YAAa,SAAQ,KAAK;IAGrC,YAAa,OAAe,EAAE,KAAW;QACvC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF;AAPD,oCAOC"}