|
| 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 | +/** |
| 21 | + * Intended to represent normalized data structures |
| 22 | + * based on [PackageJson spec](https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/package.json) |
| 23 | + * and explained by [PackageJson description](https://docs.npmjs.com/cli/v9/configuring-npm/package-json). |
| 24 | + * |
| 25 | + * Normalization should be done downstream, for example |
| 26 | + * via [`normalize-package-data`](https://www.npmjs.com/package/normalize-package-data). |
| 27 | + */ |
| 28 | +export interface PackageJson { |
| 29 | + name?: string |
| 30 | + version?: string |
| 31 | + description?: string |
| 32 | + license?: string |
| 33 | + licenses?: Array<{ |
| 34 | + type?: string |
| 35 | + url?: string |
| 36 | + }> |
| 37 | + author?: string | { |
| 38 | + name?: string |
| 39 | + email?: string |
| 40 | + } |
| 41 | + bugs?: string | { |
| 42 | + url?: string |
| 43 | + } |
| 44 | + homepage?: string |
| 45 | + repository?: string | { |
| 46 | + type?: string |
| 47 | + url?: string |
| 48 | + directory?: string |
| 49 | + } |
| 50 | + // ... to be continued |
| 51 | + dist?: any // see https://github.com/CycloneDX/cyclonedx-node-npm/issues/1300 |
| 52 | +} |
| 53 | + |
| 54 | + |
| 55 | +/* TODO: write type assertion |
| 56 | +export function isPackageJsonNode (value: any): value is PackageJsonNode { |
| 57 | + return... |
| 58 | +} |
| 59 | +*/ |
0 commit comments