@tiangong-lca/pcr 0.0.0-stage → 0.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/LICENSE +21 -0
- package/NOTICE.md +5 -0
- package/README.md +107 -2
- package/node_modules/ajv/.runkit_example.js +23 -0
- package/node_modules/ajv/LICENSE +22 -0
- package/node_modules/ajv/README.md +207 -0
- package/node_modules/ajv/dist/2019.d.ts +19 -0
- package/node_modules/ajv/dist/2019.js +61 -0
- package/node_modules/ajv/dist/2019.js.map +1 -0
- package/node_modules/ajv/dist/2020.d.ts +19 -0
- package/node_modules/ajv/dist/2020.js +55 -0
- package/node_modules/ajv/dist/2020.js.map +1 -0
- package/node_modules/ajv/dist/ajv.d.ts +18 -0
- package/node_modules/ajv/dist/ajv.js +50 -0
- package/node_modules/ajv/dist/ajv.js.map +1 -0
- package/node_modules/ajv/dist/compile/codegen/code.d.ts +40 -0
- package/node_modules/ajv/dist/compile/codegen/code.js +156 -0
- package/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
- package/node_modules/ajv/dist/compile/codegen/index.d.ts +79 -0
- package/node_modules/ajv/dist/compile/codegen/index.js +697 -0
- package/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
- package/node_modules/ajv/dist/compile/codegen/scope.d.ts +79 -0
- package/node_modules/ajv/dist/compile/codegen/scope.js +143 -0
- package/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
- package/node_modules/ajv/dist/compile/errors.d.ts +13 -0
- package/node_modules/ajv/dist/compile/errors.js +123 -0
- package/node_modules/ajv/dist/compile/errors.js.map +1 -0
- package/node_modules/ajv/dist/compile/index.d.ts +80 -0
- package/node_modules/ajv/dist/compile/index.js +242 -0
- package/node_modules/ajv/dist/compile/index.js.map +1 -0
- package/node_modules/ajv/dist/compile/jtd/parse.d.ts +4 -0
- package/node_modules/ajv/dist/compile/jtd/parse.js +350 -0
- package/node_modules/ajv/dist/compile/jtd/parse.js.map +1 -0
- package/node_modules/ajv/dist/compile/jtd/serialize.d.ts +4 -0
- package/node_modules/ajv/dist/compile/jtd/serialize.js +236 -0
- package/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -0
- package/node_modules/ajv/dist/compile/jtd/types.d.ts +6 -0
- package/node_modules/ajv/dist/compile/jtd/types.js +14 -0
- package/node_modules/ajv/dist/compile/jtd/types.js.map +1 -0
- package/node_modules/ajv/dist/compile/names.d.ts +20 -0
- package/node_modules/ajv/dist/compile/names.js +28 -0
- package/node_modules/ajv/dist/compile/names.js.map +1 -0
- package/node_modules/ajv/dist/compile/ref_error.d.ts +6 -0
- package/node_modules/ajv/dist/compile/ref_error.js +12 -0
- package/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
- package/node_modules/ajv/dist/compile/resolve.d.ts +12 -0
- package/node_modules/ajv/dist/compile/resolve.js +155 -0
- package/node_modules/ajv/dist/compile/resolve.js.map +1 -0
- package/node_modules/ajv/dist/compile/rules.d.ts +28 -0
- package/node_modules/ajv/dist/compile/rules.js +26 -0
- package/node_modules/ajv/dist/compile/rules.js.map +1 -0
- package/node_modules/ajv/dist/compile/util.d.ts +40 -0
- package/node_modules/ajv/dist/compile/util.js +178 -0
- package/node_modules/ajv/dist/compile/util.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/applicability.d.ts +6 -0
- package/node_modules/ajv/dist/compile/validate/applicability.js +19 -0
- package/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/boolSchema.d.ts +4 -0
- package/node_modules/ajv/dist/compile/validate/boolSchema.js +50 -0
- package/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/dataType.d.ts +17 -0
- package/node_modules/ajv/dist/compile/validate/dataType.js +203 -0
- package/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/defaults.d.ts +2 -0
- package/node_modules/ajv/dist/compile/validate/defaults.js +35 -0
- package/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/index.d.ts +42 -0
- package/node_modules/ajv/dist/compile/validate/index.js +520 -0
- package/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/keyword.d.ts +8 -0
- package/node_modules/ajv/dist/compile/validate/keyword.js +124 -0
- package/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/subschema.d.ts +47 -0
- package/node_modules/ajv/dist/compile/validate/subschema.js +81 -0
- package/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
- package/node_modules/ajv/dist/core.d.ts +174 -0
- package/node_modules/ajv/dist/core.js +618 -0
- package/node_modules/ajv/dist/core.js.map +1 -0
- package/node_modules/ajv/dist/jtd.d.ts +47 -0
- package/node_modules/ajv/dist/jtd.js +72 -0
- package/node_modules/ajv/dist/jtd.js.map +1 -0
- package/node_modules/ajv/dist/refs/data.json +13 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts +2 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.js +28 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map +1 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json +53 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json +17 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json +57 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json +14 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json +37 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json +90 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json +39 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts +2 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +30 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map +1 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json +48 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json +17 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json +51 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json +37 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json +90 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json +55 -0
- package/node_modules/ajv/dist/refs/json-schema-draft-06.json +137 -0
- package/node_modules/ajv/dist/refs/json-schema-draft-07.json +151 -0
- package/node_modules/ajv/dist/refs/json-schema-secure.json +88 -0
- package/node_modules/ajv/dist/refs/jtd-schema.d.ts +3 -0
- package/node_modules/ajv/dist/refs/jtd-schema.js +118 -0
- package/node_modules/ajv/dist/refs/jtd-schema.js.map +1 -0
- package/node_modules/ajv/dist/runtime/equal.d.ts +6 -0
- package/node_modules/ajv/dist/runtime/equal.js +7 -0
- package/node_modules/ajv/dist/runtime/equal.js.map +1 -0
- package/node_modules/ajv/dist/runtime/parseJson.d.ts +18 -0
- package/node_modules/ajv/dist/runtime/parseJson.js +185 -0
- package/node_modules/ajv/dist/runtime/parseJson.js.map +1 -0
- package/node_modules/ajv/dist/runtime/quote.d.ts +5 -0
- package/node_modules/ajv/dist/runtime/quote.js +30 -0
- package/node_modules/ajv/dist/runtime/quote.js.map +1 -0
- package/node_modules/ajv/dist/runtime/re2.d.ts +6 -0
- package/node_modules/ajv/dist/runtime/re2.js +6 -0
- package/node_modules/ajv/dist/runtime/re2.js.map +1 -0
- package/node_modules/ajv/dist/runtime/timestamp.d.ts +5 -0
- package/node_modules/ajv/dist/runtime/timestamp.js +42 -0
- package/node_modules/ajv/dist/runtime/timestamp.js.map +1 -0
- package/node_modules/ajv/dist/runtime/ucs2length.d.ts +5 -0
- package/node_modules/ajv/dist/runtime/ucs2length.js +24 -0
- package/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
- package/node_modules/ajv/dist/runtime/uri.d.ts +6 -0
- package/node_modules/ajv/dist/runtime/uri.js +6 -0
- package/node_modules/ajv/dist/runtime/uri.js.map +1 -0
- package/node_modules/ajv/dist/runtime/validation_error.d.ts +7 -0
- package/node_modules/ajv/dist/runtime/validation_error.js +11 -0
- package/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
- package/node_modules/ajv/dist/standalone/index.d.ts +6 -0
- package/node_modules/ajv/dist/standalone/index.js +90 -0
- package/node_modules/ajv/dist/standalone/index.js.map +1 -0
- package/node_modules/ajv/dist/standalone/instance.d.ts +12 -0
- package/node_modules/ajv/dist/standalone/instance.js +35 -0
- package/node_modules/ajv/dist/standalone/instance.js.map +1 -0
- package/node_modules/ajv/dist/types/index.d.ts +183 -0
- package/node_modules/ajv/dist/types/index.js +3 -0
- package/node_modules/ajv/dist/types/index.js.map +1 -0
- package/node_modules/ajv/dist/types/json-schema.d.ts +125 -0
- package/node_modules/ajv/dist/types/json-schema.js +3 -0
- package/node_modules/ajv/dist/types/json-schema.js.map +1 -0
- package/node_modules/ajv/dist/types/jtd-schema.d.ts +174 -0
- package/node_modules/ajv/dist/types/jtd-schema.js +3 -0
- package/node_modules/ajv/dist/types/jtd-schema.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +49 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +106 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.js +23 -0
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +12 -0
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts +7 -0
- package/node_modules/ajv/dist/vocabularies/applicator/contains.js +95 -0
- package/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts +21 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +85 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +11 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/if.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/if.js +66 -0
- package/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/index.d.ts +13 -0
- package/node_modules/ajv/dist/vocabularies/applicator/index.js +44 -0
- package/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items.js +52 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.js +30 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/not.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/applicator/not.js +26 -0
- package/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +60 -0
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +75 -0
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +12 -0
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/properties.js +54 -0
- package/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +38 -0
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +13 -0
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/code.d.ts +17 -0
- package/node_modules/ajv/dist/vocabularies/code.js +131 -0
- package/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/core/id.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/core/id.js +10 -0
- package/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/core/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/core/index.js +16 -0
- package/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/core/ref.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/core/ref.js +122 -0
- package/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/index.js +104 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts +10 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/types.js +9 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/draft2020.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/draft2020.js +23 -0
- package/node_modules/ajv/dist/vocabularies/draft2020.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/draft7.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/draft7.js +17 -0
- package/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +30 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +51 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/index.js +9 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +16 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +10 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/errors.d.ts +9 -0
- package/node_modules/ajv/dist/vocabularies/errors.js +3 -0
- package/node_modules/ajv/dist/vocabularies/errors.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/format/format.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
- package/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/format/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/format/index.js +6 -0
- package/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.js +71 -0
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/jtd/elements.js +24 -0
- package/node_modules/ajv/dist/vocabularies/jtd/elements.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/jtd/enum.js +43 -0
- package/node_modules/ajv/dist/vocabularies/jtd/enum.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/error.d.ts +9 -0
- package/node_modules/ajv/dist/vocabularies/jtd/error.js +20 -0
- package/node_modules/ajv/dist/vocabularies/jtd/error.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/index.d.ts +10 -0
- package/node_modules/ajv/dist/vocabularies/jtd/index.js +29 -0
- package/node_modules/ajv/dist/vocabularies/jtd/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.js +25 -0
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.js +22 -0
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js +15 -0
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts +22 -0
- package/node_modules/ajv/dist/vocabularies/jtd/properties.js +149 -0
- package/node_modules/ajv/dist/vocabularies/jtd/properties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/jtd/ref.js +67 -0
- package/node_modules/ajv/dist/vocabularies/jtd/ref.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/type.d.ts +10 -0
- package/node_modules/ajv/dist/vocabularies/jtd/type.js +69 -0
- package/node_modules/ajv/dist/vocabularies/jtd/type.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/union.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/jtd/union.js +12 -0
- package/node_modules/ajv/dist/vocabularies/jtd/union.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/values.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/jtd/values.js +51 -0
- package/node_modules/ajv/dist/vocabularies/jtd/values.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/metadata.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/metadata.js +18 -0
- package/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/next.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/next.js +8 -0
- package/node_modules/ajv/dist/vocabularies/next.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.js +7 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +40 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +65 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/const.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/validation/const.js +25 -0
- package/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +12 -0
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/enum.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/enum.js +48 -0
- package/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/index.d.ts +16 -0
- package/node_modules/ajv/dist/vocabularies/validation/index.js +33 -0
- package/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.js +15 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.js +24 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.js +27 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts +11 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +27 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +24 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +26 -0
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/pattern.js +33 -0
- package/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/required.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/required.js +79 -0
- package/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts +9 -0
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +64 -0
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
- package/node_modules/ajv/lib/2019.ts +81 -0
- package/node_modules/ajv/lib/2020.ts +75 -0
- package/node_modules/ajv/lib/ajv.ts +70 -0
- package/node_modules/ajv/lib/compile/codegen/code.ts +169 -0
- package/node_modules/ajv/lib/compile/codegen/index.ts +852 -0
- package/node_modules/ajv/lib/compile/codegen/scope.ts +215 -0
- package/node_modules/ajv/lib/compile/errors.ts +184 -0
- package/node_modules/ajv/lib/compile/index.ts +324 -0
- package/node_modules/ajv/lib/compile/jtd/parse.ts +411 -0
- package/node_modules/ajv/lib/compile/jtd/serialize.ts +277 -0
- package/node_modules/ajv/lib/compile/jtd/types.ts +16 -0
- package/node_modules/ajv/lib/compile/names.ts +27 -0
- package/node_modules/ajv/lib/compile/ref_error.ts +13 -0
- package/node_modules/ajv/lib/compile/resolve.ts +149 -0
- package/node_modules/ajv/lib/compile/rules.ts +50 -0
- package/node_modules/ajv/lib/compile/util.ts +213 -0
- package/node_modules/ajv/lib/compile/validate/applicability.ts +22 -0
- package/node_modules/ajv/lib/compile/validate/boolSchema.ts +47 -0
- package/node_modules/ajv/lib/compile/validate/dataType.ts +230 -0
- package/node_modules/ajv/lib/compile/validate/defaults.ts +32 -0
- package/node_modules/ajv/lib/compile/validate/index.ts +582 -0
- package/node_modules/ajv/lib/compile/validate/keyword.ts +171 -0
- package/node_modules/ajv/lib/compile/validate/subschema.ts +135 -0
- package/node_modules/ajv/lib/core.ts +892 -0
- package/node_modules/ajv/lib/jtd.ts +132 -0
- package/node_modules/ajv/lib/refs/data.json +13 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts +28 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json +53 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json +17 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json +57 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json +14 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json +37 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json +90 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json +39 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts +30 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json +48 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json +17 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json +51 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json +37 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json +90 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json +55 -0
- package/node_modules/ajv/lib/refs/json-schema-draft-06.json +137 -0
- package/node_modules/ajv/lib/refs/json-schema-draft-07.json +151 -0
- package/node_modules/ajv/lib/refs/json-schema-secure.json +88 -0
- package/node_modules/ajv/lib/refs/jtd-schema.ts +130 -0
- package/node_modules/ajv/lib/runtime/equal.ts +7 -0
- package/node_modules/ajv/lib/runtime/parseJson.ts +177 -0
- package/node_modules/ajv/lib/runtime/quote.ts +31 -0
- package/node_modules/ajv/lib/runtime/re2.ts +6 -0
- package/node_modules/ajv/lib/runtime/timestamp.ts +46 -0
- package/node_modules/ajv/lib/runtime/ucs2length.ts +20 -0
- package/node_modules/ajv/lib/runtime/uri.ts +6 -0
- package/node_modules/ajv/lib/runtime/validation_error.ts +13 -0
- package/node_modules/ajv/lib/standalone/index.ts +100 -0
- package/node_modules/ajv/lib/standalone/instance.ts +36 -0
- package/node_modules/ajv/lib/types/index.ts +244 -0
- package/node_modules/ajv/lib/types/json-schema.ts +187 -0
- package/node_modules/ajv/lib/types/jtd-schema.ts +273 -0
- package/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts +56 -0
- package/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +118 -0
- package/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +22 -0
- package/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts +14 -0
- package/node_modules/ajv/lib/vocabularies/applicator/contains.ts +109 -0
- package/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts +112 -0
- package/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts +11 -0
- package/node_modules/ajv/lib/vocabularies/applicator/if.ts +80 -0
- package/node_modules/ajv/lib/vocabularies/applicator/index.ts +53 -0
- package/node_modules/ajv/lib/vocabularies/applicator/items.ts +59 -0
- package/node_modules/ajv/lib/vocabularies/applicator/items2020.ts +36 -0
- package/node_modules/ajv/lib/vocabularies/applicator/not.ts +38 -0
- package/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts +82 -0
- package/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts +91 -0
- package/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts +12 -0
- package/node_modules/ajv/lib/vocabularies/applicator/properties.ts +57 -0
- package/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts +50 -0
- package/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts +13 -0
- package/node_modules/ajv/lib/vocabularies/code.ts +168 -0
- package/node_modules/ajv/lib/vocabularies/core/id.ts +10 -0
- package/node_modules/ajv/lib/vocabularies/core/index.ts +16 -0
- package/node_modules/ajv/lib/vocabularies/core/ref.ts +129 -0
- package/node_modules/ajv/lib/vocabularies/discriminator/index.ts +113 -0
- package/node_modules/ajv/lib/vocabularies/discriminator/types.ts +12 -0
- package/node_modules/ajv/lib/vocabularies/draft2020.ts +23 -0
- package/node_modules/ajv/lib/vocabularies/draft7.ts +17 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts +31 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts +51 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/index.ts +9 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts +14 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts +10 -0
- package/node_modules/ajv/lib/vocabularies/errors.ts +18 -0
- package/node_modules/ajv/lib/vocabularies/format/format.ts +120 -0
- package/node_modules/ajv/lib/vocabularies/format/index.ts +6 -0
- package/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts +89 -0
- package/node_modules/ajv/lib/vocabularies/jtd/elements.ts +32 -0
- package/node_modules/ajv/lib/vocabularies/jtd/enum.ts +45 -0
- package/node_modules/ajv/lib/vocabularies/jtd/error.ts +23 -0
- package/node_modules/ajv/lib/vocabularies/jtd/index.ts +37 -0
- package/node_modules/ajv/lib/vocabularies/jtd/metadata.ts +24 -0
- package/node_modules/ajv/lib/vocabularies/jtd/nullable.ts +21 -0
- package/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts +15 -0
- package/node_modules/ajv/lib/vocabularies/jtd/properties.ts +184 -0
- package/node_modules/ajv/lib/vocabularies/jtd/ref.ts +76 -0
- package/node_modules/ajv/lib/vocabularies/jtd/type.ts +75 -0
- package/node_modules/ajv/lib/vocabularies/jtd/union.ts +12 -0
- package/node_modules/ajv/lib/vocabularies/jtd/values.ts +58 -0
- package/node_modules/ajv/lib/vocabularies/metadata.ts +17 -0
- package/node_modules/ajv/lib/vocabularies/next.ts +8 -0
- package/node_modules/ajv/lib/vocabularies/unevaluated/index.ts +7 -0
- package/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts +47 -0
- package/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +85 -0
- package/node_modules/ajv/lib/vocabularies/validation/const.ts +28 -0
- package/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts +23 -0
- package/node_modules/ajv/lib/vocabularies/validation/enum.ts +54 -0
- package/node_modules/ajv/lib/vocabularies/validation/index.ts +49 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitContains.ts +16 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitItems.ts +26 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitLength.ts +30 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts +42 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts +26 -0
- package/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts +34 -0
- package/node_modules/ajv/lib/vocabularies/validation/pattern.ts +39 -0
- package/node_modules/ajv/lib/vocabularies/validation/required.ts +98 -0
- package/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts +79 -0
- package/node_modules/ajv/package.json +126 -0
- package/node_modules/fast-deep-equal/LICENSE +21 -0
- package/node_modules/fast-deep-equal/README.md +96 -0
- package/node_modules/fast-deep-equal/es6/index.d.ts +2 -0
- package/node_modules/fast-deep-equal/es6/index.js +72 -0
- package/node_modules/fast-deep-equal/es6/react.d.ts +2 -0
- package/node_modules/fast-deep-equal/es6/react.js +79 -0
- package/node_modules/fast-deep-equal/index.d.ts +4 -0
- package/node_modules/fast-deep-equal/index.js +46 -0
- package/node_modules/fast-deep-equal/package.json +61 -0
- package/node_modules/fast-deep-equal/react.d.ts +2 -0
- package/node_modules/fast-deep-equal/react.js +53 -0
- package/node_modules/fast-uri/.gitattributes +2 -0
- package/node_modules/fast-uri/.github/dependabot.yml +13 -0
- package/node_modules/fast-uri/.github/workflows/ci.yml +106 -0
- package/node_modules/fast-uri/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +24 -0
- package/node_modules/fast-uri/LICENSE +30 -0
- package/node_modules/fast-uri/README.md +152 -0
- package/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
- package/node_modules/fast-uri/benchmark/equal.mjs +51 -0
- package/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
- package/node_modules/fast-uri/benchmark/package.json +17 -0
- package/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
- package/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
- package/node_modules/fast-uri/eslint.config.js +6 -0
- package/node_modules/fast-uri/index.js +627 -0
- package/node_modules/fast-uri/lib/schemes.js +272 -0
- package/node_modules/fast-uri/lib/utils.js +747 -0
- package/node_modules/fast-uri/package.json +68 -0
- package/node_modules/fast-uri/test/ajv.test.js +43 -0
- package/node_modules/fast-uri/test/component-safe-serialization.test.js +163 -0
- package/node_modules/fast-uri/test/equal.test.js +145 -0
- package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +503 -0
- package/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
- package/node_modules/fast-uri/test/ipv6-canonical.test.js +34 -0
- package/node_modules/fast-uri/test/ipv6-validation.test.js +124 -0
- package/node_modules/fast-uri/test/malformed-percent.test.js +77 -0
- package/node_modules/fast-uri/test/malformed-urn.test.js +61 -0
- package/node_modules/fast-uri/test/parse.test.js +327 -0
- package/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
- package/node_modules/fast-uri/test/reserved-path-normalization.test.js +109 -0
- package/node_modules/fast-uri/test/resolve.test.js +87 -0
- package/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
- package/node_modules/fast-uri/test/scheme-validation.test.js +124 -0
- package/node_modules/fast-uri/test/security-normalization.test.js +140 -0
- package/node_modules/fast-uri/test/security.test.js +431 -0
- package/node_modules/fast-uri/test/serialize.test.js +151 -0
- package/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
- package/node_modules/fast-uri/test/uri-js.test.js +912 -0
- package/node_modules/fast-uri/test/urn-full-input.test.js +29 -0
- package/node_modules/fast-uri/test/util.test.js +38 -0
- package/node_modules/fast-uri/test/websocket-query-preservation.test.js +24 -0
- package/node_modules/fast-uri/tsconfig.json +9 -0
- package/node_modules/fast-uri/types/index.d.ts +60 -0
- package/node_modules/fast-uri/types/index.test-d.ts +17 -0
- package/node_modules/json-schema-traverse/.eslintrc.yml +27 -0
- package/node_modules/json-schema-traverse/.github/FUNDING.yml +2 -0
- package/node_modules/json-schema-traverse/.github/workflows/build.yml +28 -0
- package/node_modules/json-schema-traverse/.github/workflows/publish.yml +27 -0
- package/node_modules/json-schema-traverse/LICENSE +21 -0
- package/node_modules/json-schema-traverse/README.md +95 -0
- package/node_modules/json-schema-traverse/index.d.ts +40 -0
- package/node_modules/json-schema-traverse/index.js +93 -0
- package/node_modules/json-schema-traverse/package.json +43 -0
- package/node_modules/json-schema-traverse/spec/.eslintrc.yml +6 -0
- package/node_modules/json-schema-traverse/spec/fixtures/schema.js +125 -0
- package/node_modules/json-schema-traverse/spec/index.spec.js +171 -0
- package/node_modules/require-from-string/index.js +34 -0
- package/node_modules/require-from-string/license +21 -0
- package/node_modules/require-from-string/package.json +28 -0
- package/node_modules/require-from-string/readme.md +56 -0
- package/package.json +33 -4
- package/packages/pcr-core/schemas/agent-review.schema.json +69 -0
- package/packages/pcr-core/schemas/classification-coverage.schema.json +187 -0
- package/packages/pcr-core/schemas/controlled-vocabulary.schema.json +189 -0
- package/packages/pcr-core/schemas/dataset-validation-input.schema.json +7 -0
- package/packages/pcr-core/schemas/feedback-draft-output.schema.json +12 -0
- package/packages/pcr-core/schemas/feedback.schema.json +27 -0
- package/packages/pcr-core/schemas/guidance-output.schema.json +97 -0
- package/packages/pcr-core/schemas/model-validation-input.schema.json +10 -0
- package/packages/pcr-core/schemas/pcr-id-aliases.schema.json +120 -0
- package/packages/pcr-core/schemas/readiness.schema.json +100 -0
- package/packages/pcr-core/schemas/structured-projection.schema.json +269 -0
- package/packages/pcr-core/schemas/validation-output.schema.json +117 -0
- package/packages/pcr-core/src/classification-coverage.mjs +732 -0
- package/packages/pcr-core/src/consumption-calculation.mjs +53 -0
- package/packages/pcr-core/src/consumption-data.mjs +88 -0
- package/packages/pcr-core/src/consumption-guidance.mjs +62 -0
- package/packages/pcr-core/src/consumption-review.mjs +83 -0
- package/packages/pcr-core/src/contracts.mjs +195 -0
- package/packages/pcr-core/src/generated/controlled-vocabulary.mjs +41 -0
- package/packages/pcr-core/src/index.mjs +2101 -0
- package/packages/pcr-core/src/languages.mjs +86 -0
- package/packages/pcr-core/src/offline-library.mjs +121 -0
- package/packages/pcr-core/src/output-semantics.mjs +228 -0
- package/packages/pcr-core/src/pcr-id-aliases.mjs +949 -0
- package/packages/pcr-core/src/projection-completeness.mjs +284 -0
- package/packages/pcr-core/src/projection-integrity.mjs +208 -0
- package/packages/pcr-core/src/read-context.mjs +505 -0
- package/packages/pcr-core/src/schema-validation.mjs +142 -0
- package/packages/pcr-core/src/source-context.mjs +13 -0
- package/packages/pcr-core/src/tidas-inspection.mjs +177 -0
- package/packages/pcr-core/src/yaml-lite.mjs +261 -0
- package/packages/tiangong-pcr-cli/bin/tiangong-pcr.mjs +12 -0
- package/packages/tiangong-pcr-cli/src/commands.mjs +1691 -0
- package/skills/tiangong-pcr/SKILL.md +90 -0
- package/skills/tiangong-pcr/references/cli-usage.md +66 -0
- package/skills/tiangong-pcr/references/feedback-loop.md +16 -0
- package/skills/tiangong-pcr/references/lca-authoring.md +30 -0
- package/skills/tiangong-pcr/references/model-authoring-loop.md +6 -0
- package/skills/tiangong-pcr/references/reviewing-tidas.md +71 -0
- package/skills/tiangong-pcr/references/tidas-authoring.md +45 -0
|
@@ -0,0 +1,732 @@
|
|
|
1
|
+
import { pcrSource } from "./source-context.mjs";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import {
|
|
4
|
+
closeSync,
|
|
5
|
+
constants as fsConstants,
|
|
6
|
+
existsSync,
|
|
7
|
+
fstatSync,
|
|
8
|
+
lstatSync,
|
|
9
|
+
openSync,
|
|
10
|
+
readFileSync,
|
|
11
|
+
realpathSync,
|
|
12
|
+
} from "node:fs";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
import { TextDecoder } from "node:util";
|
|
15
|
+
|
|
16
|
+
import { assertCoreContract } from "./contracts.mjs";
|
|
17
|
+
import {
|
|
18
|
+
CLASSIFICATION_COVERAGE_STATUS_VALUES,
|
|
19
|
+
CLASSIFICATION_MAPPING_RELATION_VALUES,
|
|
20
|
+
} from "./generated/controlled-vocabulary.mjs";
|
|
21
|
+
import { parseYaml } from "./yaml-lite.mjs";
|
|
22
|
+
|
|
23
|
+
export const CLASSIFICATION_COVERAGE_STATUSES = CLASSIFICATION_COVERAGE_STATUS_VALUES;
|
|
24
|
+
export const CLASSIFICATION_COVERAGE_CONTRACT_VERSION = "2";
|
|
25
|
+
export const CLASSIFICATION_COVERAGE_GENERATOR = "builder/scripts/build-catalog.mjs";
|
|
26
|
+
export const CLASSIFICATION_COVERAGE_GENERATOR_VERSION = "2";
|
|
27
|
+
|
|
28
|
+
const CLASSIFICATION_MAPPING_RELATIONS = new Set(CLASSIFICATION_MAPPING_RELATION_VALUES);
|
|
29
|
+
|
|
30
|
+
export class PcrClassificationCoverageNotFoundError extends Error {
|
|
31
|
+
constructor({ system, version, relativePath }) {
|
|
32
|
+
super(`Classification coverage index not found for ${system}:${version}: ${relativePath}`);
|
|
33
|
+
this.name = "PcrClassificationCoverageNotFoundError";
|
|
34
|
+
this.code = "PCR_CLASSIFICATION_COVERAGE_NOT_FOUND";
|
|
35
|
+
this.details = {
|
|
36
|
+
classification: `${system}:${version}`,
|
|
37
|
+
coverage_index: relativePath,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class PcrClassificationCodeUnknownError extends Error {
|
|
43
|
+
constructor({ system, version, code }) {
|
|
44
|
+
super(`Classification code is not present in the coverage index: ${system}:${version}:${code}`);
|
|
45
|
+
this.name = "PcrClassificationCodeUnknownError";
|
|
46
|
+
this.code = "PCR_CLASSIFICATION_CODE_UNKNOWN";
|
|
47
|
+
this.details = { classification: `${system}:${version}:${code}` };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export class PcrClassificationCoverageSemanticError extends Error {
|
|
52
|
+
constructor({ system, version, source, issues }) {
|
|
53
|
+
super(
|
|
54
|
+
`Classification coverage index is inconsistent for ${system}:${version}: ${issues.join("; ")}`,
|
|
55
|
+
);
|
|
56
|
+
this.name = "PcrClassificationCoverageSemanticError";
|
|
57
|
+
this.code = "PCR_INVALID_CLASSIFICATION_COVERAGE";
|
|
58
|
+
this.details = {
|
|
59
|
+
classification: `${system}:${version}`,
|
|
60
|
+
source,
|
|
61
|
+
issues: [...issues],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export class PcrClassificationCoverageStatusError extends Error {
|
|
67
|
+
constructor(status) {
|
|
68
|
+
super(
|
|
69
|
+
`Unsupported classification coverage status ${String(status)}. Expected one of: ${CLASSIFICATION_COVERAGE_STATUSES.join(", ")}.`,
|
|
70
|
+
);
|
|
71
|
+
this.name = "PcrClassificationCoverageStatusError";
|
|
72
|
+
this.code = "PCR_INVALID_CLASSIFICATION_COVERAGE_STATUS";
|
|
73
|
+
this.details = {
|
|
74
|
+
status: String(status),
|
|
75
|
+
allowed_statuses: [...CLASSIFICATION_COVERAGE_STATUSES],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function classificationCoveragePath({ root, system, version }) {
|
|
81
|
+
const normalized = normalizeClassification({ system, version });
|
|
82
|
+
return path.join(
|
|
83
|
+
path.resolve(root),
|
|
84
|
+
"classifications/indexes",
|
|
85
|
+
`${normalized.system}-${normalized.version}-coverage.json`,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function hasClassificationCoverage({ root, system, version }) {
|
|
90
|
+
return existsSync(classificationCoveragePath({ root, system, version }));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function readClassificationCoverage({ root, system, version }) {
|
|
94
|
+
return readClassificationCoverageSnapshot({ root, system, version }).document;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function readClassificationCoverageSnapshot({ root, system, version }) {
|
|
98
|
+
if (pcrSource(root)) return pcrSource(root).coverageSnapshot(system, version);
|
|
99
|
+
const normalizedRoot = path.resolve(root);
|
|
100
|
+
const normalized = normalizeClassification({ system, version });
|
|
101
|
+
const coveragePath = classificationCoveragePath({
|
|
102
|
+
root: normalizedRoot,
|
|
103
|
+
system: normalized.system,
|
|
104
|
+
version: normalized.version,
|
|
105
|
+
});
|
|
106
|
+
const relativePath = toPosix(path.relative(normalizedRoot, coveragePath));
|
|
107
|
+
if (!existsSync(coveragePath)) {
|
|
108
|
+
throw new PcrClassificationCoverageNotFoundError({
|
|
109
|
+
...normalized,
|
|
110
|
+
relativePath,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
let coverageSource;
|
|
115
|
+
try {
|
|
116
|
+
coverageSource = readContainedUtf8RegularFile({
|
|
117
|
+
root: normalizedRoot,
|
|
118
|
+
relativePath,
|
|
119
|
+
label: "coverage index",
|
|
120
|
+
});
|
|
121
|
+
} catch (error) {
|
|
122
|
+
throw new PcrClassificationCoverageSemanticError({
|
|
123
|
+
...normalized,
|
|
124
|
+
source: relativePath,
|
|
125
|
+
issues: [error instanceof Error ? error.message : String(error)],
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
let coverage;
|
|
130
|
+
try {
|
|
131
|
+
coverage = JSON.parse(coverageSource.text);
|
|
132
|
+
} catch (error) {
|
|
133
|
+
throw new PcrClassificationCoverageSemanticError({
|
|
134
|
+
...normalized,
|
|
135
|
+
source: relativePath,
|
|
136
|
+
issues: [`invalid JSON (${error instanceof Error ? error.message : String(error)})`],
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
assertCoreContract("classification-coverage.schema.json", coverage, {
|
|
141
|
+
code: "PCR_INVALID_CLASSIFICATION_COVERAGE",
|
|
142
|
+
entityKind: "Classification coverage index",
|
|
143
|
+
source: relativePath,
|
|
144
|
+
});
|
|
145
|
+
assertCoverageSemantics({ coverage, normalized, source: relativePath });
|
|
146
|
+
assertCoverageSources({
|
|
147
|
+
coverage,
|
|
148
|
+
normalized,
|
|
149
|
+
root: normalizedRoot,
|
|
150
|
+
source: relativePath,
|
|
151
|
+
});
|
|
152
|
+
return Object.freeze({
|
|
153
|
+
document: structuredClone(coverage),
|
|
154
|
+
relative_path: relativePath,
|
|
155
|
+
sha256: exactByteSha256(coverageSource.bytes),
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function getClassificationCoverageSummary({ root, system, version }) {
|
|
160
|
+
const coverage = readClassificationCoverage({ root, system, version });
|
|
161
|
+
return {
|
|
162
|
+
schema_version: coverage.schema_version,
|
|
163
|
+
index_kind: coverage.index_kind,
|
|
164
|
+
classification_system: coverage.classification_system,
|
|
165
|
+
classification_version: coverage.classification_version,
|
|
166
|
+
source: structuredClone(coverage.source),
|
|
167
|
+
summary: structuredClone(coverage.summary),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function listClassificationCoverage({ root, system, version, status = null }) {
|
|
172
|
+
if (status !== null && !CLASSIFICATION_COVERAGE_STATUSES.includes(String(status))) {
|
|
173
|
+
throw new PcrClassificationCoverageStatusError(status);
|
|
174
|
+
}
|
|
175
|
+
const coverage = readClassificationCoverage({ root, system, version });
|
|
176
|
+
const entries = status === null
|
|
177
|
+
? coverage.entries
|
|
178
|
+
: coverage.entries.filter((entry) => entry.coverage_status === String(status));
|
|
179
|
+
return {
|
|
180
|
+
classification_system: coverage.classification_system,
|
|
181
|
+
classification_version: coverage.classification_version,
|
|
182
|
+
available_statuses: [...CLASSIFICATION_COVERAGE_STATUSES],
|
|
183
|
+
entries: structuredClone(entries),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function findClassificationCoverageEntry({ root, system, version, code }) {
|
|
188
|
+
const coverage = readClassificationCoverage({ root, system, version });
|
|
189
|
+
const entry = coverage.entries.find((candidate) => String(candidate.code) === String(code));
|
|
190
|
+
if (!entry) {
|
|
191
|
+
throw new PcrClassificationCodeUnknownError({
|
|
192
|
+
system: String(system).toLowerCase(),
|
|
193
|
+
version: String(version),
|
|
194
|
+
code: String(code),
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
return structuredClone(entry);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function normalizeClassification({ system, version }) {
|
|
201
|
+
const normalizedSystem = String(system).toLowerCase();
|
|
202
|
+
const normalizedVersion = String(version);
|
|
203
|
+
if (!/^[a-z0-9][a-z0-9_-]*$/u.test(normalizedSystem)) {
|
|
204
|
+
throw new Error(`Unsupported classification system token: ${String(system)}`);
|
|
205
|
+
}
|
|
206
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(normalizedVersion)) {
|
|
207
|
+
throw new Error(`Unsupported classification version token: ${String(version)}`);
|
|
208
|
+
}
|
|
209
|
+
return { system: normalizedSystem, version: normalizedVersion };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function assertCoverageSemantics({ coverage, normalized, source }) {
|
|
213
|
+
const issues = [];
|
|
214
|
+
if (String(coverage.classification_system).toLowerCase() !== normalized.system) {
|
|
215
|
+
issues.push(
|
|
216
|
+
`classification_system ${String(coverage.classification_system)} does not match ${normalized.system}`,
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
if (String(coverage.classification_version) !== normalized.version) {
|
|
220
|
+
issues.push(
|
|
221
|
+
`classification_version ${String(coverage.classification_version)} does not match ${normalized.version}`,
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const seenCodes = new Set();
|
|
226
|
+
const statusCounts = Object.fromEntries(
|
|
227
|
+
CLASSIFICATION_COVERAGE_STATUSES.map((status) => [status, 0]),
|
|
228
|
+
);
|
|
229
|
+
for (const entry of coverage.entries) {
|
|
230
|
+
if (seenCodes.has(entry.code)) {
|
|
231
|
+
issues.push(`duplicate entry code ${entry.code}`);
|
|
232
|
+
}
|
|
233
|
+
seenCodes.add(entry.code);
|
|
234
|
+
statusCounts[entry.coverage_status] += 1;
|
|
235
|
+
if (entry.path_codes.length !== entry.path_titles.length) {
|
|
236
|
+
issues.push(`entry ${entry.code} has mismatched path_codes and path_titles lengths`);
|
|
237
|
+
}
|
|
238
|
+
if (entry.coverage_status === "mapped" && !entry.mapping) {
|
|
239
|
+
issues.push(`mapped entry ${entry.code} has no mapping`);
|
|
240
|
+
}
|
|
241
|
+
if (entry.mapping && !isProjectedMapping(entry.mapping)) {
|
|
242
|
+
issues.push(`entry ${entry.code} has a mapping without an accepted decision projection`);
|
|
243
|
+
}
|
|
244
|
+
if (
|
|
245
|
+
["unmapped", "candidate_suggestion", "manual_review"].includes(entry.coverage_status)
|
|
246
|
+
&& entry.mapping
|
|
247
|
+
) {
|
|
248
|
+
issues.push(`${entry.coverage_status} entry ${entry.code} cannot carry an accepted mapping`);
|
|
249
|
+
}
|
|
250
|
+
if (entry.mapping && entry.legacy_reference) {
|
|
251
|
+
issues.push(`entry ${entry.code} cannot be both a material mapping and a legacy reference`);
|
|
252
|
+
}
|
|
253
|
+
if (entry.legacy_reference && entry.coverage_status !== "unmapped") {
|
|
254
|
+
issues.push(`legacy reference entry ${entry.code} must have coverage_status unmapped`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (coverage.summary.total !== coverage.entries.length) {
|
|
258
|
+
issues.push(
|
|
259
|
+
`summary.total ${coverage.summary.total} does not match entries length ${coverage.entries.length}`,
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
for (const status of CLASSIFICATION_COVERAGE_STATUSES) {
|
|
263
|
+
if (coverage.summary[status] !== statusCounts[status]) {
|
|
264
|
+
issues.push(
|
|
265
|
+
`summary.${status} ${coverage.summary[status]} does not match entry count ${statusCounts[status]}`,
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (issues.length > 0) {
|
|
271
|
+
throw new PcrClassificationCoverageSemanticError({
|
|
272
|
+
...normalized,
|
|
273
|
+
source,
|
|
274
|
+
issues,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function assertCoverageSources({ coverage, normalized, root, source }) {
|
|
280
|
+
const issues = [];
|
|
281
|
+
const verifiedSources = {};
|
|
282
|
+
for (const [sourceName, descriptor, canonicalPath] of [
|
|
283
|
+
[
|
|
284
|
+
"normalized_leaves",
|
|
285
|
+
coverage.source.normalized_leaves,
|
|
286
|
+
canonicalNormalizedLeavesPath(normalized),
|
|
287
|
+
],
|
|
288
|
+
["mapping", coverage.source.mapping, canonicalMappingPath(normalized)],
|
|
289
|
+
]) {
|
|
290
|
+
if (descriptor.path !== canonicalPath) {
|
|
291
|
+
issues.push(sourcePathBindingIssue({ sourceName, descriptor, canonicalPath, normalized }));
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
let sourceFile;
|
|
296
|
+
try {
|
|
297
|
+
sourceFile = readContainedUtf8RegularFile({
|
|
298
|
+
root,
|
|
299
|
+
relativePath: canonicalPath,
|
|
300
|
+
label: `source ${sourceName}`,
|
|
301
|
+
});
|
|
302
|
+
} catch (error) {
|
|
303
|
+
issues.push(error instanceof Error ? error.message : String(error));
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
const actualSha256 = exactByteSha256(sourceFile.bytes);
|
|
307
|
+
if (actualSha256 !== descriptor.sha256) {
|
|
308
|
+
issues.push(
|
|
309
|
+
`source ${sourceName} exact-byte SHA-256 mismatch: expected ${descriptor.sha256}, received ${actualSha256}`,
|
|
310
|
+
);
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
verifiedSources[sourceName] = sourceFile;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (verifiedSources.normalized_leaves && verifiedSources.mapping) {
|
|
317
|
+
let normalizedLeaves;
|
|
318
|
+
let mapping;
|
|
319
|
+
try {
|
|
320
|
+
normalizedLeaves = JSON.parse(verifiedSources.normalized_leaves.text);
|
|
321
|
+
} catch (error) {
|
|
322
|
+
issues.push(
|
|
323
|
+
`source normalized_leaves is not valid JSON (${error instanceof Error ? error.message : String(error)})`,
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
try {
|
|
327
|
+
mapping = parseYaml(verifiedSources.mapping.text);
|
|
328
|
+
} catch (error) {
|
|
329
|
+
issues.push(
|
|
330
|
+
`source mapping is not valid YAML (${error instanceof Error ? error.message : String(error)})`,
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
if (normalizedLeaves && mapping) {
|
|
334
|
+
issues.push(
|
|
335
|
+
...coverageProjectionIssues({ coverage, normalized, normalizedLeaves, mapping }),
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
if (issues.length > 0) {
|
|
340
|
+
throw new PcrClassificationCoverageSemanticError({
|
|
341
|
+
...normalized,
|
|
342
|
+
source,
|
|
343
|
+
issues,
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function sourcePathBindingIssue({ sourceName, descriptor, canonicalPath, normalized }) {
|
|
349
|
+
const reportedPath = String(descriptor.path);
|
|
350
|
+
const normalizedPath = path.posix.normalize(reportedPath);
|
|
351
|
+
const escapesRoot = (
|
|
352
|
+
path.posix.isAbsolute(reportedPath)
|
|
353
|
+
|| normalizedPath === ".."
|
|
354
|
+
|| normalizedPath.startsWith("../")
|
|
355
|
+
);
|
|
356
|
+
const reason = escapesRoot
|
|
357
|
+
? "escapes the repository root and does not match"
|
|
358
|
+
: "does not match";
|
|
359
|
+
return `source ${sourceName} path ${reportedPath} ${reason} canonical path ${canonicalPath} for ${normalized.system}:${normalized.version}`;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function coverageProjectionIssues({ coverage, normalized, normalizedLeaves, mapping }) {
|
|
363
|
+
const issues = [];
|
|
364
|
+
if (
|
|
365
|
+
String(normalizedLeaves.classification_system).toLowerCase() !== normalized.system
|
|
366
|
+
|| String(normalizedLeaves.classification_version) !== normalized.version
|
|
367
|
+
) {
|
|
368
|
+
issues.push(
|
|
369
|
+
`source normalized_leaves coordinate ${String(normalizedLeaves.classification_system)}:${String(normalizedLeaves.classification_version)} does not match ${normalized.system}:${normalized.version}`,
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
if (
|
|
373
|
+
String(mapping.classification_system).toLowerCase() !== normalized.system
|
|
374
|
+
|| String(mapping.classification_version) !== normalized.version
|
|
375
|
+
) {
|
|
376
|
+
issues.push(
|
|
377
|
+
`source mapping coordinate ${String(mapping.classification_system)}:${String(mapping.classification_version)} does not match ${normalized.system}:${normalized.version}`,
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
if (mapping.schema_version !== 2 || mapping.status !== "current") {
|
|
381
|
+
issues.push("source mapping must use accepted-only schema_version 2 with status current");
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (!Array.isArray(normalizedLeaves.leaves)) {
|
|
385
|
+
issues.push("source normalized_leaves.leaves must be an array");
|
|
386
|
+
return issues;
|
|
387
|
+
}
|
|
388
|
+
if (!Array.isArray(mapping.mappings)) {
|
|
389
|
+
issues.push("source mapping.mappings must be an array");
|
|
390
|
+
return issues;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const leavesByCode = new Map();
|
|
394
|
+
for (const leaf of normalizedLeaves.leaves) {
|
|
395
|
+
const code = sourceCode(leaf);
|
|
396
|
+
if (code === null) {
|
|
397
|
+
issues.push("source normalized_leaves contains a leaf without a code");
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
if (!isProjectedLeaf(leaf)) {
|
|
401
|
+
issues.push(`source normalized leaf ${code} cannot be projected deterministically`);
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
if (leavesByCode.has(code)) {
|
|
405
|
+
issues.push(`source normalized_leaves contains duplicate code ${code}`);
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
leavesByCode.set(code, leaf);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const entriesByCode = new Map(coverage.entries.map((entry) => [String(entry.code), entry]));
|
|
412
|
+
const sourceCodes = [...leavesByCode.keys()].sort(compareText);
|
|
413
|
+
const entryCodes = coverage.entries.map((entry) => String(entry.code));
|
|
414
|
+
if (!sameStringArrays(entryCodes, sourceCodes)) {
|
|
415
|
+
issues.push("coverage entries do not match the deterministic normalized-leaf code order");
|
|
416
|
+
}
|
|
417
|
+
for (const code of sourceCodes) {
|
|
418
|
+
const leaf = leavesByCode.get(code);
|
|
419
|
+
const entry = entriesByCode.get(code);
|
|
420
|
+
if (!entry) {
|
|
421
|
+
issues.push(`coverage entries are missing normalized leaf ${code}`);
|
|
422
|
+
continue;
|
|
423
|
+
}
|
|
424
|
+
if (entry.label !== leaf.title) {
|
|
425
|
+
issues.push(`coverage entry ${code} label does not match normalized leaf title`);
|
|
426
|
+
}
|
|
427
|
+
if (!sameStringArrays(entry.path_codes, leaf.path_codes)) {
|
|
428
|
+
issues.push(`coverage entry ${code} path_codes do not match normalized leaf path_codes`);
|
|
429
|
+
}
|
|
430
|
+
if (!sameStringArrays(entry.path_titles, leaf.path_titles)) {
|
|
431
|
+
issues.push(`coverage entry ${code} path_titles do not match normalized leaf path_titles`);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
for (const code of entryCodes) {
|
|
435
|
+
if (!leavesByCode.has(code)) {
|
|
436
|
+
issues.push(`coverage entries contain code ${code} absent from normalized leaves`);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
const mappingsByCode = new Map();
|
|
441
|
+
for (const candidate of mapping.mappings) {
|
|
442
|
+
const code = sourceCode(candidate);
|
|
443
|
+
if (code === null) {
|
|
444
|
+
issues.push("source mapping contains an edge without a code");
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
if (!leavesByCode.has(code)) {
|
|
448
|
+
issues.push(`source mapping code ${code} is absent from normalized leaves`);
|
|
449
|
+
}
|
|
450
|
+
if (!isProjectedMapping(candidate)) {
|
|
451
|
+
issues.push(`source mapping for ${code} cannot be projected deterministically`);
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
if (mappingsByCode.has(code)) {
|
|
455
|
+
issues.push(`source mapping contains duplicate code ${code}`);
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
mappingsByCode.set(code, candidate);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
for (const [code, entry] of entriesByCode) {
|
|
462
|
+
const sourceMapping = mappingsByCode.get(code);
|
|
463
|
+
if (!sourceMapping) {
|
|
464
|
+
if (entry.mapping || entry.legacy_reference) {
|
|
465
|
+
issues.push(`coverage entry ${code} projects an edge absent from canonical mapping`);
|
|
466
|
+
}
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
if (entry.mapping) {
|
|
470
|
+
for (const field of ["pcr_id", "mapping_type", "confidence"]) {
|
|
471
|
+
if (entry.mapping[field] !== sourceMapping[field]) {
|
|
472
|
+
issues.push(`coverage entry ${code} mapping.${field} does not match canonical mapping`);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
for (const field of ["status", "decided_by", "decided_at_utc", "decision_ref"]) {
|
|
476
|
+
if (entry.mapping.acceptance?.[field] !== sourceMapping.acceptance?.[field]) {
|
|
477
|
+
issues.push(
|
|
478
|
+
`coverage entry ${code} mapping.acceptance.${field} does not match canonical mapping`,
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
if (entry.coverage_status !== "mapped") {
|
|
483
|
+
issues.push(
|
|
484
|
+
`coverage entry ${code} coverage_status ${entry.coverage_status} does not match accepted canonical mapping projection mapped`,
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
if (entry.legacy_reference) {
|
|
490
|
+
if (entry.legacy_reference.pcr_id !== sourceMapping.pcr_id) {
|
|
491
|
+
issues.push(`coverage entry ${code} legacy_reference.pcr_id does not match canonical mapping`);
|
|
492
|
+
}
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
issues.push(`coverage entry ${code} does not represent its canonical mapping edge`);
|
|
496
|
+
}
|
|
497
|
+
return issues;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function sourceCode(value) {
|
|
501
|
+
if (!value || typeof value !== "object" || value.code === undefined || value.code === null) {
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
const code = String(value.code);
|
|
505
|
+
return code.length > 0 ? code : null;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
function isProjectedLeaf(leaf) {
|
|
509
|
+
return (
|
|
510
|
+
leaf
|
|
511
|
+
&& typeof leaf === "object"
|
|
512
|
+
&& typeof leaf.title === "string"
|
|
513
|
+
&& leaf.title.length > 0
|
|
514
|
+
&& isStringArray(leaf.path_codes)
|
|
515
|
+
&& leaf.path_codes.length > 0
|
|
516
|
+
&& isStringArray(leaf.path_titles)
|
|
517
|
+
&& leaf.path_titles.length > 0
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
function isProjectedMapping(mapping) {
|
|
522
|
+
return (
|
|
523
|
+
mapping
|
|
524
|
+
&& typeof mapping === "object"
|
|
525
|
+
&& typeof mapping.pcr_id === "string"
|
|
526
|
+
&& mapping.pcr_id.startsWith("pcr.")
|
|
527
|
+
&& CLASSIFICATION_MAPPING_RELATIONS.has(mapping.mapping_type)
|
|
528
|
+
&& mapping.mapping_type !== "manual_review"
|
|
529
|
+
&& typeof mapping.confidence === "string"
|
|
530
|
+
&& mapping.confidence.length > 0
|
|
531
|
+
&& mapping.acceptance?.status === "accepted"
|
|
532
|
+
&& typeof mapping.acceptance?.decided_by === "string"
|
|
533
|
+
&& mapping.acceptance.decided_by.trim().length > 0
|
|
534
|
+
&& isCanonicalUtcTimestamp(mapping.acceptance?.decided_at_utc)
|
|
535
|
+
&& typeof mapping.acceptance?.decision_ref === "string"
|
|
536
|
+
&& mapping.acceptance.decision_ref.trim().length > 0
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function isCanonicalUtcTimestamp(value) {
|
|
541
|
+
const match = typeof value === "string"
|
|
542
|
+
? /^([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(?:\.[0-9]+)?Z$/u.exec(value)
|
|
543
|
+
: null;
|
|
544
|
+
if (!match) {
|
|
545
|
+
return false;
|
|
546
|
+
}
|
|
547
|
+
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
548
|
+
const parsed = new Date(0);
|
|
549
|
+
parsed.setUTCFullYear(year, month - 1, day);
|
|
550
|
+
parsed.setUTCHours(hour, minute, second, 0);
|
|
551
|
+
return (
|
|
552
|
+
parsed.getUTCFullYear() === year
|
|
553
|
+
&& parsed.getUTCMonth() === month - 1
|
|
554
|
+
&& parsed.getUTCDate() === day
|
|
555
|
+
&& parsed.getUTCHours() === hour
|
|
556
|
+
&& parsed.getUTCMinutes() === minute
|
|
557
|
+
&& parsed.getUTCSeconds() === second
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
function isStringArray(value) {
|
|
562
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
function sameStringArrays(left, right) {
|
|
566
|
+
return (
|
|
567
|
+
isStringArray(left)
|
|
568
|
+
&& isStringArray(right)
|
|
569
|
+
&& left.length === right.length
|
|
570
|
+
&& left.every((value, index) => value === right[index])
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function compareText(left, right) {
|
|
575
|
+
const normalizedLeft = String(left);
|
|
576
|
+
const normalizedRight = String(right);
|
|
577
|
+
return normalizedLeft < normalizedRight ? -1 : normalizedLeft > normalizedRight ? 1 : 0;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function canonicalNormalizedLeavesPath({ system, version }) {
|
|
581
|
+
return `classifications/systems/${system}/${version}/normalized/leaves.json`;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
function canonicalMappingPath({ system, version }) {
|
|
585
|
+
return `classifications/mappings/${system}-${version}-to-pcr.yaml`;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function readContainedUtf8RegularFile({ root, relativePath, label }) {
|
|
589
|
+
if (typeof relativePath !== "string" || relativePath.length === 0) {
|
|
590
|
+
throw new Error(`${label} path must be a non-empty repository-relative path`);
|
|
591
|
+
}
|
|
592
|
+
if (
|
|
593
|
+
path.posix.isAbsolute(relativePath)
|
|
594
|
+
|| relativePath.includes("\\")
|
|
595
|
+
|| path.posix.normalize(relativePath) !== relativePath
|
|
596
|
+
) {
|
|
597
|
+
throw new Error(`${label} path is not a canonical repository-relative path: ${relativePath}`);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
const resolvedRoot = path.resolve(root);
|
|
601
|
+
const resolvedPath = path.resolve(resolvedRoot, ...relativePath.split("/"));
|
|
602
|
+
const containedRelativePath = path.relative(resolvedRoot, resolvedPath);
|
|
603
|
+
if (
|
|
604
|
+
containedRelativePath.length === 0
|
|
605
|
+
|| containedRelativePath === ".."
|
|
606
|
+
|| containedRelativePath.startsWith(`..${path.sep}`)
|
|
607
|
+
|| path.isAbsolute(containedRelativePath)
|
|
608
|
+
) {
|
|
609
|
+
throw new Error(`${label} path escapes the repository root: ${relativePath}`);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
assertRegularPathChain({
|
|
613
|
+
resolvedRoot,
|
|
614
|
+
containedRelativePath,
|
|
615
|
+
relativePath,
|
|
616
|
+
label,
|
|
617
|
+
});
|
|
618
|
+
assertRealPathContained({
|
|
619
|
+
root: resolvedRoot,
|
|
620
|
+
candidate: resolvedPath,
|
|
621
|
+
label,
|
|
622
|
+
relativePath,
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
let descriptor;
|
|
626
|
+
let bytes;
|
|
627
|
+
try {
|
|
628
|
+
descriptor = openSync(
|
|
629
|
+
resolvedPath,
|
|
630
|
+
fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK,
|
|
631
|
+
);
|
|
632
|
+
const openedStats = fstatSync(descriptor);
|
|
633
|
+
if (!openedStats.isFile()) {
|
|
634
|
+
throw new Error(`${label} is not a regular file: ${relativePath}`);
|
|
635
|
+
}
|
|
636
|
+
const currentStats = assertRegularPathChain({
|
|
637
|
+
resolvedRoot,
|
|
638
|
+
containedRelativePath,
|
|
639
|
+
relativePath,
|
|
640
|
+
label,
|
|
641
|
+
});
|
|
642
|
+
assertRealPathContained({
|
|
643
|
+
root: resolvedRoot,
|
|
644
|
+
candidate: resolvedPath,
|
|
645
|
+
label,
|
|
646
|
+
relativePath,
|
|
647
|
+
});
|
|
648
|
+
if (openedStats.dev !== currentStats.dev || openedStats.ino !== currentStats.ino) {
|
|
649
|
+
throw new Error(`${label} path changed while it was being opened: ${relativePath}`);
|
|
650
|
+
}
|
|
651
|
+
bytes = readFileSync(descriptor);
|
|
652
|
+
} catch (error) {
|
|
653
|
+
if (error instanceof Error && error.message.startsWith(`${label} `)) {
|
|
654
|
+
throw error;
|
|
655
|
+
}
|
|
656
|
+
throw new Error(
|
|
657
|
+
`${label} could not be opened without following symbolic links: ${relativePath} (${error instanceof Error ? error.code ?? error.message : String(error)})`,
|
|
658
|
+
);
|
|
659
|
+
} finally {
|
|
660
|
+
if (descriptor !== undefined) {
|
|
661
|
+
closeSync(descriptor);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
return {
|
|
666
|
+
bytes,
|
|
667
|
+
text: decodeFatalUtf8(bytes, { label, relativePath }),
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
function assertRegularPathChain({ resolvedRoot, containedRelativePath, relativePath, label }) {
|
|
672
|
+
const segments = containedRelativePath.split(path.sep);
|
|
673
|
+
let currentPath = resolvedRoot;
|
|
674
|
+
let finalStats;
|
|
675
|
+
for (const [index, segment] of segments.entries()) {
|
|
676
|
+
currentPath = path.join(currentPath, segment);
|
|
677
|
+
let stats;
|
|
678
|
+
try {
|
|
679
|
+
stats = lstatSync(currentPath);
|
|
680
|
+
} catch (error) {
|
|
681
|
+
throw new Error(
|
|
682
|
+
`${label} does not exist at ${relativePath} (${error instanceof Error ? error.code ?? error.message : String(error)})`,
|
|
683
|
+
);
|
|
684
|
+
}
|
|
685
|
+
if (stats.isSymbolicLink()) {
|
|
686
|
+
throw new Error(`${label} path contains a symbolic link: ${relativePath}`);
|
|
687
|
+
}
|
|
688
|
+
const isLastSegment = index === segments.length - 1;
|
|
689
|
+
if (isLastSegment && !stats.isFile()) {
|
|
690
|
+
throw new Error(`${label} is not a regular file: ${relativePath}`);
|
|
691
|
+
}
|
|
692
|
+
if (!isLastSegment && !stats.isDirectory()) {
|
|
693
|
+
throw new Error(`${label} parent is not a directory: ${relativePath}`);
|
|
694
|
+
}
|
|
695
|
+
if (isLastSegment) {
|
|
696
|
+
finalStats = stats;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
return finalStats;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
function decodeFatalUtf8(bytes, { label, relativePath }) {
|
|
703
|
+
try {
|
|
704
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
705
|
+
} catch (error) {
|
|
706
|
+
throw new Error(
|
|
707
|
+
`${label} is not valid UTF-8: ${relativePath} (${error instanceof Error ? error.message : String(error)})`,
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
function assertRealPathContained({ root, candidate, label, relativePath }) {
|
|
713
|
+
const realRoot = realpathSync(root);
|
|
714
|
+
const realCandidate = realpathSync(candidate);
|
|
715
|
+
const realRelativePath = path.relative(realRoot, realCandidate);
|
|
716
|
+
if (
|
|
717
|
+
realRelativePath.length === 0
|
|
718
|
+
|| realRelativePath === ".."
|
|
719
|
+
|| realRelativePath.startsWith(`..${path.sep}`)
|
|
720
|
+
|| path.isAbsolute(realRelativePath)
|
|
721
|
+
) {
|
|
722
|
+
throw new Error(`${label} real path escapes the repository root: ${relativePath}`);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
function exactByteSha256(bytes) {
|
|
727
|
+
return `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
function toPosix(value) {
|
|
731
|
+
return value.split(path.sep).join("/");
|
|
732
|
+
}
|