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/concept-diff.ts
DELETED
|
@@ -1,702 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
|
|
2
|
-
import { GlossaristModel } from '../models/base.js';
|
|
3
|
-
import { PartitiveHyperedge } from '../models/partitive-hyperedge.js';
|
|
4
|
-
import { GenericHyperedge } from '../models/generic-hyperedge.js';
|
|
5
|
-
import { Added, Removed, Changed } from './change.js';
|
|
6
|
-
import { ListDiff, diffList, diffSet } from './list-diff.js';
|
|
7
|
-
import { identityOf } from './identity.js';
|
|
8
|
-
import { canonicalJson } from './canonical-json.js';
|
|
9
|
-
import { computeSimilarity } from './similarity.js';
|
|
10
|
-
|
|
11
|
-
// Metadata field lists for the diff layer.
|
|
12
|
-
//
|
|
13
|
-
// Concept and LocalizedConcept also expose static DIFF_FIELDS that
|
|
14
|
-
// mirror these arrays. The duplication is intentional: concept-diff.js
|
|
15
|
-
// cannot import Concept (Concept imports diffConcepts from this module,
|
|
16
|
-
// creating a cycle). Instead, a spec (test/diff/field-sync.test.js)
|
|
17
|
-
// asserts the two stay in sync. Adding a new scalar metadata field
|
|
18
|
-
// requires editing both sites; forgetting one fails the test loudly.
|
|
19
|
-
//
|
|
20
|
-
// (Invariant N2 — TODO.hyperedges-v2/07.)
|
|
21
|
-
const CONCEPT_METADATA_FIELDS = Object.freeze([
|
|
22
|
-
'status', 'term', 'uri', 'schemaVersion',
|
|
23
|
-
]);
|
|
24
|
-
|
|
25
|
-
const LOCALIZATION_METADATA_FIELDS = Object.freeze([
|
|
26
|
-
'entryStatus', 'classification', 'reviewType', 'domain', 'release',
|
|
27
|
-
'lineageSourceSimilarity', 'script', 'system',
|
|
28
|
-
'reviewDate', 'reviewDecisionDate', 'reviewDecisionEvent',
|
|
29
|
-
'reviewStatus', 'reviewDecision', 'reviewDecisionNotes',
|
|
30
|
-
]);
|
|
31
|
-
|
|
32
|
-
// Metadata field lists are sourced from the models per invariant N2.
|
|
33
|
-
// (See file-top comment about why they're duplicated rather than imported.)
|
|
34
|
-
|
|
35
|
-
export class DiffStats extends GlossaristModel {
|
|
36
|
-
constructor(data: Record<string, unknown> = {}) {
|
|
37
|
-
super();
|
|
38
|
-
this._added = data.added ?? 0;
|
|
39
|
-
this._removed = data.removed ?? 0;
|
|
40
|
-
this._changed = data.changed ?? 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
get added() { return this._added; }
|
|
44
|
-
get removed() { return this._removed; }
|
|
45
|
-
get changed() { return this._changed; }
|
|
46
|
-
get total() { return this._added + this._removed + this._changed; }
|
|
47
|
-
|
|
48
|
-
toJSON() {
|
|
49
|
-
return { added: this._added, removed: this._removed, changed: this._changed };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
static fromJSON(data) {
|
|
53
|
-
return new DiffStats(data ?? {});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export class MetadataDiff extends GlossaristModel {
|
|
58
|
-
constructor(data: Record<string, unknown> = {}) {
|
|
59
|
-
super();
|
|
60
|
-
this._changes = {};
|
|
61
|
-
const raw = data.changes ?? data ?? {};
|
|
62
|
-
for (const [field, change] of Object.entries(raw)) {
|
|
63
|
-
this._changes[field] = change instanceof Changed ? change : Changed.fromJSON(change);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
get changes() {
|
|
68
|
-
return this._changes;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
get hasChanges() {
|
|
72
|
-
return Object.keys(this._changes).length > 0;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
get count() {
|
|
76
|
-
return Object.keys(this._changes).length;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
*walk(section) {
|
|
80
|
-
for (const [field, change] of Object.entries(this._changes)) {
|
|
81
|
-
const path = section ? `${section}.${field}` : field;
|
|
82
|
-
yield { path, change };
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
toJSON() {
|
|
87
|
-
const obj = {};
|
|
88
|
-
for (const [field, change] of Object.entries(this._changes)) {
|
|
89
|
-
obj[field] = change.toJSON();
|
|
90
|
-
}
|
|
91
|
-
return obj;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
static fromJSON(data) {
|
|
95
|
-
return new MetadataDiff({ changes: data ?? {} });
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export class ConceptLevelDiff extends GlossaristModel {
|
|
100
|
-
constructor(data: Record<string, unknown> = {}) {
|
|
101
|
-
super();
|
|
102
|
-
this._sources = wrapListDiff(data.sources);
|
|
103
|
-
this._dates = wrapListDiff(data.dates);
|
|
104
|
-
this._relatedConcepts = wrapListDiff(data.relatedConcepts ?? data.related_concepts);
|
|
105
|
-
// Unified hyperedge diff. Accepts:
|
|
106
|
-
// - data.relations (new unified shape)
|
|
107
|
-
// - data.partitiveRelations /
|
|
108
|
-
// data.partitive_relations /
|
|
109
|
-
// data.partitiveHyperedges /
|
|
110
|
-
// data.partitive_hyperedges (legacy partitive-only shape)
|
|
111
|
-
// Old diffs only had partitive, so the legacy fallback treats them
|
|
112
|
-
// as a unified list with one type present.
|
|
113
|
-
this._relations = wrapListDiff(
|
|
114
|
-
data.relations
|
|
115
|
-
?? data.partitiveRelations
|
|
116
|
-
?? data.partitive_relations
|
|
117
|
-
?? data.partitiveHyperedges
|
|
118
|
-
?? data.partitive_hyperedges,
|
|
119
|
-
);
|
|
120
|
-
this._groups = wrapListDiff(data.groups);
|
|
121
|
-
this._sections = wrapListDiff(data.sections);
|
|
122
|
-
this._tags = wrapListDiff(data.tags);
|
|
123
|
-
this._metadata = data.metadata instanceof MetadataDiff
|
|
124
|
-
? data.metadata
|
|
125
|
-
: MetadataDiff.fromJSON(data.metadata ?? {});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
get sources() { return this._sources; }
|
|
129
|
-
get dates() { return this._dates; }
|
|
130
|
-
get relatedConcepts() { return this._relatedConcepts; }
|
|
131
|
-
/** Unified hyperedge diff (PartitiveHyperedge + GenericHyperedge). */
|
|
132
|
-
get relations() { return this._relations; }
|
|
133
|
-
/**
|
|
134
|
-
* Filtered view of `relations` containing only PartitiveHyperedge
|
|
135
|
-
* entries. Backward compat for callers that read .partitiveRelations
|
|
136
|
-
* directly on a ConceptLevelDiff.
|
|
137
|
-
*/
|
|
138
|
-
get partitiveRelations() {
|
|
139
|
-
return filterListDiffByType(this._relations, PartitiveHyperedge);
|
|
140
|
-
}
|
|
141
|
-
/** @deprecated use .relations */ get partitiveHyperedges() { return this.partitiveRelations; }
|
|
142
|
-
/**
|
|
143
|
-
* Filtered view of `relations` containing only GenericHyperedge
|
|
144
|
-
* entries. Backward compat for callers that read .genericRelations
|
|
145
|
-
* directly on a ConceptLevelDiff.
|
|
146
|
-
*/
|
|
147
|
-
get genericRelations() {
|
|
148
|
-
return filterListDiffByType(this._relations, GenericHyperedge);
|
|
149
|
-
}
|
|
150
|
-
get groups() { return this._groups; }
|
|
151
|
-
get sections() { return this._sections; }
|
|
152
|
-
get tags() { return this._tags; }
|
|
153
|
-
get metadata() { return this._metadata; }
|
|
154
|
-
|
|
155
|
-
get hasChanges() {
|
|
156
|
-
return this._sources.hasChanges
|
|
157
|
-
|| this._dates.hasChanges
|
|
158
|
-
|| this._relatedConcepts.hasChanges
|
|
159
|
-
|| this._relations.hasChanges
|
|
160
|
-
|| this._groups.hasChanges
|
|
161
|
-
|| this._sections.hasChanges
|
|
162
|
-
|| this._tags.hasChanges
|
|
163
|
-
|| this._metadata.hasChanges;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
*walk() {
|
|
167
|
-
yield* walkList('concept.sources', this._sources);
|
|
168
|
-
yield* walkList('concept.dates', this._dates);
|
|
169
|
-
yield* walkList('concept.relatedConcepts', this._relatedConcepts);
|
|
170
|
-
yield* walkList('concept.relations', this._relations);
|
|
171
|
-
yield* walkList('concept.groups', this._groups);
|
|
172
|
-
yield* walkList('concept.sections', this._sections);
|
|
173
|
-
yield* walkList('concept.tags', this._tags);
|
|
174
|
-
yield* this._metadata.walk('concept.metadata');
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
toJSON() {
|
|
178
|
-
return {
|
|
179
|
-
sources: this._sources.toJSON(),
|
|
180
|
-
dates: this._dates.toJSON(),
|
|
181
|
-
related_concepts: this._relatedConcepts.toJSON(),
|
|
182
|
-
relations: this._relations.toJSON(),
|
|
183
|
-
groups: this._groups.toJSON(),
|
|
184
|
-
sections: this._sections.toJSON(),
|
|
185
|
-
tags: this._tags.toJSON(),
|
|
186
|
-
metadata: this._metadata.toJSON(),
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
static fromJSON(data) {
|
|
191
|
-
return new ConceptLevelDiff(data);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export class LocalizedConceptDiff extends GlossaristModel {
|
|
196
|
-
constructor(data: Record<string, unknown> = {}) {
|
|
197
|
-
super();
|
|
198
|
-
this.languageCode = data.languageCode ?? data.language_code ?? null;
|
|
199
|
-
this._designations = wrapListDiff(data.designations);
|
|
200
|
-
this._definitions = wrapListDiff(data.definitions);
|
|
201
|
-
this._notes = wrapListDiff(data.notes);
|
|
202
|
-
this._examples = wrapListDiff(data.examples);
|
|
203
|
-
this._sources = wrapListDiff(data.sources);
|
|
204
|
-
this._dates = wrapListDiff(data.dates);
|
|
205
|
-
this._related = wrapListDiff(data.related);
|
|
206
|
-
this._metadata = data.metadata instanceof MetadataDiff
|
|
207
|
-
? data.metadata
|
|
208
|
-
: MetadataDiff.fromJSON(data.metadata ?? {});
|
|
209
|
-
this._totalItems = data.totalItems ?? data.total_items ?? 0;
|
|
210
|
-
this._statsCache = undefined;
|
|
211
|
-
this._similarityCache = undefined;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
get designations() { return this._designations; }
|
|
215
|
-
get definitions() { return this._definitions; }
|
|
216
|
-
get notes() { return this._notes; }
|
|
217
|
-
get examples() { return this._examples; }
|
|
218
|
-
get sources() { return this._sources; }
|
|
219
|
-
get dates() { return this._dates; }
|
|
220
|
-
get related() { return this._related; }
|
|
221
|
-
get metadata() { return this._metadata; }
|
|
222
|
-
get totalItems() { return this._totalItems; }
|
|
223
|
-
|
|
224
|
-
get hasChanges() {
|
|
225
|
-
return this._designations.hasChanges
|
|
226
|
-
|| this._definitions.hasChanges
|
|
227
|
-
|| this._notes.hasChanges
|
|
228
|
-
|| this._examples.hasChanges
|
|
229
|
-
|| this._sources.hasChanges
|
|
230
|
-
|| this._dates.hasChanges
|
|
231
|
-
|| this._related.hasChanges
|
|
232
|
-
|| this._metadata.hasChanges;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
get stats() {
|
|
236
|
-
if (this._statsCache === undefined) {
|
|
237
|
-
this._statsCache = collectStats(this.walk());
|
|
238
|
-
}
|
|
239
|
-
return this._statsCache;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
get similarity() {
|
|
243
|
-
if (this._similarityCache === undefined) {
|
|
244
|
-
this._similarityCache = computeSimilarity(this.stats.total, this._totalItems);
|
|
245
|
-
}
|
|
246
|
-
return this._similarityCache;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
*walk(prefix) {
|
|
250
|
-
const base = prefix ?? '';
|
|
251
|
-
yield* walkList(`${base}.designations`, this._designations);
|
|
252
|
-
yield* walkList(`${base}.definitions`, this._definitions);
|
|
253
|
-
yield* walkList(`${base}.notes`, this._notes);
|
|
254
|
-
yield* walkList(`${base}.examples`, this._examples);
|
|
255
|
-
yield* walkList(`${base}.sources`, this._sources);
|
|
256
|
-
yield* walkList(`${base}.dates`, this._dates);
|
|
257
|
-
yield* walkList(`${base}.related`, this._related);
|
|
258
|
-
yield* this._metadata.walk(`${base}.metadata`);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
toJSON() {
|
|
262
|
-
const obj = {};
|
|
263
|
-
if (this.languageCode != null) obj.language_code = this.languageCode;
|
|
264
|
-
obj.designations = this._designations.toJSON();
|
|
265
|
-
obj.definitions = this._definitions.toJSON();
|
|
266
|
-
obj.notes = this._notes.toJSON();
|
|
267
|
-
obj.examples = this._examples.toJSON();
|
|
268
|
-
obj.sources = this._sources.toJSON();
|
|
269
|
-
obj.dates = this._dates.toJSON();
|
|
270
|
-
obj.related = this._related.toJSON();
|
|
271
|
-
obj.metadata = this._metadata.toJSON();
|
|
272
|
-
obj.total_items = this._totalItems;
|
|
273
|
-
return obj;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
static fromJSON(data) {
|
|
277
|
-
return new LocalizedConceptDiff(data);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
export class ConceptDiff extends GlossaristModel {
|
|
282
|
-
constructor(data: Record<string, unknown> = {}) {
|
|
283
|
-
super();
|
|
284
|
-
this._oldId = data.oldId ?? data.old_id ?? null;
|
|
285
|
-
this._newId = data.newId ?? data.new_id ?? null;
|
|
286
|
-
this._concept = data.concept instanceof ConceptLevelDiff
|
|
287
|
-
? data.concept
|
|
288
|
-
: ConceptLevelDiff.fromJSON(data.concept ?? {});
|
|
289
|
-
this._languages = wrapListDiff(data.languages);
|
|
290
|
-
this._localizations = {};
|
|
291
|
-
const raw = data.localizations ?? {};
|
|
292
|
-
for (const [lang, lcDiff] of Object.entries(raw)) {
|
|
293
|
-
this._localizations[lang] = lcDiff instanceof LocalizedConceptDiff
|
|
294
|
-
? lcDiff
|
|
295
|
-
: LocalizedConceptDiff.fromJSON(lcDiff);
|
|
296
|
-
}
|
|
297
|
-
this._totalItems = data.totalItems ?? data.total_items ?? 0;
|
|
298
|
-
this._statsCache = undefined;
|
|
299
|
-
this._similarityCache = undefined;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
get oldId() { return this._oldId; }
|
|
303
|
-
get newId() { return this._newId; }
|
|
304
|
-
get concept() { return this._concept; }
|
|
305
|
-
get languages() { return this._languages; }
|
|
306
|
-
get localizations() { return this._localizations; }
|
|
307
|
-
get totalItems() { return this._totalItems; }
|
|
308
|
-
|
|
309
|
-
get localizationLanguages() {
|
|
310
|
-
return Object.keys(this._localizations);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
get hasChanges() {
|
|
314
|
-
return this._concept.hasChanges
|
|
315
|
-
|| this._languages.hasChanges
|
|
316
|
-
|| Object.values(this._localizations).some(lc => lc.hasChanges);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
localization(lang) {
|
|
320
|
-
return this._localizations[lang] ?? null;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
get stats() {
|
|
324
|
-
if (this._statsCache === undefined) {
|
|
325
|
-
this._statsCache = collectStats(this.walk());
|
|
326
|
-
}
|
|
327
|
-
return this._statsCache;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
get similarity() {
|
|
331
|
-
if (this._similarityCache === undefined) {
|
|
332
|
-
this._similarityCache = computeSimilarity(this.stats.total, this._totalItems);
|
|
333
|
-
}
|
|
334
|
-
return this._similarityCache;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
*walk() {
|
|
338
|
-
yield* this._concept.walk();
|
|
339
|
-
yield* walkList('languages', this._languages);
|
|
340
|
-
for (const [lang, lc] of Object.entries(this._localizations)) {
|
|
341
|
-
for (const { path, change } of lc.walk(`localizations.${lang}`)) {
|
|
342
|
-
yield { path, change, language: lang };
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
toJSON() {
|
|
348
|
-
const obj = {};
|
|
349
|
-
if (this._oldId != null) obj.old_id = this._oldId;
|
|
350
|
-
if (this._newId != null) obj.new_id = this._newId;
|
|
351
|
-
obj.concept = this._concept.toJSON();
|
|
352
|
-
obj.languages = this._languages.toJSON();
|
|
353
|
-
obj.localizations = {};
|
|
354
|
-
for (const [lang, lc] of Object.entries(this._localizations)) {
|
|
355
|
-
obj.localizations[lang] = lc.toJSON();
|
|
356
|
-
}
|
|
357
|
-
obj.total_items = this._totalItems;
|
|
358
|
-
return obj;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
static fromJSON(data) {
|
|
362
|
-
return new ConceptDiff(data);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
export function diffConcepts(oldConcept, newConcept, language) {
|
|
367
|
-
if (!oldConcept && !newConcept) {
|
|
368
|
-
return new ConceptDiff({});
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
const oldId = oldConcept?.id ?? null;
|
|
372
|
-
const newId = newConcept?.id ?? null;
|
|
373
|
-
const oldLangs = oldConcept?.languages ?? [];
|
|
374
|
-
const newLangs = newConcept?.languages ?? [];
|
|
375
|
-
|
|
376
|
-
let langs;
|
|
377
|
-
if (language === 'all') {
|
|
378
|
-
langs = union(oldLangs, newLangs);
|
|
379
|
-
} else if (language) {
|
|
380
|
-
if (!oldLangs.includes(language) && !newLangs.includes(language)) {
|
|
381
|
-
throw new Error(
|
|
382
|
-
`diffConcepts: language '${language}' not present in either concept ` +
|
|
383
|
-
`(available: ${union(oldLangs, newLangs).join(', ') || 'none'})`,
|
|
384
|
-
);
|
|
385
|
-
}
|
|
386
|
-
langs = [language];
|
|
387
|
-
} else {
|
|
388
|
-
// No language specified: diff everything that exists. Avoids the
|
|
389
|
-
// silent 'eng' fallback that masked changes in concepts without an
|
|
390
|
-
// English localization.
|
|
391
|
-
langs = union(oldLangs, newLangs);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
const conceptDiff = diffConceptLevel(oldConcept ?? null, newConcept ?? null);
|
|
395
|
-
const languageDiff = diffLanguageSets(oldLangs, newLangs);
|
|
396
|
-
const localizations = {};
|
|
397
|
-
for (const lang of langs) {
|
|
398
|
-
const oldLoc = oldConcept?.localization(lang) ?? null;
|
|
399
|
-
const newLoc = newConcept?.localization(lang) ?? null;
|
|
400
|
-
const lcDiff = diffLocalizedConcepts(oldLoc, newLoc);
|
|
401
|
-
localizations[lang] = lcDiff;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
const totalItems = countConceptItems(oldConcept ?? null, newConcept ?? null, langs);
|
|
405
|
-
|
|
406
|
-
return new ConceptDiff({
|
|
407
|
-
oldId,
|
|
408
|
-
newId,
|
|
409
|
-
concept: conceptDiff,
|
|
410
|
-
languages: languageDiff,
|
|
411
|
-
localizations,
|
|
412
|
-
totalItems,
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
export function diffLocalizedConcepts(oldLoc, newLoc) {
|
|
417
|
-
if (!oldLoc && !newLoc) {
|
|
418
|
-
return new LocalizedConceptDiff({ languageCode: null });
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
const lang = newLoc?.languageCode ?? oldLoc?.languageCode ?? null;
|
|
422
|
-
|
|
423
|
-
if (!oldLoc) {
|
|
424
|
-
return fullyDiff(newLoc, lang, 'added');
|
|
425
|
-
}
|
|
426
|
-
if (!newLoc) {
|
|
427
|
-
return fullyDiff(oldLoc, lang, 'removed');
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
return new LocalizedConceptDiff({
|
|
431
|
-
languageCode: lang,
|
|
432
|
-
designations: diffDesignations(oldLoc.terms ?? [], newLoc.terms ?? []),
|
|
433
|
-
definitions: diffTextList(oldLoc.definitions ?? [], newLoc.definitions ?? []),
|
|
434
|
-
notes: diffTextList(oldLoc.notes ?? [], newLoc.notes ?? []),
|
|
435
|
-
examples: diffTextList(oldLoc.examples ?? [], newLoc.examples ?? []),
|
|
436
|
-
sources: diffSources(oldLoc.sources ?? [], newLoc.sources ?? []),
|
|
437
|
-
dates: diffDates(oldLoc.dates ?? [], newLoc.dates ?? []),
|
|
438
|
-
related: diffRelated(oldLoc.related ?? [], newLoc.related ?? []),
|
|
439
|
-
metadata: diffMetadata(oldLoc, newLoc, LOCALIZATION_METADATA_FIELDS),
|
|
440
|
-
totalItems: countLocalizedItems(oldLoc, newLoc),
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
function diffConceptLevel(oldConcept, newConcept) {
|
|
445
|
-
if (!oldConcept && !newConcept) {
|
|
446
|
-
return new ConceptLevelDiff({});
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
const Direction = !oldConcept ? 'added' : !newConcept ? 'removed' : null;
|
|
450
|
-
|
|
451
|
-
if (Direction) {
|
|
452
|
-
const c = (oldConcept ?? newConcept);
|
|
453
|
-
return new ConceptLevelDiff({
|
|
454
|
-
sources: fullListDiff(c.sources ?? [], Direction),
|
|
455
|
-
dates: fullListDiff(c.dates ?? [], Direction),
|
|
456
|
-
relatedConcepts: fullListDiff(c.relatedConcepts ?? [], Direction),
|
|
457
|
-
relations: fullListDiff(c.relations ?? [], Direction),
|
|
458
|
-
groups: fullListDiff(c.groups ?? [], Direction),
|
|
459
|
-
sections: fullListDiff(c.sections ?? [], Direction),
|
|
460
|
-
tags: fullListDiff(c.tags ?? [], Direction),
|
|
461
|
-
metadata: fullMetadataDiff(c, CONCEPT_METADATA_FIELDS, Direction),
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
return new ConceptLevelDiff({
|
|
466
|
-
sources: diffSources(oldConcept.sources ?? [], newConcept.sources ?? []),
|
|
467
|
-
dates: diffDates(oldConcept.dates ?? [], newConcept.dates ?? []),
|
|
468
|
-
relatedConcepts: diffRelatedConcepts(oldConcept.relatedConcepts ?? [], newConcept.relatedConcepts ?? []),
|
|
469
|
-
relations: diffHyperedges(
|
|
470
|
-
oldConcept.relations ?? [],
|
|
471
|
-
newConcept.relations ?? [],
|
|
472
|
-
),
|
|
473
|
-
groups: diffStringSet(oldConcept.groups ?? [], newConcept.groups ?? []),
|
|
474
|
-
sections: diffStringSet(oldConcept.sections ?? [], newConcept.sections ?? []),
|
|
475
|
-
tags: diffStringSet(oldConcept.tags ?? [], newConcept.tags ?? []),
|
|
476
|
-
metadata: diffMetadata(oldConcept, newConcept, CONCEPT_METADATA_FIELDS),
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
function diffLanguageSets(oldLangs, newLangs) {
|
|
481
|
-
const oldSet = new Set(oldLangs);
|
|
482
|
-
const newSet = new Set(newLangs);
|
|
483
|
-
const added = newLangs
|
|
484
|
-
.filter(l => !oldSet.has(l))
|
|
485
|
-
.sort()
|
|
486
|
-
.map(l => new Added({ value: l }));
|
|
487
|
-
const removed = oldLangs
|
|
488
|
-
.filter(l => !newSet.has(l))
|
|
489
|
-
.sort()
|
|
490
|
-
.map(l => new Removed({ value: l }));
|
|
491
|
-
return new ListDiff({ added, removed, changed: [] });
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
function fullyDiff(loc, lang, direction) {
|
|
495
|
-
const ChangeClass = direction === 'added' ? Added : Removed;
|
|
496
|
-
const key = direction;
|
|
497
|
-
const lc = new LocalizedConceptDiff({
|
|
498
|
-
languageCode: lang,
|
|
499
|
-
designations: new ListDiff({ [key]: (loc.terms ?? []).map(v => new ChangeClass({ value: v })) }),
|
|
500
|
-
definitions: new ListDiff({ [key]: (loc.definitions ?? []).map(v => new ChangeClass({ value: v })) }),
|
|
501
|
-
notes: new ListDiff({ [key]: (loc.notes ?? []).map(v => new ChangeClass({ value: v })) }),
|
|
502
|
-
examples: new ListDiff({ [key]: (loc.examples ?? []).map(v => new ChangeClass({ value: v })) }),
|
|
503
|
-
sources: new ListDiff({ [key]: (loc.sources ?? []).map(v => new ChangeClass({ value: v })) }),
|
|
504
|
-
dates: new ListDiff({ [key]: (loc.dates ?? []).map(v => new ChangeClass({ value: v })) }),
|
|
505
|
-
related: new ListDiff({ [key]: (loc.related ?? []).map(v => new ChangeClass({ value: v })) }),
|
|
506
|
-
metadata: fullMetadataDiff(loc, LOCALIZATION_METADATA_FIELDS, direction),
|
|
507
|
-
totalItems: countLocalizedItems(direction === 'added' ? null : loc, direction === 'added' ? loc : null),
|
|
508
|
-
});
|
|
509
|
-
return lc;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
function fullListDiff(items, direction) {
|
|
513
|
-
const ChangeClass = direction === 'added' ? Added : Removed;
|
|
514
|
-
return new ListDiff({ [direction]: items.map(v => new ChangeClass({ value: v })) });
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
function fullMetadataDiff(obj, fields, direction) {
|
|
518
|
-
const changes = {};
|
|
519
|
-
for (const field of fields) {
|
|
520
|
-
const val = obj[field];
|
|
521
|
-
if (val != null) {
|
|
522
|
-
changes[field] = new Changed({
|
|
523
|
-
oldValue: direction === 'added' ? null : val,
|
|
524
|
-
newValue: direction === 'added' ? val : null,
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
return new MetadataDiff({ changes });
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
function diffDesignations(oldTerms, newTerms) {
|
|
532
|
-
return diffSet(oldTerms, newTerms, {
|
|
533
|
-
identityKey: identityOf,
|
|
534
|
-
textKey: d => d?.designation ?? '',
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
function diffTextList(oldItems, newItems) {
|
|
539
|
-
return diffList(oldItems, newItems, {
|
|
540
|
-
textKey: d => d?.content ?? '',
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
function diffSources(oldSources, newSources) {
|
|
545
|
-
return diffSet(oldSources, newSources, {
|
|
546
|
-
identityKey: identityOf,
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
function diffDates(oldDates, newDates) {
|
|
551
|
-
return diffSet(oldDates, newDates, {
|
|
552
|
-
identityKey: identityOf,
|
|
553
|
-
textKey: d => d?.date ?? '',
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
function diffRelated(oldRelated, newRelated) {
|
|
558
|
-
return diffSet(oldRelated, newRelated, {
|
|
559
|
-
identityKey: identityOf,
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
function diffRelatedConcepts(oldRC, newRC) {
|
|
564
|
-
return diffSet(oldRC, newRC, {
|
|
565
|
-
identityKey: identityOf,
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
// Diff two unified hyperedge arrays. Identity is polymorphic —
|
|
570
|
-
// dispatches via value.constructor.identityOf so PartitiveHyperedge
|
|
571
|
-
// and GenericHyperedge (and any future hyperedge subclass) coexist in
|
|
572
|
-
// the same list. Cross-type entries with matching identity are still
|
|
573
|
-
// treated as different (because their constructor differs and they
|
|
574
|
-
// live under different wire keys).
|
|
575
|
-
function diffHyperedges(oldR, newR) {
|
|
576
|
-
return diffSet(oldR, newR, {
|
|
577
|
-
identityKey: relationIdentityOf,
|
|
578
|
-
textKey: relationText,
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
function relationIdentityOf(value) {
|
|
583
|
-
if (value == null) return '';
|
|
584
|
-
const Cls = value.constructor;
|
|
585
|
-
if (typeof Cls?.identityOf === 'function') {
|
|
586
|
-
const typed = Cls.identityOf(value);
|
|
587
|
-
return `${Cls.name}::${typed}`;
|
|
588
|
-
}
|
|
589
|
-
return identityOf(value);
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
function filterListDiffByType(listDiff, Cls) {
|
|
593
|
-
if (!listDiff) return listDiff;
|
|
594
|
-
return new ListDiff({
|
|
595
|
-
added: listDiff.added.filter(e => e.value instanceof Cls),
|
|
596
|
-
removed: listDiff.removed.filter(e => e.value instanceof Cls),
|
|
597
|
-
changed: listDiff.changed.filter(e =>
|
|
598
|
-
(e.oldValue == null || e.oldValue instanceof Cls) &&
|
|
599
|
-
(e.newValue == null || e.newValue instanceof Cls)),
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
function relationText(r) {
|
|
604
|
-
if (!r) return '';
|
|
605
|
-
return canonicalJson(typeof r.toJSON === 'function' ? r.toJSON() : r);
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
function diffStringSet(oldStrings, newStrings) {
|
|
609
|
-
return diffSet(oldStrings, newStrings, {
|
|
610
|
-
identityKey: identityOf,
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
function diffMetadata(oldObj, newObj, fields) {
|
|
615
|
-
const changes = {};
|
|
616
|
-
for (const field of fields) {
|
|
617
|
-
const oldVal = oldObj[field];
|
|
618
|
-
const newVal = newObj[field];
|
|
619
|
-
if (oldVal !== newVal) {
|
|
620
|
-
changes[field] = new Changed({ oldValue: oldVal, newValue: newVal });
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
return new MetadataDiff({ changes });
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
function wrapListDiff(data) {
|
|
627
|
-
if (data instanceof ListDiff) return data;
|
|
628
|
-
return ListDiff.fromJSON(data ?? {});
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
function collectStats(walker) {
|
|
632
|
-
let added = 0;
|
|
633
|
-
let removed = 0;
|
|
634
|
-
let changed = 0;
|
|
635
|
-
for (const { change } of walker) {
|
|
636
|
-
if (change.type === 'added') added++;
|
|
637
|
-
else if (change.type === 'removed') removed++;
|
|
638
|
-
else if (change.type === 'changed') changed++;
|
|
639
|
-
}
|
|
640
|
-
return new DiffStats({ added, removed, changed });
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
function maxOf(a, b) {
|
|
644
|
-
return Math.max(a ?? 0, b ?? 0);
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
function countConceptItems(oldConcept, newConcept, langs) {
|
|
648
|
-
let count = 0;
|
|
649
|
-
|
|
650
|
-
count += maxOf(oldConcept?.sources?.length, newConcept?.sources?.length);
|
|
651
|
-
count += maxOf(oldConcept?.dates?.length, newConcept?.dates?.length);
|
|
652
|
-
count += maxOf(oldConcept?.relatedConcepts?.length, newConcept?.relatedConcepts?.length);
|
|
653
|
-
count += maxOf(
|
|
654
|
-
oldConcept?.relations?.length,
|
|
655
|
-
newConcept?.relations?.length,
|
|
656
|
-
);
|
|
657
|
-
count += maxOf(oldConcept?.groups?.length, newConcept?.groups?.length);
|
|
658
|
-
count += maxOf(oldConcept?.sections?.length, newConcept?.sections?.length);
|
|
659
|
-
count += maxOf(oldConcept?.tags?.length, newConcept?.tags?.length);
|
|
660
|
-
count += CONCEPT_METADATA_FIELDS.length;
|
|
661
|
-
|
|
662
|
-
const oldLangs = oldConcept?.languages ?? [];
|
|
663
|
-
const newLangs = newConcept?.languages ?? [];
|
|
664
|
-
count += maxOf(oldLangs.length, newLangs.length);
|
|
665
|
-
|
|
666
|
-
for (const lang of langs) {
|
|
667
|
-
const oldLoc = oldConcept?.localization(lang) ?? null;
|
|
668
|
-
const newLoc = newConcept?.localization(lang) ?? null;
|
|
669
|
-
count += countLocalizedItems(oldLoc, newLoc);
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
return count;
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
function countLocalizedItems(oldLoc, newLoc) {
|
|
676
|
-
let count = 0;
|
|
677
|
-
count += maxOf(oldLoc?.terms?.length, newLoc?.terms?.length);
|
|
678
|
-
count += maxOf(oldLoc?.definitions?.length, newLoc?.definitions?.length);
|
|
679
|
-
count += maxOf(oldLoc?.notes?.length, newLoc?.notes?.length);
|
|
680
|
-
count += maxOf(oldLoc?.examples?.length, newLoc?.examples?.length);
|
|
681
|
-
count += maxOf(oldLoc?.sources?.length, newLoc?.sources?.length);
|
|
682
|
-
count += maxOf(oldLoc?.dates?.length, newLoc?.dates?.length);
|
|
683
|
-
count += maxOf(oldLoc?.related?.length, newLoc?.related?.length);
|
|
684
|
-
count += LOCALIZATION_METADATA_FIELDS.length;
|
|
685
|
-
return count;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
function* walkList(section, listDiff) {
|
|
689
|
-
for (let i = 0; i < listDiff.added.length; i++) {
|
|
690
|
-
yield { path: `${section}.added[${i}]`, change: listDiff.added[i] };
|
|
691
|
-
}
|
|
692
|
-
for (let i = 0; i < listDiff.removed.length; i++) {
|
|
693
|
-
yield { path: `${section}.removed[${i}]`, change: listDiff.removed[i] };
|
|
694
|
-
}
|
|
695
|
-
for (let i = 0; i < listDiff.changed.length; i++) {
|
|
696
|
-
yield { path: `${section}.changed[${i}]`, change: listDiff.changed[i] };
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
function union(a, b) {
|
|
701
|
-
return [...new Set([...a, ...b])].sort();
|
|
702
|
-
}
|