glossarist 0.4.49 → 0.4.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiled-format.d.ts +43 -0
- package/dist/compiled-format.d.ts.map +1 -0
- package/{src/compiled-format.ts → dist/compiled-format.js} +28 -46
- package/dist/compiled-format.js.map +1 -0
- package/dist/concept-collection.d.ts +39 -0
- package/dist/concept-collection.d.ts.map +1 -0
- package/dist/concept-collection.js +127 -0
- package/dist/concept-collection.js.map +1 -0
- package/dist/concept-diff.d.ts +14 -0
- package/dist/concept-diff.d.ts.map +1 -0
- package/{src/concept-diff.ts → dist/concept-diff.js} +2 -20
- package/dist/concept-diff.js.map +1 -0
- package/dist/concept-parser.d.ts +11 -0
- package/dist/concept-parser.d.ts.map +1 -0
- package/dist/concept-parser.js +209 -0
- package/dist/concept-parser.js.map +1 -0
- package/dist/concept-reader.d.ts +55 -0
- package/dist/concept-reader.d.ts.map +1 -0
- package/{src/concept-reader.ts → dist/concept-reader.js} +70 -76
- package/dist/concept-reader.js.map +1 -0
- package/dist/concept-serializer.d.ts +9 -0
- package/dist/concept-serializer.d.ts.map +1 -0
- package/dist/concept-serializer.js +87 -0
- package/dist/concept-serializer.js.map +1 -0
- package/dist/concept-writer.d.ts +10 -0
- package/dist/concept-writer.d.ts.map +1 -0
- package/dist/concept-writer.js +28 -0
- package/dist/concept-writer.js.map +1 -0
- package/dist/dataset-asset.d.ts +49 -0
- package/dist/dataset-asset.d.ts.map +1 -0
- package/{src/dataset-asset.ts → dist/dataset-asset.js} +16 -33
- package/dist/dataset-asset.js.map +1 -0
- package/dist/diff/canonical-json.d.ts +7 -0
- package/dist/diff/canonical-json.d.ts.map +1 -0
- package/dist/diff/canonical-json.js +28 -0
- package/dist/diff/canonical-json.js.map +1 -0
- package/dist/diff/change.d.ts +67 -0
- package/dist/diff/change.d.ts.map +1 -0
- package/dist/diff/change.js +131 -0
- package/dist/diff/change.js.map +1 -0
- package/dist/diff/collection-diff.d.ts +50 -0
- package/dist/diff/collection-diff.d.ts.map +1 -0
- package/dist/diff/collection-diff.js +182 -0
- package/dist/diff/collection-diff.js.map +1 -0
- package/dist/diff/concept-diff.d.ts +188 -0
- package/dist/diff/concept-diff.d.ts.map +1 -0
- package/dist/diff/concept-diff.js +624 -0
- package/dist/diff/concept-diff.js.map +1 -0
- package/dist/diff/diff-patch.d.ts +7 -0
- package/dist/diff/diff-patch.d.ts.map +1 -0
- package/dist/diff/diff-patch.js +225 -0
- package/dist/diff/diff-patch.js.map +1 -0
- package/dist/diff/diff-renderer.d.ts +44 -0
- package/dist/diff/diff-renderer.d.ts.map +1 -0
- package/dist/diff/diff-renderer.js +263 -0
- package/dist/diff/diff-renderer.js.map +1 -0
- package/dist/diff/identity.d.ts +2 -0
- package/dist/diff/identity.d.ts.map +1 -0
- package/dist/diff/identity.js +29 -0
- package/dist/diff/identity.js.map +1 -0
- package/dist/diff/index.d.ts +8 -0
- package/dist/diff/index.d.ts.map +1 -0
- package/dist/diff/index.js +8 -0
- package/dist/diff/index.js.map +1 -0
- package/dist/diff/list-diff.d.ts +36 -0
- package/dist/diff/list-diff.d.ts.map +1 -0
- package/dist/diff/list-diff.js +185 -0
- package/dist/diff/list-diff.js.map +1 -0
- package/dist/diff/similarity.d.ts +4 -0
- package/dist/diff/similarity.d.ts.map +1 -0
- package/dist/diff/similarity.js +20 -0
- package/dist/diff/similarity.js.map +1 -0
- package/dist/diff/text-diff.d.ts +42 -0
- package/dist/diff/text-diff.d.ts.map +1 -0
- package/dist/diff/text-diff.js +134 -0
- package/dist/diff/text-diff.js.map +1 -0
- package/dist/entity-directory.d.ts +13 -0
- package/dist/entity-directory.d.ts.map +1 -0
- package/dist/entity-directory.js +35 -0
- package/dist/entity-directory.js.map +1 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +23 -0
- package/dist/errors.js.map +1 -0
- package/dist/gcr-reader.d.ts +57 -0
- package/dist/gcr-reader.d.ts.map +1 -0
- package/dist/gcr-reader.js +264 -0
- package/dist/gcr-reader.js.map +1 -0
- package/dist/gcr-writer.d.ts +23 -0
- package/dist/gcr-writer.d.ts.map +1 -0
- package/dist/gcr-writer.js +84 -0
- package/dist/gcr-writer.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/{src/index.ts → dist/index.js} +6 -66
- package/dist/index.js.map +1 -0
- package/dist/managed-concept-collection.d.ts +31 -0
- package/dist/managed-concept-collection.d.ts.map +1 -0
- package/dist/managed-concept-collection.js +87 -0
- package/dist/managed-concept-collection.js.map +1 -0
- package/dist/migration/hyperedge-migrator.d.ts +33 -0
- package/dist/migration/hyperedge-migrator.d.ts.map +1 -0
- package/dist/migration/hyperedge-migrator.js +70 -0
- package/dist/migration/hyperedge-migrator.js.map +1 -0
- package/dist/models/abstract-hyperedge.d.ts +35 -0
- package/dist/models/abstract-hyperedge.d.ts.map +1 -0
- package/dist/models/abstract-hyperedge.js +112 -0
- package/dist/models/abstract-hyperedge.js.map +1 -0
- package/dist/models/base.d.ts +58 -0
- package/dist/models/base.d.ts.map +1 -0
- package/dist/models/base.js +77 -0
- package/dist/models/base.js.map +1 -0
- package/dist/models/bibliography-data.d.ts +20 -0
- package/dist/models/bibliography-data.d.ts.map +1 -0
- package/dist/models/bibliography-data.js +43 -0
- package/dist/models/bibliography-data.js.map +1 -0
- package/dist/models/bibliography-entry.d.ts +19 -0
- package/dist/models/bibliography-entry.d.ts.map +1 -0
- package/dist/models/bibliography-entry.js +34 -0
- package/dist/models/bibliography-entry.js.map +1 -0
- package/dist/models/citation.d.ts +40 -0
- package/dist/models/citation.d.ts.map +1 -0
- package/dist/models/citation.js +82 -0
- package/dist/models/citation.js.map +1 -0
- package/dist/models/completeness.d.ts +9 -0
- package/dist/models/completeness.d.ts.map +1 -0
- package/{src/models/completeness.ts → dist/models/completeness.js} +4 -9
- package/dist/models/completeness.js.map +1 -0
- package/dist/models/concept-date.d.ts +20 -0
- package/dist/models/concept-date.d.ts.map +1 -0
- package/dist/models/concept-date.js +36 -0
- package/dist/models/concept-date.js.map +1 -0
- package/dist/models/concept-ref.d.ts +32 -0
- package/dist/models/concept-ref.d.ts.map +1 -0
- package/dist/models/concept-ref.js +53 -0
- package/dist/models/concept-ref.js.map +1 -0
- package/dist/models/concept-reference.d.ts +22 -0
- package/dist/models/concept-reference.d.ts.map +1 -0
- package/dist/models/concept-reference.js +39 -0
- package/dist/models/concept-reference.js.map +1 -0
- package/dist/models/concept-source.d.ts +53 -0
- package/dist/models/concept-source.d.ts.map +1 -0
- package/dist/models/concept-source.js +66 -0
- package/dist/models/concept-source.js.map +1 -0
- package/dist/models/concept-system-type.d.ts +6 -0
- package/dist/models/concept-system-type.d.ts.map +1 -0
- package/dist/models/concept-system-type.js +22 -0
- package/dist/models/concept-system-type.js.map +1 -0
- package/dist/models/concept-system.d.ts +44 -0
- package/dist/models/concept-system.d.ts.map +1 -0
- package/dist/models/concept-system.js +115 -0
- package/dist/models/concept-system.js.map +1 -0
- package/dist/models/concept-type.d.ts +7 -0
- package/dist/models/concept-type.d.ts.map +1 -0
- package/{src/models/concept-type.ts → dist/models/concept-type.js} +8 -19
- package/dist/models/concept-type.js.map +1 -0
- package/dist/models/concept.d.ts +94 -0
- package/dist/models/concept.d.ts.map +1 -0
- package/dist/models/concept.js +368 -0
- package/dist/models/concept.js.map +1 -0
- package/dist/models/dataset-color.d.ts +28 -0
- package/dist/models/dataset-color.d.ts.map +1 -0
- package/dist/models/dataset-color.js +74 -0
- package/dist/models/dataset-color.js.map +1 -0
- package/dist/models/definition-type.d.ts +9 -0
- package/dist/models/definition-type.d.ts.map +1 -0
- package/{src/models/definition-type.ts → dist/models/definition-type.js} +6 -15
- package/dist/models/definition-type.js.map +1 -0
- package/dist/models/designation-relationship.d.ts +17 -0
- package/dist/models/designation-relationship.d.ts.map +1 -0
- package/dist/models/designation-relationship.js +30 -0
- package/dist/models/designation-relationship.js.map +1 -0
- package/dist/models/designation.d.ts +110 -0
- package/dist/models/designation.d.ts.map +1 -0
- package/dist/models/designation.js +224 -0
- package/dist/models/designation.js.map +1 -0
- package/dist/models/detailed-definition.d.ts +34 -0
- package/dist/models/detailed-definition.d.ts.map +1 -0
- package/dist/models/detailed-definition.js +63 -0
- package/dist/models/detailed-definition.js.map +1 -0
- package/dist/models/enum.d.ts +21 -0
- package/dist/models/enum.d.ts.map +1 -0
- package/dist/models/enum.js +39 -0
- package/dist/models/enum.js.map +1 -0
- package/dist/models/equivalence-degree.d.ts +7 -0
- package/dist/models/equivalence-degree.d.ts.map +1 -0
- package/dist/models/equivalence-degree.js +20 -0
- package/dist/models/equivalence-degree.js.map +1 -0
- package/dist/models/figure.d.ts +40 -0
- package/dist/models/figure.d.ts.map +1 -0
- package/dist/models/figure.js +82 -0
- package/dist/models/figure.js.map +1 -0
- package/dist/models/formula.d.ts +15 -0
- package/dist/models/formula.d.ts.map +1 -0
- package/dist/models/formula.js +27 -0
- package/dist/models/formula.js.map +1 -0
- package/dist/models/gcr-metadata.d.ts +62 -0
- package/dist/models/gcr-metadata.d.ts.map +1 -0
- package/dist/models/gcr-metadata.js +102 -0
- package/dist/models/gcr-metadata.js.map +1 -0
- package/dist/models/gcr-statistics.d.ts +30 -0
- package/dist/models/gcr-statistics.d.ts.map +1 -0
- package/dist/models/gcr-statistics.js +53 -0
- package/dist/models/gcr-statistics.js.map +1 -0
- package/dist/models/generic-hyperedge.d.ts +32 -0
- package/dist/models/generic-hyperedge.d.ts.map +1 -0
- package/dist/models/generic-hyperedge.js +51 -0
- package/dist/models/generic-hyperedge.js.map +1 -0
- package/dist/models/generic-member.d.ts +14 -0
- package/dist/models/generic-member.d.ts.map +1 -0
- package/dist/models/generic-member.js +51 -0
- package/dist/models/generic-member.js.map +1 -0
- package/dist/models/grammar-info.d.ts +34 -0
- package/dist/models/grammar-info.d.ts.map +1 -0
- package/dist/models/grammar-info.js +59 -0
- package/dist/models/grammar-info.js.map +1 -0
- package/dist/models/hyperedge-colors.d.ts +19 -0
- package/dist/models/hyperedge-colors.d.ts.map +1 -0
- package/dist/models/hyperedge-colors.js +61 -0
- package/dist/models/hyperedge-colors.js.map +1 -0
- package/dist/models/hyperedge-index.d.ts +34 -0
- package/dist/models/hyperedge-index.d.ts.map +1 -0
- package/dist/models/hyperedge-index.js +85 -0
- package/dist/models/hyperedge-index.js.map +1 -0
- package/dist/models/hyperedge-member.d.ts +28 -0
- package/dist/models/hyperedge-member.d.ts.map +1 -0
- package/dist/models/hyperedge-member.js +92 -0
- package/dist/models/hyperedge-member.js.map +1 -0
- package/dist/models/hyperedge-registry.d.ts +47 -0
- package/dist/models/hyperedge-registry.d.ts.map +1 -0
- package/dist/models/hyperedge-registry.js +118 -0
- package/dist/models/hyperedge-registry.js.map +1 -0
- package/dist/models/index.d.ts +53 -0
- package/dist/models/index.d.ts.map +1 -0
- package/{src/models/index.ts → dist/models/index.js} +11 -63
- package/dist/models/index.js.map +1 -0
- package/dist/models/locality.d.ts +17 -0
- package/dist/models/locality.d.ts.map +1 -0
- package/dist/models/locality.js +26 -0
- package/dist/models/locality.js.map +1 -0
- package/dist/models/localized-concept.d.ts +102 -0
- package/dist/models/localized-concept.d.ts.map +1 -0
- package/dist/models/localized-concept.js +195 -0
- package/dist/models/localized-concept.js.map +1 -0
- package/dist/models/localized-string.d.ts +5 -0
- package/dist/models/localized-string.d.ts.map +1 -0
- package/dist/models/localized-string.js +20 -0
- package/dist/models/localized-string.js.map +1 -0
- package/dist/models/multiplicity.d.ts +42 -0
- package/dist/models/multiplicity.d.ts.map +1 -0
- package/dist/models/multiplicity.js +84 -0
- package/dist/models/multiplicity.js.map +1 -0
- package/dist/models/non-verb-rep.d.ts +20 -0
- package/dist/models/non-verb-rep.d.ts.map +1 -0
- package/dist/models/non-verb-rep.js +32 -0
- package/dist/models/non-verb-rep.js.map +1 -0
- package/dist/models/non-verbal-entity.d.ts +30 -0
- package/dist/models/non-verbal-entity.d.ts.map +1 -0
- package/dist/models/non-verbal-entity.js +48 -0
- package/dist/models/non-verbal-entity.js.map +1 -0
- package/dist/models/non-verbal-reference.d.ts +23 -0
- package/dist/models/non-verbal-reference.d.ts.map +1 -0
- package/dist/models/non-verbal-reference.js +44 -0
- package/dist/models/non-verbal-reference.js.map +1 -0
- package/dist/models/non-verbal-references.d.ts +12 -0
- package/dist/models/non-verbal-references.d.ts.map +1 -0
- package/dist/models/non-verbal-references.js +20 -0
- package/dist/models/non-verbal-references.js.map +1 -0
- package/dist/models/partitive-count.d.ts +10 -0
- package/dist/models/partitive-count.d.ts.map +1 -0
- package/{src/models/partitive-count.ts → dist/models/partitive-count.js} +5 -9
- package/dist/models/partitive-count.js.map +1 -0
- package/dist/models/partitive-enumeration.d.ts +5 -0
- package/dist/models/partitive-enumeration.d.ts.map +1 -0
- package/dist/models/partitive-enumeration.js +16 -0
- package/dist/models/partitive-enumeration.js.map +1 -0
- package/dist/models/partitive-hyperedge.d.ts +43 -0
- package/dist/models/partitive-hyperedge.d.ts.map +1 -0
- package/dist/models/partitive-hyperedge.js +63 -0
- package/dist/models/partitive-hyperedge.js.map +1 -0
- package/dist/models/partitive-member.d.ts +14 -0
- package/dist/models/partitive-member.d.ts.map +1 -0
- package/dist/models/partitive-member.js +44 -0
- package/dist/models/partitive-member.js.map +1 -0
- package/dist/models/partitive-presence.d.ts +9 -0
- package/dist/models/partitive-presence.d.ts.map +1 -0
- package/{src/models/partitive-presence.ts → dist/models/partitive-presence.js} +4 -8
- package/dist/models/partitive-presence.js.map +1 -0
- package/dist/models/plurality-marker.d.ts +5 -0
- package/dist/models/plurality-marker.d.ts.map +1 -0
- package/dist/models/plurality-marker.js +20 -0
- package/dist/models/plurality-marker.js.map +1 -0
- package/dist/models/pronunciation.d.ts +19 -0
- package/dist/models/pronunciation.d.ts.map +1 -0
- package/dist/models/pronunciation.js +34 -0
- package/dist/models/pronunciation.js.map +1 -0
- package/dist/models/register.d.ts +104 -0
- package/dist/models/register.d.ts.map +1 -0
- package/dist/models/register.js +297 -0
- package/dist/models/register.js.map +1 -0
- package/dist/models/registrable.d.ts +25 -0
- package/dist/models/registrable.d.ts.map +1 -0
- package/dist/models/registrable.js +23 -0
- package/dist/models/registrable.js.map +1 -0
- package/dist/models/related-concept.d.ts +33 -0
- package/dist/models/related-concept.d.ts.map +1 -0
- package/dist/models/related-concept.js +95 -0
- package/dist/models/related-concept.js.map +1 -0
- package/dist/models/relation-categories.d.ts +38 -0
- package/dist/models/relation-categories.d.ts.map +1 -0
- package/dist/models/relation-categories.js +135 -0
- package/dist/models/relation-categories.js.map +1 -0
- package/dist/models/relation-colors.d.ts +35 -0
- package/dist/models/relation-colors.d.ts.map +1 -0
- package/dist/models/relation-colors.js +68 -0
- package/dist/models/relation-colors.js.map +1 -0
- package/dist/models/relation-loader.d.ts +41 -0
- package/dist/models/relation-loader.d.ts.map +1 -0
- package/dist/models/relation-loader.js +101 -0
- package/dist/models/relation-loader.js.map +1 -0
- package/dist/models/section.d.ts +22 -0
- package/dist/models/section.d.ts.map +1 -0
- package/dist/models/section.js +47 -0
- package/dist/models/section.js.map +1 -0
- package/dist/models/sequential-hyperedge.d.ts +32 -0
- package/dist/models/sequential-hyperedge.d.ts.map +1 -0
- package/dist/models/sequential-hyperedge.js +49 -0
- package/dist/models/sequential-hyperedge.js.map +1 -0
- package/dist/models/sequential-member.d.ts +8 -0
- package/dist/models/sequential-member.d.ts.map +1 -0
- package/{src/models/sequential-member.ts → dist/models/sequential-member.js} +4 -9
- package/dist/models/sequential-member.js.map +1 -0
- package/dist/models/shared-non-verbal-entity.d.ts +16 -0
- package/dist/models/shared-non-verbal-entity.d.ts.map +1 -0
- package/dist/models/shared-non-verbal-entity.js +28 -0
- package/dist/models/shared-non-verbal-entity.js.map +1 -0
- package/dist/models/table.d.ts +15 -0
- package/dist/models/table.d.ts.map +1 -0
- package/dist/models/table.js +27 -0
- package/dist/models/table.js.map +1 -0
- package/dist/rdf/agents-emitter.d.ts +37 -0
- package/dist/rdf/agents-emitter.d.ts.map +1 -0
- package/dist/rdf/agents-emitter.js +107 -0
- package/dist/rdf/agents-emitter.js.map +1 -0
- package/dist/rdf/bibliography-emitter.d.ts +16 -0
- package/dist/rdf/bibliography-emitter.d.ts.map +1 -0
- package/dist/rdf/bibliography-emitter.js +84 -0
- package/dist/rdf/bibliography-emitter.js.map +1 -0
- package/dist/rdf/bnode-id.d.ts +2 -0
- package/dist/rdf/bnode-id.d.ts.map +1 -0
- package/dist/rdf/bnode-id.js +57 -0
- package/dist/rdf/bnode-id.js.map +1 -0
- package/dist/rdf/build-activity-emitter.d.ts +42 -0
- package/dist/rdf/build-activity-emitter.d.ts.map +1 -0
- package/dist/rdf/build-activity-emitter.js +103 -0
- package/dist/rdf/build-activity-emitter.js.map +1 -0
- package/dist/rdf/curie.d.ts +7 -0
- package/dist/rdf/curie.d.ts.map +1 -0
- package/dist/rdf/curie.js +45 -0
- package/dist/rdf/curie.js.map +1 -0
- package/dist/rdf/dataset-emitter.d.ts +37 -0
- package/dist/rdf/dataset-emitter.d.ts.map +1 -0
- package/dist/rdf/dataset-emitter.js +126 -0
- package/dist/rdf/dataset-emitter.js.map +1 -0
- package/dist/rdf/deterministic-id.d.ts +3 -0
- package/dist/rdf/deterministic-id.d.ts.map +1 -0
- package/dist/rdf/deterministic-id.js +68 -0
- package/dist/rdf/deterministic-id.js.map +1 -0
- package/dist/rdf/document-writer.d.ts +11 -0
- package/dist/rdf/document-writer.d.ts.map +1 -0
- package/dist/rdf/document-writer.js +77 -0
- package/dist/rdf/document-writer.js.map +1 -0
- package/dist/rdf/gloss-concept.d.ts +27 -0
- package/dist/rdf/gloss-concept.d.ts.map +1 -0
- package/dist/rdf/gloss-concept.js +95 -0
- package/dist/rdf/gloss-concept.js.map +1 -0
- package/dist/rdf/gloss-designation.d.ts +17 -0
- package/dist/rdf/gloss-designation.d.ts.map +1 -0
- package/dist/rdf/gloss-designation.js +46 -0
- package/dist/rdf/gloss-designation.js.map +1 -0
- package/dist/rdf/gloss-detailed-definition.d.ts +14 -0
- package/dist/rdf/gloss-detailed-definition.d.ts.map +1 -0
- package/dist/rdf/gloss-detailed-definition.js +53 -0
- package/dist/rdf/gloss-detailed-definition.js.map +1 -0
- package/dist/rdf/gloss-generic-hyperedge.d.ts +27 -0
- package/dist/rdf/gloss-generic-hyperedge.d.ts.map +1 -0
- package/{src/rdf/gloss-generic-hyperedge.ts → dist/rdf/gloss-generic-hyperedge.js} +36 -50
- package/dist/rdf/gloss-generic-hyperedge.js.map +1 -0
- package/dist/rdf/gloss-localized-concept.d.ts +24 -0
- package/dist/rdf/gloss-localized-concept.d.ts.map +1 -0
- package/dist/rdf/gloss-localized-concept.js +71 -0
- package/dist/rdf/gloss-localized-concept.js.map +1 -0
- package/dist/rdf/gloss-non-verbal-rep.d.ts +33 -0
- package/dist/rdf/gloss-non-verbal-rep.d.ts.map +1 -0
- package/dist/rdf/gloss-non-verbal-rep.js +163 -0
- package/dist/rdf/gloss-non-verbal-rep.js.map +1 -0
- package/dist/rdf/gloss-partitive-member.d.ts +8 -0
- package/dist/rdf/gloss-partitive-member.d.ts.map +1 -0
- package/{src/rdf/gloss-partitive-member.ts → dist/rdf/gloss-partitive-member.js} +23 -41
- package/dist/rdf/gloss-partitive-member.js.map +1 -0
- package/dist/rdf/gloss-partitive-relation.d.ts +26 -0
- package/dist/rdf/gloss-partitive-relation.d.ts.map +1 -0
- package/dist/rdf/gloss-partitive-relation.js +73 -0
- package/dist/rdf/gloss-partitive-relation.js.map +1 -0
- package/dist/rdf/gloss-source.d.ts +23 -0
- package/dist/rdf/gloss-source.d.ts.map +1 -0
- package/dist/rdf/gloss-source.js +52 -0
- package/dist/rdf/gloss-source.js.map +1 -0
- package/dist/rdf/group-emitter.d.ts +46 -0
- package/dist/rdf/group-emitter.d.ts.map +1 -0
- package/dist/rdf/group-emitter.js +107 -0
- package/dist/rdf/group-emitter.js.map +1 -0
- package/dist/rdf/image-variant-emitter.d.ts +12 -0
- package/dist/rdf/image-variant-emitter.d.ts.map +1 -0
- package/dist/rdf/image-variant-emitter.js +55 -0
- package/dist/rdf/image-variant-emitter.js.map +1 -0
- package/dist/rdf/index.d.ts +26 -0
- package/dist/rdf/index.d.ts.map +1 -0
- package/{src/rdf/index.ts → dist/rdf/index.js} +8 -37
- package/dist/rdf/index.js.map +1 -0
- package/dist/rdf/normalize-enum.d.ts +3 -0
- package/dist/rdf/normalize-enum.d.ts.map +1 -0
- package/{src/rdf/normalize-enum.ts → dist/rdf/normalize-enum.js} +11 -10
- package/dist/rdf/normalize-enum.js.map +1 -0
- package/dist/rdf/predicates.d.ts +277 -0
- package/dist/rdf/predicates.d.ts.map +1 -0
- package/dist/rdf/predicates.js +279 -0
- package/dist/rdf/predicates.js.map +1 -0
- package/dist/rdf/prefixes.d.ts +16 -0
- package/dist/rdf/prefixes.d.ts.map +1 -0
- package/{src/rdf/prefixes.ts → dist/rdf/prefixes.js} +10 -12
- package/dist/rdf/prefixes.js.map +1 -0
- package/dist/rdf/provenance-emitter.d.ts +28 -0
- package/dist/rdf/provenance-emitter.d.ts.map +1 -0
- package/dist/rdf/provenance-emitter.js +74 -0
- package/dist/rdf/provenance-emitter.js.map +1 -0
- package/dist/rdf/sections-builder.d.ts +17 -0
- package/dist/rdf/sections-builder.d.ts.map +1 -0
- package/dist/rdf/sections-builder.js +137 -0
- package/dist/rdf/sections-builder.js.map +1 -0
- package/dist/rdf/shacl-entry.d.ts +2 -0
- package/dist/rdf/shacl-entry.d.ts.map +1 -0
- package/{src/rdf/shacl-entry.ts → dist/rdf/shacl-entry.js} +1 -1
- package/dist/rdf/shacl-entry.js.map +1 -0
- package/dist/rdf/shacl.d.ts +10 -0
- package/dist/rdf/shacl.d.ts.map +1 -0
- package/{src/rdf/shacl.ts → dist/rdf/shacl.js} +38 -56
- package/dist/rdf/shacl.js.map +1 -0
- package/dist/rdf/terms.d.ts +10 -0
- package/dist/rdf/terms.d.ts.map +1 -0
- package/{src/rdf/terms.ts → dist/rdf/terms.js} +6 -3
- package/dist/rdf/terms.js.map +1 -0
- package/dist/rdf/version-emitter.d.ts +57 -0
- package/dist/rdf/version-emitter.d.ts.map +1 -0
- package/dist/rdf/version-emitter.js +68 -0
- package/dist/rdf/version-emitter.js.map +1 -0
- package/dist/rdf/vocabulary-emitter.d.ts +32 -0
- package/dist/rdf/vocabulary-emitter.d.ts.map +1 -0
- package/dist/rdf/vocabulary-emitter.js +46 -0
- package/dist/rdf/vocabulary-emitter.js.map +1 -0
- package/dist/rdf/write-turtle-sync.d.ts +7 -0
- package/dist/rdf/write-turtle-sync.d.ts.map +1 -0
- package/dist/rdf/write-turtle-sync.js +130 -0
- package/dist/rdf/write-turtle-sync.js.map +1 -0
- package/dist/reference-mention.d.ts +49 -0
- package/dist/reference-mention.d.ts.map +1 -0
- package/dist/reference-mention.js +98 -0
- package/dist/reference-mention.js.map +1 -0
- package/dist/reference-resolver.d.ts +52 -0
- package/dist/reference-resolver.d.ts.map +1 -0
- package/dist/reference-resolver.js +311 -0
- package/dist/reference-resolver.js.map +1 -0
- package/dist/render-classification.d.ts +19 -0
- package/dist/render-classification.d.ts.map +1 -0
- package/dist/render-classification.js +82 -0
- package/dist/render-classification.js.map +1 -0
- package/dist/sort.d.ts +5 -0
- package/dist/sort.d.ts.map +1 -0
- package/dist/sort.js +25 -0
- package/dist/sort.js.map +1 -0
- package/dist/transforms/concept-to-gloss.transform.d.ts +32 -0
- package/dist/transforms/concept-to-gloss.transform.d.ts.map +1 -0
- package/dist/transforms/concept-to-gloss.transform.js +60 -0
- package/dist/transforms/concept-to-gloss.transform.js.map +1 -0
- package/dist/transforms/index.d.ts +2 -0
- package/dist/transforms/index.d.ts.map +1 -0
- package/{src/transforms/index.ts → dist/transforms/index.js} +1 -0
- package/dist/transforms/index.js.map +1 -0
- package/dist/utils/assertions.d.ts +4 -0
- package/dist/utils/assertions.d.ts.map +1 -0
- package/dist/utils/assertions.js +17 -0
- package/dist/utils/assertions.js.map +1 -0
- package/dist/uuid.d.ts +4 -0
- package/dist/uuid.d.ts.map +1 -0
- package/dist/uuid.js +23 -0
- package/dist/uuid.js.map +1 -0
- package/dist/v1-reader.d.ts +8 -0
- package/dist/v1-reader.d.ts.map +1 -0
- package/dist/v1-reader.js +56 -0
- package/dist/v1-reader.js.map +1 -0
- package/dist/validators/asset-index.d.ts +23 -0
- package/dist/validators/asset-index.d.ts.map +1 -0
- package/dist/validators/asset-index.js +58 -0
- package/dist/validators/asset-index.js.map +1 -0
- package/dist/validators/binary-has-part-redundancy-rule.d.ts +8 -0
- package/dist/validators/binary-has-part-redundancy-rule.d.ts.map +1 -0
- package/dist/validators/binary-has-part-redundancy-rule.js +57 -0
- package/dist/validators/binary-has-part-redundancy-rule.js.map +1 -0
- package/dist/validators/concept-validator.d.ts +21 -0
- package/dist/validators/concept-validator.d.ts.map +1 -0
- package/dist/validators/concept-validator.js +76 -0
- package/dist/validators/concept-validator.js.map +1 -0
- package/dist/validators/delimiting-coherence-rule.d.ts +8 -0
- package/dist/validators/delimiting-coherence-rule.d.ts.map +1 -0
- package/dist/validators/delimiting-coherence-rule.js +72 -0
- package/dist/validators/delimiting-coherence-rule.js.map +1 -0
- package/dist/validators/external-concept-shape-rule.d.ts +8 -0
- package/dist/validators/external-concept-shape-rule.d.ts.map +1 -0
- package/dist/validators/external-concept-shape-rule.js +48 -0
- package/dist/validators/external-concept-shape-rule.js.map +1 -0
- package/dist/validators/gcr-validator.d.ts +11 -0
- package/dist/validators/gcr-validator.d.ts.map +1 -0
- package/dist/validators/gcr-validator.js +76 -0
- package/dist/validators/gcr-validator.js.map +1 -0
- package/dist/validators/hyperedge-coherence-rule.d.ts +9 -0
- package/dist/validators/hyperedge-coherence-rule.d.ts.map +1 -0
- package/dist/validators/hyperedge-coherence-rule.js +78 -0
- package/dist/validators/hyperedge-coherence-rule.js.map +1 -0
- package/dist/validators/index.d.ts +21 -0
- package/dist/validators/index.d.ts.map +1 -0
- package/{src/validators/index.ts → dist/validators/index.js} +25 -51
- package/dist/validators/index.js.map +1 -0
- package/dist/validators/partitive-relation-coherence-rule.d.ts +2 -0
- package/dist/validators/partitive-relation-coherence-rule.d.ts.map +1 -0
- package/{src/validators/partitive-relation-coherence-rule.ts → dist/validators/partitive-relation-coherence-rule.js} +1 -1
- package/dist/validators/partitive-relation-coherence-rule.js.map +1 -0
- package/dist/validators/ref-keys.d.ts +8 -0
- package/dist/validators/ref-keys.d.ts.map +1 -0
- package/dist/validators/ref-keys.js +27 -0
- package/dist/validators/ref-keys.js.map +1 -0
- package/dist/validators/register-validator.d.ts +10 -0
- package/dist/validators/register-validator.d.ts.map +1 -0
- package/dist/validators/register-validator.js +18 -0
- package/dist/validators/register-validator.js.map +1 -0
- package/dist/validators/relationship-type-rule.d.ts +13 -0
- package/dist/validators/relationship-type-rule.d.ts.map +1 -0
- package/dist/validators/relationship-type-rule.js +34 -0
- package/dist/validators/relationship-type-rule.js.map +1 -0
- package/dist/validators/sourced-from-locality-rule.d.ts +8 -0
- package/dist/validators/sourced-from-locality-rule.d.ts.map +1 -0
- package/dist/validators/sourced-from-locality-rule.js +37 -0
- package/dist/validators/sourced-from-locality-rule.js.map +1 -0
- package/dist/validators/v3-rules.d.ts +60 -0
- package/dist/validators/v3-rules.d.ts.map +1 -0
- package/dist/validators/v3-rules.js +327 -0
- package/dist/validators/v3-rules.js.map +1 -0
- package/dist/validators/validation-error.d.ts +13 -0
- package/dist/validators/validation-error.d.ts.map +1 -0
- package/dist/validators/validation-error.js +17 -0
- package/dist/validators/validation-error.js.map +1 -0
- package/dist/validators/validation-result.d.ts +17 -0
- package/dist/validators/validation-result.d.ts.map +1 -0
- package/dist/validators/validation-result.js +47 -0
- package/dist/validators/validation-result.js.map +1 -0
- package/dist/validators/validation-rule.d.ts +10 -0
- package/dist/validators/validation-rule.d.ts.map +1 -0
- package/dist/validators/validation-rule.js +17 -0
- package/dist/validators/validation-rule.js.map +1 -0
- package/package.json +37 -42
- package/src/concept-collection.ts +0 -166
- package/src/concept-parser.ts +0 -229
- package/src/concept-reader.d.ts +0 -13
- package/src/concept-serializer.ts +0 -99
- package/src/concept-writer.d.ts +0 -7
- package/src/concept-writer.ts +0 -43
- package/src/diff/canonical-json.ts +0 -29
- package/src/diff/change.ts +0 -175
- package/src/diff/collection-diff.ts +0 -197
- package/src/diff/concept-diff.ts +0 -702
- package/src/diff/diff-patch.ts +0 -260
- package/src/diff/diff-renderer.ts +0 -293
- package/src/diff/identity.ts +0 -33
- package/src/diff/index.d.ts +0 -242
- package/src/diff/index.ts +0 -50
- package/src/diff/list-diff.ts +0 -231
- package/src/diff/similarity.ts +0 -20
- package/src/diff/text-diff.ts +0 -167
- package/src/entity-directory.ts +0 -43
- package/src/errors.d.ts +0 -11
- package/src/errors.ts +0 -24
- package/src/gcr-reader.d.ts +0 -65
- package/src/gcr-reader.ts +0 -487
- package/src/gcr-writer.d.ts +0 -22
- package/src/gcr-writer.ts +0 -97
- package/src/index.d.ts +0 -124
- package/src/managed-concept-collection.ts +0 -95
- package/src/migration/hyperedge-migrator.ts +0 -104
- package/src/models/abstract-hyperedge.ts +0 -164
- package/src/models/base.ts +0 -110
- package/src/models/bibliography-data.ts +0 -64
- package/src/models/bibliography-entry.ts +0 -40
- package/src/models/citation.ts +0 -98
- package/src/models/concept-date.ts +0 -48
- package/src/models/concept-ref.ts +0 -64
- package/src/models/concept-reference.ts +0 -50
- package/src/models/concept-source.ts +0 -96
- package/src/models/concept-system-type.ts +0 -39
- package/src/models/concept-system.ts +0 -152
- package/src/models/concept.ts +0 -499
- package/src/models/dataset-color.ts +0 -88
- package/src/models/designation-relationship.ts +0 -39
- package/src/models/designation.ts +0 -297
- package/src/models/detailed-definition.ts +0 -92
- package/src/models/enum.ts +0 -60
- package/src/models/equivalence-degree.ts +0 -34
- package/src/models/figure.ts +0 -110
- package/src/models/formula.ts +0 -36
- package/src/models/gcr-metadata.ts +0 -118
- package/src/models/gcr-statistics.ts +0 -76
- package/src/models/generic-hyperedge.ts +0 -72
- package/src/models/generic-member.ts +0 -80
- package/src/models/grammar-info.ts +0 -78
- package/src/models/hyperedge-colors.ts +0 -87
- package/src/models/hyperedge-index.ts +0 -101
- package/src/models/hyperedge-member.ts +0 -121
- package/src/models/hyperedge-registry.ts +0 -145
- package/src/models/index.d.ts +0 -586
- package/src/models/locality.ts +0 -34
- package/src/models/localized-concept.ts +0 -284
- package/src/models/localized-string.ts +0 -32
- package/src/models/multiplicity.ts +0 -134
- package/src/models/non-verb-rep.ts +0 -48
- package/src/models/non-verbal-entity.ts +0 -65
- package/src/models/non-verbal-reference.ts +0 -73
- package/src/models/non-verbal-references.ts +0 -29
- package/src/models/partitive-enumeration.ts +0 -27
- package/src/models/partitive-hyperedge.ts +0 -90
- package/src/models/partitive-member.ts +0 -56
- package/src/models/plurality-marker.ts +0 -31
- package/src/models/pronunciation.ts +0 -40
- package/src/models/register.ts +0 -315
- package/src/models/registrable.ts +0 -48
- package/src/models/related-concept.ts +0 -117
- package/src/models/relation-categories.ts +0 -167
- package/src/models/relation-colors.ts +0 -90
- package/src/models/relation-loader.ts +0 -115
- package/src/models/section.ts +0 -61
- package/src/models/sequential-hyperedge.ts +0 -70
- package/src/models/shared-non-verbal-entity.ts +0 -36
- package/src/models/table.ts +0 -36
- package/src/rdf/agents-emitter.ts +0 -134
- package/src/rdf/bibliography-emitter.ts +0 -126
- package/src/rdf/bnode-id.ts +0 -55
- package/src/rdf/build-activity-emitter.ts +0 -129
- package/src/rdf/curie.ts +0 -47
- package/src/rdf/dataset-emitter.ts +0 -170
- package/src/rdf/deterministic-id.ts +0 -69
- package/src/rdf/document-writer.ts +0 -87
- package/src/rdf/gloss-concept.ts +0 -115
- package/src/rdf/gloss-designation.ts +0 -72
- package/src/rdf/gloss-detailed-definition.ts +0 -69
- package/src/rdf/gloss-localized-concept.ts +0 -79
- package/src/rdf/gloss-non-verbal-rep.ts +0 -192
- package/src/rdf/gloss-partitive-relation.ts +0 -89
- package/src/rdf/gloss-source.ts +0 -56
- package/src/rdf/group-emitter.ts +0 -133
- package/src/rdf/image-variant-emitter.ts +0 -80
- package/src/rdf/index.d.ts +0 -371
- package/src/rdf/predicates.d.ts +0 -527
- package/src/rdf/predicates.ts +0 -287
- package/src/rdf/provenance-emitter.ts +0 -87
- package/src/rdf/sections-builder.ts +0 -178
- package/src/rdf/shacl-entry.d.ts +0 -6
- package/src/rdf/version-emitter.ts +0 -97
- package/src/rdf/vocabulary-emitter.ts +0 -67
- package/src/rdf/write-turtle-sync.ts +0 -167
- package/src/reference-mention.ts +0 -114
- package/src/reference-resolver.ts +0 -331
- package/src/render-classification.ts +0 -76
- package/src/sort.ts +0 -22
- package/src/transforms/concept-to-gloss.transform.ts +0 -81
- package/src/transforms/index.d.ts +0 -26
- package/src/uuid.ts +0 -32
- package/src/v1-reader.ts +0 -64
- package/src/validators/asset-index.ts +0 -67
- package/src/validators/binary-has-part-redundancy-rule.ts +0 -67
- package/src/validators/concept-validator.ts +0 -93
- package/src/validators/delimiting-coherence-rule.ts +0 -105
- package/src/validators/external-concept-shape-rule.ts +0 -60
- package/src/validators/gcr-validator.ts +0 -75
- package/src/validators/hyperedge-coherence-rule.ts +0 -98
- package/src/validators/index.d.ts +0 -43
- package/src/validators/ref-keys.ts +0 -31
- package/src/validators/register-validator.ts +0 -18
- package/src/validators/relationship-type-rule.ts +0 -39
- package/src/validators/sourced-from-locality-rule.ts +0 -53
- package/src/validators/v3-rules.ts +0 -378
- package/src/validators/validation-error.ts +0 -19
- package/src/validators/validation-result.ts +0 -52
- package/src/validators/validation-rule.ts +0 -21
package/src/diff/diff-patch.ts
DELETED
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
|
|
2
|
-
import { Concept } from '../models/concept.js';
|
|
3
|
-
import { ConceptSource } from '../models/concept-source.js';
|
|
4
|
-
import { ConceptDate } from '../models/concept-date.js';
|
|
5
|
-
import { RelatedConcept } from '../models/related-concept.js';
|
|
6
|
-
import { Designation } from '../models/designation.js';
|
|
7
|
-
import { DetailedDefinition } from '../models/detailed-definition.js';
|
|
8
|
-
import { HyperedgeRegistry } from '../models/hyperedge-registry.js';
|
|
9
|
-
import { Added, Removed, Changed } from './change.js';
|
|
10
|
-
import { ListDiff } from './list-diff.js';
|
|
11
|
-
import { TextDiff, TextHunk } from './text-diff.js';
|
|
12
|
-
import { identityOf } from './identity.js';
|
|
13
|
-
import {
|
|
14
|
-
ConceptDiff,
|
|
15
|
-
ConceptLevelDiff,
|
|
16
|
-
LocalizedConceptDiff,
|
|
17
|
-
MetadataDiff,
|
|
18
|
-
} from './concept-diff.js';
|
|
19
|
-
|
|
20
|
-
// Wire-name (camelCase JS field → snake_case JSON key) for metadata
|
|
21
|
-
// fields patched onto Concept and LocalizedConcept.
|
|
22
|
-
//
|
|
23
|
-
// These mirror `Concept.wireNameFor` / `LocalizedConcept.wireNameFor`.
|
|
24
|
-
// The duplication is intentional: diff-patch.js cannot import those
|
|
25
|
-
// models lazily without making applyDiff async (a breaking API change),
|
|
26
|
-
// and the field set is small and stable. A spec
|
|
27
|
-
// (test/diff/field-sync.test.js) asserts the two stay in sync.
|
|
28
|
-
|
|
29
|
-
const CONCEPT_METADATA_JSON_KEYS = Object.freeze({
|
|
30
|
-
status: 'status',
|
|
31
|
-
term: 'term',
|
|
32
|
-
uri: 'uri',
|
|
33
|
-
schemaVersion: 'schema_version',
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const LOC_METADATA_JSON_KEYS = Object.freeze({
|
|
37
|
-
entryStatus: 'entry_status',
|
|
38
|
-
classification: 'classification',
|
|
39
|
-
reviewType: 'review_type',
|
|
40
|
-
domain: 'domain',
|
|
41
|
-
release: 'release',
|
|
42
|
-
lineageSourceSimilarity: 'lineage_source_similarity',
|
|
43
|
-
script: 'script',
|
|
44
|
-
system: 'system',
|
|
45
|
-
reviewDate: 'review_date',
|
|
46
|
-
reviewDecisionDate: 'review_decision_date',
|
|
47
|
-
reviewDecisionEvent: 'review_decision_event',
|
|
48
|
-
reviewStatus: 'review_status',
|
|
49
|
-
reviewDecision: 'review_decision',
|
|
50
|
-
reviewDecisionNotes: 'review_decision_notes',
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
export function applyDiff(oldConcept, diff) {
|
|
54
|
-
const json = oldConcept.toJSON();
|
|
55
|
-
|
|
56
|
-
applyConceptLevelPatch(json, diff.concept);
|
|
57
|
-
applyLanguagePatch(json, diff);
|
|
58
|
-
|
|
59
|
-
for (const [lang, lcDiff] of Object.entries(diff.localizations)) {
|
|
60
|
-
applyLocalizedPatch(json, lang, lcDiff);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return Concept.fromJSON(json);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function reverseDiff(diff) {
|
|
67
|
-
const concept = new ConceptLevelDiff({
|
|
68
|
-
sources: reverseListDiff(diff.concept.sources),
|
|
69
|
-
dates: reverseListDiff(diff.concept.dates),
|
|
70
|
-
relatedConcepts: reverseListDiff(diff.concept.relatedConcepts),
|
|
71
|
-
relations: reverseListDiff(diff.concept.relations),
|
|
72
|
-
groups: reverseListDiff(diff.concept.groups),
|
|
73
|
-
sections: reverseListDiff(diff.concept.sections),
|
|
74
|
-
tags: reverseListDiff(diff.concept.tags),
|
|
75
|
-
metadata: reverseMetadataDiff(diff.concept.metadata),
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
const languages = reverseListDiff(diff.languages);
|
|
79
|
-
|
|
80
|
-
const localizations = {};
|
|
81
|
-
for (const [lang, lcDiff] of Object.entries(diff.localizations)) {
|
|
82
|
-
localizations[lang] = new LocalizedConceptDiff({
|
|
83
|
-
languageCode: lcDiff.languageCode,
|
|
84
|
-
designations: reverseListDiff(lcDiff.designations),
|
|
85
|
-
definitions: reverseListDiff(lcDiff.definitions),
|
|
86
|
-
notes: reverseListDiff(lcDiff.notes),
|
|
87
|
-
examples: reverseListDiff(lcDiff.examples),
|
|
88
|
-
sources: reverseListDiff(lcDiff.sources),
|
|
89
|
-
dates: reverseListDiff(lcDiff.dates),
|
|
90
|
-
related: reverseListDiff(lcDiff.related),
|
|
91
|
-
metadata: reverseMetadataDiff(lcDiff.metadata),
|
|
92
|
-
totalItems: lcDiff._totalItems,
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return new ConceptDiff({
|
|
97
|
-
oldId: diff.newId,
|
|
98
|
-
newId: diff.oldId,
|
|
99
|
-
concept,
|
|
100
|
-
languages,
|
|
101
|
-
localizations,
|
|
102
|
-
totalItems: diff._totalItems,
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function applyConceptLevelPatch(json, conceptDiff) {
|
|
107
|
-
json.sources = applyListPatch(json.sources ?? [], conceptDiff.sources, ConceptSource.identityOf);
|
|
108
|
-
json.dates = applyListPatch(json.dates ?? [], conceptDiff.dates, ConceptDate.identityOf);
|
|
109
|
-
json.related = applyListPatch(json.related ?? [], conceptDiff.relatedConcepts, RelatedConcept.identityOf);
|
|
110
|
-
|
|
111
|
-
// Unified hyperedge diff → typed wire keys. Iterate the registry;
|
|
112
|
-
// for each registered class, partition the unified diff by that
|
|
113
|
-
// class and apply to the class's wireKey. Adding a new hyperedge
|
|
114
|
-
// type means this loop picks it up automatically — no edits here.
|
|
115
|
-
for (const cls of HyperedgeRegistry.allClasses()) {
|
|
116
|
-
const partition = partitionListDiff(conceptDiff.relations, cls);
|
|
117
|
-
if (!partition.hasChanges) continue;
|
|
118
|
-
const wireKey = cls.wireKey;
|
|
119
|
-
// v1 wire keys (partitive_hyperedges) on the input are migrated
|
|
120
|
-
// to v2 wire key here: read from either, write to v2 only.
|
|
121
|
-
const v1ReadKeys = cls.v1WireKeys ?? [];
|
|
122
|
-
const existing = v1ReadKeys
|
|
123
|
-
.map(k => json[k])
|
|
124
|
-
.find(arr => Array.isArray(arr)) ?? json[wireKey] ?? [];
|
|
125
|
-
json[wireKey] = applyListPatch(existing, partition, cls.identityOf);
|
|
126
|
-
for (const k of v1ReadKeys) {
|
|
127
|
-
if (json[k] != null && json[wireKey] != null) delete json[k];
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
json.tags = applyListPatch(json.tags ?? [], conceptDiff.tags);
|
|
132
|
-
|
|
133
|
-
applyMetadataPatch(json, conceptDiff.metadata, CONCEPT_METADATA_JSON_KEYS);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function applyLanguagePatch(json, conceptDiff) {
|
|
137
|
-
if (!json.localizations) json.localizations = {};
|
|
138
|
-
for (const entry of conceptDiff.languages.added) {
|
|
139
|
-
if (!(entry.value in json.localizations)) {
|
|
140
|
-
json.localizations[entry.value] = {};
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
for (const entry of conceptDiff.languages.removed) {
|
|
144
|
-
delete json.localizations[entry.value];
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function applyLocalizedPatch(json, lang, lcDiff) {
|
|
149
|
-
if (!json.localizations) json.localizations = {};
|
|
150
|
-
if (!(lang in json.localizations)) {
|
|
151
|
-
json.localizations[lang] = {};
|
|
152
|
-
}
|
|
153
|
-
const loc = json.localizations[lang];
|
|
154
|
-
|
|
155
|
-
loc.terms = applyListPatch(loc.terms ?? [], lcDiff.designations, Designation.identityOf);
|
|
156
|
-
loc.definition = applyListPatch(loc.definition ?? [], lcDiff.definitions, DetailedDefinition.identityOf);
|
|
157
|
-
loc.notes = applyListPatch(loc.notes ?? [], lcDiff.notes, DetailedDefinition.identityOf);
|
|
158
|
-
loc.examples = applyListPatch(loc.examples ?? [], lcDiff.examples, DetailedDefinition.identityOf);
|
|
159
|
-
loc.sources = applyListPatch(loc.sources ?? [], lcDiff.sources, ConceptSource.identityOf);
|
|
160
|
-
loc.dates = applyListPatch(loc.dates ?? [], lcDiff.dates, ConceptDate.identityOf);
|
|
161
|
-
loc.related = applyListPatch(loc.related ?? [], lcDiff.related, RelatedConcept.identityOf);
|
|
162
|
-
|
|
163
|
-
applyMetadataPatch(loc, lcDiff.metadata, LOC_METADATA_JSON_KEYS);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function applyListPatch(existingItems, listDiff, identityFn) {
|
|
167
|
-
const fn = identityFn ?? identityOf;
|
|
168
|
-
let result = [...existingItems];
|
|
169
|
-
|
|
170
|
-
for (const entry of listDiff.added) {
|
|
171
|
-
result.push(toJsonValue(entry.value));
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
for (const entry of listDiff.removed) {
|
|
175
|
-
const targetKey = fn(entry.value);
|
|
176
|
-
result = result.filter(item => fn(item) !== targetKey);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
for (const entry of listDiff.changed) {
|
|
180
|
-
const oldKey = fn(entry.oldValue);
|
|
181
|
-
result = result.map(item =>
|
|
182
|
-
fn(item) === oldKey ? toJsonValue(entry.newValue) : item,
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return result;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function applyMetadataPatch(target, metadataDiff, keyMap) {
|
|
190
|
-
for (const [field, change] of Object.entries(metadataDiff.changes)) {
|
|
191
|
-
const jsonKey = keyMap[field];
|
|
192
|
-
if (!jsonKey) continue;
|
|
193
|
-
if (change.newValue == null) {
|
|
194
|
-
delete target[jsonKey];
|
|
195
|
-
} else {
|
|
196
|
-
target[jsonKey] = change.newValue;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function reverseListDiff(listDiff) {
|
|
202
|
-
const added = listDiff.removed.map(r => new Added({ value: r.value, path: r.path }));
|
|
203
|
-
const removed = listDiff.added.map(a => new Removed({ value: a.value, path: a.path }));
|
|
204
|
-
const changed = listDiff.changed.map(c => new Changed({
|
|
205
|
-
oldValue: c.newValue,
|
|
206
|
-
newValue: c.oldValue,
|
|
207
|
-
textDiff: c.textDiff ? reverseTextDiff(c.textDiff) : null,
|
|
208
|
-
path: c.path,
|
|
209
|
-
}));
|
|
210
|
-
return new ListDiff({ added, removed, changed });
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function reverseMetadataDiff(metadataDiff) {
|
|
214
|
-
const changes = {};
|
|
215
|
-
for (const [field, change] of Object.entries(metadataDiff.changes)) {
|
|
216
|
-
changes[field] = new Changed({
|
|
217
|
-
oldValue: change.newValue,
|
|
218
|
-
newValue: change.oldValue,
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
return new MetadataDiff({ changes });
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
function reverseTextDiff(textDiff) {
|
|
225
|
-
const hunks = textDiff.hunks.map(h => {
|
|
226
|
-
if (h.type === 'added') return new TextHunk({ type: 'removed', text: h.text });
|
|
227
|
-
if (h.type === 'removed') return new TextHunk({ type: 'added', text: h.text });
|
|
228
|
-
return new TextHunk({ type: 'equal', text: h.text });
|
|
229
|
-
});
|
|
230
|
-
return new TextDiff({
|
|
231
|
-
oldText: textDiff.newText,
|
|
232
|
-
newText: textDiff.oldText,
|
|
233
|
-
hunks,
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function toJsonValue(value) {
|
|
238
|
-
if (value == null) return null;
|
|
239
|
-
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
240
|
-
return value;
|
|
241
|
-
}
|
|
242
|
-
if (typeof value.toJSON === 'function') return value.toJSON();
|
|
243
|
-
return value;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// Project a unified relations ListDiff onto a single concrete class.
|
|
247
|
-
// Entries whose value (old or new) is an instance of `Cls` survive;
|
|
248
|
-
// everything else is filtered out. Cross-type changed entries (e.g.
|
|
249
|
-
// old was PartitiveHyperedge, new is GenericHyperedge) are not yet
|
|
250
|
-
// supported — those would need to surface as a remove + add pair.
|
|
251
|
-
function partitionListDiff(listDiff, Cls) {
|
|
252
|
-
if (!listDiff) return new ListDiff({ added: [], removed: [], changed: [] });
|
|
253
|
-
return new ListDiff({
|
|
254
|
-
added: listDiff.added.filter(e => e.value instanceof Cls),
|
|
255
|
-
removed: listDiff.removed.filter(e => e.value instanceof Cls),
|
|
256
|
-
changed: listDiff.changed.filter(e =>
|
|
257
|
-
(e.oldValue == null || e.oldValue instanceof Cls) &&
|
|
258
|
-
(e.newValue == null || e.newValue instanceof Cls)),
|
|
259
|
-
});
|
|
260
|
-
}
|
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
|
|
2
|
-
import { TextDiff } from './text-diff.js';
|
|
3
|
-
import { resolveMultiplicity } from '../models/multiplicity.js';
|
|
4
|
-
|
|
5
|
-
const COLORS = {
|
|
6
|
-
red: s => `\x1b[31m${s}\x1b[0m`,
|
|
7
|
-
green: s => `\x1b[32m${s}\x1b[0m`,
|
|
8
|
-
yellow: s => `\x1b[33m${s}\x1b[0m`,
|
|
9
|
-
cyan: s => `\x1b[36m${s}\x1b[0m`,
|
|
10
|
-
dim: s => `\x1b[2m${s}\x1b[0m`,
|
|
11
|
-
bold: s => `\x1b[1m${s}\x1b[0m`,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export function renderConceptDiff(diff, options = {}) {
|
|
15
|
-
const colors = options.colors ?? false;
|
|
16
|
-
const showUnchanged = options.showUnchanged ?? false;
|
|
17
|
-
const lines = [];
|
|
18
|
-
|
|
19
|
-
const pct = Math.round(diff.similarity * 100);
|
|
20
|
-
const idPart = diff.oldId && diff.newId && diff.oldId !== diff.newId
|
|
21
|
-
? `${diff.oldId} → ${diff.newId}`
|
|
22
|
-
: (diff.newId ?? diff.oldId ?? '?');
|
|
23
|
-
|
|
24
|
-
const similarityStr = colors ? colorizeSimilarity(pct) : `${pct}%`;
|
|
25
|
-
lines.push(`Concept "${idPart}" — ${similarityStr} similar`);
|
|
26
|
-
|
|
27
|
-
if (!diff.hasChanges && !showUnchanged) {
|
|
28
|
-
lines.push(' (no changes)');
|
|
29
|
-
return lines.join('\n');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (diff.concept.hasChanges || showUnchanged) {
|
|
33
|
-
lines.push('');
|
|
34
|
-
lines.push('Concept-level:');
|
|
35
|
-
lines.push(renderConceptLevel(diff.concept, colors));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (diff.languages.hasChanges || showUnchanged) {
|
|
39
|
-
lines.push('');
|
|
40
|
-
lines.push('Languages:');
|
|
41
|
-
lines.push(renderLanguageSet(diff.languages, colors));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
for (const lang of diff.localizationLanguages) {
|
|
45
|
-
const lcDiff = diff.localization(lang);
|
|
46
|
-
if (!lcDiff) continue;
|
|
47
|
-
if (lcDiff.hasChanges || showUnchanged) {
|
|
48
|
-
lines.push('');
|
|
49
|
-
lines.push(`Localization (${lang}):`);
|
|
50
|
-
lines.push(renderLocalized(lcDiff, colors));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return lines.join('\n');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function renderCollectionDiff(diff, options = {}) {
|
|
58
|
-
const colors = options.colors ?? false;
|
|
59
|
-
const lines = [];
|
|
60
|
-
|
|
61
|
-
const pct = Math.round(diff.similarity * 100);
|
|
62
|
-
const similarityStr = colors ? colorizeSimilarity(pct) : `${pct}%`;
|
|
63
|
-
|
|
64
|
-
lines.push(`Collection comparison — ${similarityStr} similar overall`);
|
|
65
|
-
lines.push(` Old: ${diff.oldCount} concepts`);
|
|
66
|
-
lines.push(` New: ${diff.newCount} concepts`);
|
|
67
|
-
lines.push(` Matched: ${diff.matched.length}`);
|
|
68
|
-
lines.push(` Added: ${diff.added.length}`);
|
|
69
|
-
lines.push(` Removed: ${diff.removed.length}`);
|
|
70
|
-
|
|
71
|
-
if (diff.added.length > 0) {
|
|
72
|
-
lines.push('');
|
|
73
|
-
lines.push(colors ? COLORS.green('Added concepts:') : 'Added concepts:');
|
|
74
|
-
for (const entry of diff.added) {
|
|
75
|
-
lines.push(` + ${entry.value}`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (diff.removed.length > 0) {
|
|
80
|
-
lines.push('');
|
|
81
|
-
lines.push(colors ? COLORS.red('Removed concepts:') : 'Removed concepts:');
|
|
82
|
-
for (const entry of diff.removed) {
|
|
83
|
-
lines.push(` - ${entry.value}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const changedDiffs = Object.entries(diff.conceptDiffs)
|
|
88
|
-
.filter(([, d]) => d.hasChanges)
|
|
89
|
-
.sort(([, a], [, b]) => a.similarity - b.similarity);
|
|
90
|
-
|
|
91
|
-
if (changedDiffs.length > 0) {
|
|
92
|
-
lines.push('');
|
|
93
|
-
lines.push('Changed concepts:');
|
|
94
|
-
for (const [id, conceptDiff] of changedDiffs) {
|
|
95
|
-
const conceptPct = Math.round(conceptDiff.similarity * 100);
|
|
96
|
-
const pctStr = colors ? colorizeSimilarity(conceptPct) : `${conceptPct}%`;
|
|
97
|
-
lines.push(` ${id}: ${pctStr}`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return lines.join('\n');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function renderTextDiff(textDiff, options = {}) {
|
|
105
|
-
if (!(textDiff instanceof TextDiff)) {
|
|
106
|
-
textDiff = TextDiff.fromJSON(textDiff);
|
|
107
|
-
}
|
|
108
|
-
const colors = options.colors ?? false;
|
|
109
|
-
const lines = [];
|
|
110
|
-
|
|
111
|
-
for (const hunk of textDiff.hunks) {
|
|
112
|
-
if (hunk.type === 'equal') {
|
|
113
|
-
lines.push(` ${hunk.text}`);
|
|
114
|
-
} else if (hunk.type === 'added') {
|
|
115
|
-
lines.push(colors ? `+ ${COLORS.green(hunk.text)}` : `+ ${hunk.text}`);
|
|
116
|
-
} else if (hunk.type === 'removed') {
|
|
117
|
-
lines.push(colors ? `- ${COLORS.red(hunk.text)}` : `- ${hunk.text}`);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return lines.join('\n');
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function renderConceptLevel(diff, colors) {
|
|
125
|
-
const lines = [];
|
|
126
|
-
lines.push(...renderListDiff('Sources', diff.sources, colors, itemLabel));
|
|
127
|
-
lines.push(...renderListDiff('Dates', diff.dates, colors, itemLabel));
|
|
128
|
-
lines.push(...renderListDiff('Related', diff.relatedConcepts, colors, itemLabel));
|
|
129
|
-
// Unified hyperedge section. Replaces the per-type sections
|
|
130
|
-
// (Partitive relations, Generic relations) — the underlying diff
|
|
131
|
-
// is a single ListDiff over the unified .relations array.
|
|
132
|
-
lines.push(...renderListDiff('Hyperedges', diff.relations, colors, relationLabel));
|
|
133
|
-
lines.push(...renderListDiff('Groups', diff.groups, colors, itemLabel));
|
|
134
|
-
lines.push(...renderListDiff('Sections', diff.sections, colors, itemLabel));
|
|
135
|
-
lines.push(...renderListDiff('Tags', diff.tags, colors, itemLabel));
|
|
136
|
-
lines.push(...renderMetadataDiff(diff.metadata));
|
|
137
|
-
return lines.filter(Boolean).join('\n');
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function renderLanguageSet(diff, colors) {
|
|
141
|
-
const lines = [];
|
|
142
|
-
for (const entry of diff.added) {
|
|
143
|
-
lines.push(colors ? ` + ${COLORS.green(entry.value)}` : ` + ${entry.value}`);
|
|
144
|
-
}
|
|
145
|
-
for (const entry of diff.removed) {
|
|
146
|
-
lines.push(colors ? ` - ${COLORS.red(entry.value)}` : ` - ${entry.value}`);
|
|
147
|
-
}
|
|
148
|
-
return lines.join('\n');
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function renderLocalized(diff, colors) {
|
|
152
|
-
const lines = [];
|
|
153
|
-
lines.push(...renderListDiff('Designations', diff.designations, colors, designationLabel));
|
|
154
|
-
lines.push(...renderListDiff('Definitions', diff.definitions, colors, definitionLabel));
|
|
155
|
-
lines.push(...renderListDiff('Notes', diff.notes, colors, definitionLabel));
|
|
156
|
-
lines.push(...renderListDiff('Examples', diff.examples, colors, definitionLabel));
|
|
157
|
-
lines.push(...renderListDiff('Sources', diff.sources, colors, itemLabel));
|
|
158
|
-
lines.push(...renderListDiff('Dates', diff.dates, colors, itemLabel));
|
|
159
|
-
lines.push(...renderListDiff('Related', diff.related, colors, itemLabel));
|
|
160
|
-
lines.push(...renderMetadataDiff(diff.metadata));
|
|
161
|
-
return lines.filter(Boolean).join('\n');
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function renderListDiff(label, listDiff, colors, labelFn) {
|
|
165
|
-
if (!listDiff.hasChanges) return [];
|
|
166
|
-
const lines = [` ${label}:`];
|
|
167
|
-
for (const entry of listDiff.added) {
|
|
168
|
-
const text = ` + ${labelFn(entry.value)}`;
|
|
169
|
-
lines.push(colors ? COLORS.green(text) : text);
|
|
170
|
-
}
|
|
171
|
-
for (const entry of listDiff.removed) {
|
|
172
|
-
const text = ` - ${labelFn(entry.value)}`;
|
|
173
|
-
lines.push(colors ? COLORS.red(text) : text);
|
|
174
|
-
}
|
|
175
|
-
for (const entry of listDiff.changed) {
|
|
176
|
-
const oldLabel = labelFn(entry.oldValue);
|
|
177
|
-
const newLabel = labelFn(entry.newValue);
|
|
178
|
-
lines.push(` ~ ${oldLabel} → ${newLabel}`);
|
|
179
|
-
}
|
|
180
|
-
return lines;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function renderMetadataDiff(metadataDiff) {
|
|
184
|
-
if (!metadataDiff.hasChanges) return [];
|
|
185
|
-
const lines = [` Metadata:`];
|
|
186
|
-
for (const [field, change] of Object.entries(metadataDiff.changes)) {
|
|
187
|
-
const oldVal = formatScalar(change.oldValue);
|
|
188
|
-
const newVal = formatScalar(change.newValue);
|
|
189
|
-
lines.push(` ~ ${field}: ${oldVal} → ${newVal}`);
|
|
190
|
-
}
|
|
191
|
-
return lines;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function designationLabel(d) {
|
|
195
|
-
if (!d) return '?';
|
|
196
|
-
const text = d.designation ?? '?';
|
|
197
|
-
const status = d.normativeStatus ? ` (${d.normativeStatus})` : '';
|
|
198
|
-
return `${text}${status}`;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function definitionLabel(d) {
|
|
202
|
-
if (!d) return '?';
|
|
203
|
-
return d.content ?? '?';
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
function relationLabel(r) {
|
|
207
|
-
if (!r) return '?';
|
|
208
|
-
const c = r.comprehensive;
|
|
209
|
-
const head = c?.id ?? c?.source ?? c?.text ?? '?';
|
|
210
|
-
// PartitiveHyperedge exposes .partitives as the wire alias for
|
|
211
|
-
// .members; GenericHyperedge uses .members directly. Read both.
|
|
212
|
-
const members = Array.isArray(r.partitives) ? r.partitives : r.members;
|
|
213
|
-
const memberText = Array.isArray(members)
|
|
214
|
-
? members.map(m => {
|
|
215
|
-
const ref = m?.ref ?? m ?? {};
|
|
216
|
-
let tail = '';
|
|
217
|
-
const mult = resolveMultiplicity(m);
|
|
218
|
-
if (mult && mult !== 'compulsory') tail += ` (${mult})`;
|
|
219
|
-
// PartitiveMember uses is_delimiting (boolean flag).
|
|
220
|
-
if (m?.is_delimiting === true) tail += ' ⊘';
|
|
221
|
-
// GenericMember uses delimitingCharacteristic (string value per
|
|
222
|
-
// ISO 704:2022 §5.5.4.2.1) — show the delimiting characteristic
|
|
223
|
-
// text so reviewers can see the intension difference.
|
|
224
|
-
if (m?.delimitingCharacteristic) {
|
|
225
|
-
const c = Object.values(m.delimitingCharacteristic)[0];
|
|
226
|
-
if (typeof c === 'string' && c.length > 0) tail += ` ⟨${c}⟩`;
|
|
227
|
-
}
|
|
228
|
-
return `${ref.id ?? ref.source ?? ref.text ?? '?'}${tail}`;
|
|
229
|
-
}).join(', ')
|
|
230
|
-
: '';
|
|
231
|
-
const completeness = r.completeness ? ` (${r.completeness})` : '';
|
|
232
|
-
const criterion = r.criterion
|
|
233
|
-
? ` / ${Object.values(r.criterion)[0] ?? ''}`
|
|
234
|
-
: '';
|
|
235
|
-
// Each hyperedge leaf declares a short static kindLabel (PART, GEN, …).
|
|
236
|
-
// Read it via the constructor so adding a new hyperedge type needs no
|
|
237
|
-
// renderer edit. The blank-string default keeps backward-compat with
|
|
238
|
-
// any AbstractHyperedge subclass that doesn't declare kindLabel.
|
|
239
|
-
const kindLabel = r?.constructor?.kindLabel ?? '';
|
|
240
|
-
const typeTag = kindLabel ? `${kindLabel} ` : '';
|
|
241
|
-
return `${typeTag}${head} → {${memberText}}${completeness}${criterion}`;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Aggregate multiplicity + delimiting stats across a concept's
|
|
245
|
-
// PartitiveRelations. Used by dataset-level summaries, not by the
|
|
246
|
-
// per-relation diff label.
|
|
247
|
-
//
|
|
248
|
-
// v4: presence and count are independent dimensions. Stats include
|
|
249
|
-
// byPresence and byCount breakdowns so tools can query each axis
|
|
250
|
-
// independently ("show me all optional parts" or "show me all
|
|
251
|
-
// multiple-count parts").
|
|
252
|
-
export function multiplicityStats(relations) {
|
|
253
|
-
const byMultiplicity = {};
|
|
254
|
-
const byPresence = {};
|
|
255
|
-
const byCount = {};
|
|
256
|
-
let delimitingCount = 0;
|
|
257
|
-
let total = 0;
|
|
258
|
-
for (const rel of relations ?? []) {
|
|
259
|
-
for (const m of rel?.partitives ?? []) {
|
|
260
|
-
total += 1;
|
|
261
|
-
const mult = resolveMultiplicity(m);
|
|
262
|
-
byMultiplicity[mult] = (byMultiplicity[mult] ?? 0) + 1;
|
|
263
|
-
const p = m?.presence ?? 'required';
|
|
264
|
-
const c = m?.count ?? 'exactly_one';
|
|
265
|
-
byPresence[p] = (byPresence[p] ?? 0) + 1;
|
|
266
|
-
byCount[c] = (byCount[c] ?? 0) + 1;
|
|
267
|
-
if (m?.is_delimiting === true) delimitingCount += 1;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
return { total, byMultiplicity, byPresence, byCount, delimiting: delimitingCount };
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
function itemLabel(item) {
|
|
274
|
-
if (item == null) return '?';
|
|
275
|
-
if (typeof item === 'string') return item;
|
|
276
|
-
if (typeof item === 'number') return String(item);
|
|
277
|
-
if (typeof item.toJSON === 'function') {
|
|
278
|
-
return JSON.stringify(item.toJSON());
|
|
279
|
-
}
|
|
280
|
-
return String(item);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function formatScalar(val) {
|
|
284
|
-
if (val == null) return '∅';
|
|
285
|
-
if (typeof val === 'string') return val;
|
|
286
|
-
return String(val);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
function colorizeSimilarity(pct) {
|
|
290
|
-
if (pct >= 95) return COLORS.green(`${pct}%`);
|
|
291
|
-
if (pct >= 80) return COLORS.yellow(`${pct}%`);
|
|
292
|
-
return COLORS.red(`${pct}%`);
|
|
293
|
-
}
|
package/src/diff/identity.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Shared identity helper for the diff layer.
|
|
2
|
-
//
|
|
3
|
-
// Per invariant N1, identity is a model concern. Models expose
|
|
4
|
-
// `identity()` returning a stable string. This helper dispatches: if
|
|
5
|
-
// the value is a model with `identity()`, call it; otherwise fall
|
|
6
|
-
// back to canonical JSON of `toJSON()`.
|
|
7
|
-
|
|
8
|
-
import { canonicalJson } from './canonical-json.js';
|
|
9
|
-
|
|
10
|
-
interface Identifiable {
|
|
11
|
-
identity(): string;
|
|
12
|
-
}
|
|
13
|
-
interface HasToJSON {
|
|
14
|
-
toJSON(): unknown;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function hasIdentity(v: unknown): v is Identifiable {
|
|
18
|
-
return v != null && typeof v === 'object' && typeof (v as { identity?: unknown }).identity === 'function';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function hasToJSON(v: unknown): v is HasToJSON {
|
|
22
|
-
return v != null && typeof v === 'object' && typeof (v as { toJSON?: unknown }).toJSON === 'function';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function identityOf(item: unknown): string {
|
|
26
|
-
if (item == null) return '';
|
|
27
|
-
if (hasIdentity(item)) return item.identity();
|
|
28
|
-
if (typeof item === 'string') return item;
|
|
29
|
-
if (typeof item === 'number') return String(item);
|
|
30
|
-
if (typeof item === 'boolean') return String(item);
|
|
31
|
-
if (hasToJSON(item)) return canonicalJson(item.toJSON());
|
|
32
|
-
return canonicalJson(item);
|
|
33
|
-
}
|