glossarist 0.4.50 → 0.4.52
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 +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- 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 -57
- 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/utils/external-detection.d.ts +38 -0
- package/dist/utils/external-detection.d.ts.map +1 -0
- package/dist/utils/external-detection.js +55 -0
- package/dist/utils/external-detection.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/extensional-completeness.d.ts +18 -0
- package/dist/validators/extensional-completeness.d.ts.map +1 -0
- package/dist/validators/extensional-completeness.js +41 -0
- package/dist/validators/extensional-completeness.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 -172
- package/src/concept-parser.ts +0 -235
- package/src/concept-reader.d.ts +0 -13
- package/src/concept-serializer.ts +0 -110
- package/src/concept-writer.d.ts +0 -7
- package/src/concept-writer.ts +0 -47
- package/src/diff/canonical-json.ts +0 -29
- package/src/diff/change.ts +0 -175
- package/src/diff/collection-diff.ts +0 -245
- package/src/diff/concept-diff.ts +0 -853
- package/src/diff/diff-patch.ts +0 -276
- package/src/diff/diff-renderer.ts +0 -348
- 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 -512
- package/src/gcr-writer.d.ts +0 -22
- package/src/gcr-writer.ts +0 -99
- package/src/index.d.ts +0 -124
- package/src/index.ts +0 -92
- package/src/managed-concept-collection.ts +0 -130
- 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 -137
- 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 -46
- 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 -202
- 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 -190
- 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 -179
- package/src/reference-mention.ts +0 -114
- package/src/reference-resolver.ts +0 -361
- package/src/render-classification.ts +0 -85
- 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 -66
- package/src/validators/asset-index.ts +0 -72
- 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 -76
- 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 -382
- 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/models/concept.ts
DELETED
|
@@ -1,499 +0,0 @@
|
|
|
1
|
-
import { GlossaristModel } from './base.js';
|
|
2
|
-
import { LocalizedConcept } from './localized-concept.js';
|
|
3
|
-
import type { LocalizedConceptJson } from './localized-concept.js';
|
|
4
|
-
import { RelatedConcept } from './related-concept.js';
|
|
5
|
-
import type { RelatedConceptJson } from './related-concept.js';
|
|
6
|
-
import { PartitiveHyperedge } from './partitive-hyperedge.js';
|
|
7
|
-
import { AbstractHyperedge } from './abstract-hyperedge.js';
|
|
8
|
-
import type { AbstractHyperedgeJson } from './abstract-hyperedge.js';
|
|
9
|
-
import { HyperedgeRegistry, groupHyperedgesByWireKey } from './hyperedge-registry.js';
|
|
10
|
-
import type { HyperedgeClass } from './hyperedge-registry.js';
|
|
11
|
-
import { migrateHyperedgeToRelation } from '../migration/hyperedge-migrator.js';
|
|
12
|
-
import { ConceptReference } from './concept-reference.js';
|
|
13
|
-
import type { ConceptReferenceJson } from './concept-reference.js';
|
|
14
|
-
import { ConceptDate } from './concept-date.js';
|
|
15
|
-
import type { ConceptDateJson } from './concept-date.js';
|
|
16
|
-
import { ConceptSource } from './concept-source.js';
|
|
17
|
-
import type { ConceptSourceJson } from './concept-source.js';
|
|
18
|
-
import { FigureReference } from './non-verbal-references.js';
|
|
19
|
-
import { TableReference } from './non-verbal-references.js';
|
|
20
|
-
import { FormulaReference } from './non-verbal-references.js';
|
|
21
|
-
import { diffConcepts } from '../diff/concept-diff.js';
|
|
22
|
-
|
|
23
|
-
export interface ConceptJson {
|
|
24
|
-
id?: string;
|
|
25
|
-
termid?: string;
|
|
26
|
-
term?: string | null;
|
|
27
|
-
uri?: string | null;
|
|
28
|
-
localizations?: Record<string, LocalizedConceptJson>;
|
|
29
|
-
related?: ReadonlyArray<RelatedConceptJson | RelatedConcept>;
|
|
30
|
-
relatedConcepts?: ReadonlyArray<RelatedConceptJson | RelatedConcept>;
|
|
31
|
-
related_concepts?: ReadonlyArray<RelatedConceptJson | RelatedConcept>;
|
|
32
|
-
relations?: ReadonlyArray<unknown>;
|
|
33
|
-
domains?: ReadonlyArray<ConceptReferenceJson | ConceptReference>;
|
|
34
|
-
groups?: ReadonlyArray<string | { id?: string; sectionId?: string } | ConceptReferenceJson>;
|
|
35
|
-
sections?: ReadonlyArray<string | { id?: string; sectionId?: string }>;
|
|
36
|
-
tags?: ReadonlyArray<string>;
|
|
37
|
-
dates?: ReadonlyArray<ConceptDateJson | ConceptDate>;
|
|
38
|
-
sources?: ReadonlyArray<ConceptSourceJson | ConceptSource>;
|
|
39
|
-
figures?: ReadonlyArray<unknown>;
|
|
40
|
-
tables?: ReadonlyArray<unknown>;
|
|
41
|
-
formulas?: ReadonlyArray<unknown>;
|
|
42
|
-
status?: string | null;
|
|
43
|
-
schemaVersion?: string;
|
|
44
|
-
schema_version?: string;
|
|
45
|
-
raw?: unknown;
|
|
46
|
-
[key: string]: unknown;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const CONCEPT_WIRE_NAMES: Readonly<Record<string, string>> = Object.freeze({
|
|
50
|
-
schemaVersion: 'schema_version',
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
type GroupOrSection = string | { id?: string; sectionId?: string };
|
|
54
|
-
|
|
55
|
-
export class Concept extends GlossaristModel {
|
|
56
|
-
static get DIFF_FIELDS(): ReadonlyArray<string> {
|
|
57
|
-
return Object.freeze(['status', 'term', 'uri', 'schemaVersion']);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
static wireNameFor(field: string): string {
|
|
61
|
-
return CONCEPT_WIRE_NAMES[field] ?? field;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
readonly id: string;
|
|
65
|
-
readonly term: string | null;
|
|
66
|
-
readonly uri: string | null;
|
|
67
|
-
private readonly _rawLocalizations: Record<string, LocalizedConceptJson>;
|
|
68
|
-
private _cache: Record<string, LocalizedConcept> = {};
|
|
69
|
-
|
|
70
|
-
readonly relatedConcepts: ReadonlyArray<RelatedConcept>;
|
|
71
|
-
relations: ReadonlyArray<AbstractHyperedge>;
|
|
72
|
-
readonly domains: ReadonlyArray<ConceptReference>;
|
|
73
|
-
readonly groups: ReadonlyArray<string>;
|
|
74
|
-
readonly sections: ReadonlyArray<string>;
|
|
75
|
-
readonly tags: ReadonlyArray<string>;
|
|
76
|
-
readonly dates: ReadonlyArray<ConceptDate>;
|
|
77
|
-
readonly sources: ReadonlyArray<ConceptSource>;
|
|
78
|
-
private readonly _rawFigures: ReadonlyArray<unknown>;
|
|
79
|
-
private readonly _rawTables: ReadonlyArray<unknown>;
|
|
80
|
-
private readonly _rawFormulas: ReadonlyArray<unknown>;
|
|
81
|
-
private _figures: ReadonlyArray<FigureReference> | null = null;
|
|
82
|
-
private _tables: ReadonlyArray<TableReference> | null = null;
|
|
83
|
-
private _formulas: ReadonlyArray<FormulaReference> | null = null;
|
|
84
|
-
readonly status: string | null;
|
|
85
|
-
readonly schemaVersion: string;
|
|
86
|
-
readonly raw: unknown;
|
|
87
|
-
|
|
88
|
-
constructor(data: ConceptJson = {}) {
|
|
89
|
-
super();
|
|
90
|
-
this.id = String(data.id ?? (data.termid as string | undefined) ?? '');
|
|
91
|
-
this.term = data.term ?? null;
|
|
92
|
-
this.uri = data.uri ?? null;
|
|
93
|
-
this._rawLocalizations =
|
|
94
|
-
(data.localizations as Record<string, LocalizedConceptJson>) ?? {};
|
|
95
|
-
this._cache = {};
|
|
96
|
-
|
|
97
|
-
this.relatedConcepts = _mapInstances(
|
|
98
|
-
(data.relatedConcepts ?? data.related ?? data.related_concepts ?? []) as ReadonlyArray<RelatedConceptJson | RelatedConcept>,
|
|
99
|
-
RelatedConcept,
|
|
100
|
-
);
|
|
101
|
-
this.relations = _resolveHyperedges(data);
|
|
102
|
-
|
|
103
|
-
this.domains = _normalizeDomains(data.domains, data.groups);
|
|
104
|
-
this.groups = Array.isArray(data.groups)
|
|
105
|
-
? (data.groups as ReadonlyArray<GroupOrSection>)
|
|
106
|
-
.map((g) =>
|
|
107
|
-
typeof g === 'string'
|
|
108
|
-
? g
|
|
109
|
-
: (g as { id?: string; sectionId?: string })?.id ??
|
|
110
|
-
(g as { sectionId?: string })?.sectionId ??
|
|
111
|
-
null,
|
|
112
|
-
)
|
|
113
|
-
.filter((g): g is string => Boolean(g))
|
|
114
|
-
: [];
|
|
115
|
-
this.sections = Array.isArray(data.sections)
|
|
116
|
-
? (data.sections as ReadonlyArray<GroupOrSection>)
|
|
117
|
-
.map((s) =>
|
|
118
|
-
typeof s === 'string'
|
|
119
|
-
? s
|
|
120
|
-
: (s as { id?: string; sectionId?: string })?.id ??
|
|
121
|
-
(s as { sectionId?: string })?.sectionId ??
|
|
122
|
-
null,
|
|
123
|
-
)
|
|
124
|
-
.filter((s): s is string => Boolean(s))
|
|
125
|
-
: [];
|
|
126
|
-
this.tags = Array.isArray(data.tags) ? [...data.tags] : [];
|
|
127
|
-
this.dates = _mapInstances(
|
|
128
|
-
(data.dates ?? []) as ReadonlyArray<ConceptDateJson | ConceptDate>,
|
|
129
|
-
ConceptDate,
|
|
130
|
-
);
|
|
131
|
-
this.sources = _mapInstances(
|
|
132
|
-
(data.sources ?? []) as ReadonlyArray<ConceptSourceJson | ConceptSource>,
|
|
133
|
-
ConceptSource,
|
|
134
|
-
);
|
|
135
|
-
this._rawFigures = data.figures ?? [];
|
|
136
|
-
this._rawTables = data.tables ?? [];
|
|
137
|
-
this._rawFormulas = data.formulas ?? [];
|
|
138
|
-
this.status = data.status ?? null;
|
|
139
|
-
this.schemaVersion = data.schemaVersion ?? data.schema_version ?? '3';
|
|
140
|
-
this.raw = data.raw ?? null;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
get termid(): string { return this.id; }
|
|
144
|
-
|
|
145
|
-
get languages(): string[] {
|
|
146
|
-
return Object.keys(this._rawLocalizations);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
get languageCodes(): string[] {
|
|
150
|
-
return this.languages;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
localization(lang: string): LocalizedConcept | undefined {
|
|
154
|
-
if (!(lang in this._rawLocalizations)) return undefined;
|
|
155
|
-
if (!this._cache[lang]) {
|
|
156
|
-
const raw = this._rawLocalizations[lang];
|
|
157
|
-
this._cache[lang] = new LocalizedConcept({ ...raw, language_code: lang });
|
|
158
|
-
}
|
|
159
|
-
return this._cache[lang];
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
diff(other: Concept, language: string = 'eng'): unknown {
|
|
163
|
-
return diffConcepts(this, other, language);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
primaryDesignation(lang: string): unknown {
|
|
167
|
-
return (
|
|
168
|
-
(this.localization(lang) as { primaryDesignation?: unknown } | undefined)
|
|
169
|
-
?.primaryDesignation ?? null
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
definition(lang: string): unknown {
|
|
174
|
-
return (
|
|
175
|
-
(this.localization(lang) as { primaryDefinition?: unknown } | undefined)
|
|
176
|
-
?.primaryDefinition ?? null
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
setLocalization(lang: string, lc: LocalizedConcept | LocalizedConceptJson): this {
|
|
181
|
-
if (lc instanceof LocalizedConcept) {
|
|
182
|
-
this._cache[lang] = lc;
|
|
183
|
-
const json = lc.toJSON() as LocalizedConceptJson & { language_code?: string };
|
|
184
|
-
delete json.language_code;
|
|
185
|
-
this._rawLocalizations[lang] = json;
|
|
186
|
-
} else {
|
|
187
|
-
this._rawLocalizations[lang] = lc;
|
|
188
|
-
delete this._cache[lang];
|
|
189
|
-
}
|
|
190
|
-
return this;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
hasLocalization(lang: string): boolean {
|
|
194
|
-
return lang in this._rawLocalizations;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
findSourceById(id: string): ConceptSource | null {
|
|
198
|
-
if (typeof id !== 'string' || id.length === 0) return null;
|
|
199
|
-
for (const source of this.sources) {
|
|
200
|
-
if (source.id === id) return source;
|
|
201
|
-
}
|
|
202
|
-
for (const lang of this.languages) {
|
|
203
|
-
const lc = this.localization(lang);
|
|
204
|
-
if (!lc) continue;
|
|
205
|
-
const lcSources = (
|
|
206
|
-
lc as { sources?: ReadonlyArray<{ id?: string | null }> }
|
|
207
|
-
).sources ?? [];
|
|
208
|
-
for (const source of lcSources) {
|
|
209
|
-
if (source.id === id) return source as unknown as ConceptSource;
|
|
210
|
-
}
|
|
211
|
-
const lcTerms = (
|
|
212
|
-
lc as {
|
|
213
|
-
terms?: ReadonlyArray<{
|
|
214
|
-
sources?: ReadonlyArray<{ id?: string | null }>;
|
|
215
|
-
}>;
|
|
216
|
-
}
|
|
217
|
-
).terms ?? [];
|
|
218
|
-
for (const designation of lcTerms) {
|
|
219
|
-
for (const source of designation.sources ?? []) {
|
|
220
|
-
if (source.id === id) return source as unknown as ConceptSource;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
return null;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
get figures(): ReadonlyArray<FigureReference> {
|
|
228
|
-
return this._lazy<FigureReference>(
|
|
229
|
-
'_figures',
|
|
230
|
-
'_rawFigures',
|
|
231
|
-
(r) => FigureReference.fromJSON(r as never),
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
get tables(): ReadonlyArray<TableReference> {
|
|
236
|
-
return this._lazy<TableReference>(
|
|
237
|
-
'_tables',
|
|
238
|
-
'_rawTables',
|
|
239
|
-
(r) => TableReference.fromJSON(r as never),
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
get formulas(): ReadonlyArray<FormulaReference> {
|
|
244
|
-
return this._lazy<FormulaReference>(
|
|
245
|
-
'_formulas',
|
|
246
|
-
'_rawFormulas',
|
|
247
|
-
(r) => FormulaReference.fromJSON(r as never),
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
*walkTexts(): Generator<{ text: string; source: string; language?: string }> {
|
|
252
|
-
for (const lang of this.languages) {
|
|
253
|
-
const lc = this.localization(lang);
|
|
254
|
-
if (!lc) continue;
|
|
255
|
-
const walker = (
|
|
256
|
-
lc as {
|
|
257
|
-
walkTexts?: (
|
|
258
|
-
p: string,
|
|
259
|
-
) => Generator<{ text: string; source: string }>;
|
|
260
|
-
}
|
|
261
|
-
).walkTexts;
|
|
262
|
-
if (typeof walker === 'function') {
|
|
263
|
-
yield* walker.call(lc, `localizations.${lang}`);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
override toJSON(): ConceptJson {
|
|
269
|
-
const obj: ConceptJson = { id: this.id };
|
|
270
|
-
if (this.term != null) obj.term = this.term;
|
|
271
|
-
if (this.uri != null) obj.uri = this.uri;
|
|
272
|
-
|
|
273
|
-
if (Object.keys(this._rawLocalizations).length > 0) {
|
|
274
|
-
obj.localizations = {};
|
|
275
|
-
const loc = obj.localizations;
|
|
276
|
-
for (const lang of this.languages) {
|
|
277
|
-
const lc = this.localization(lang);
|
|
278
|
-
if (lc) {
|
|
279
|
-
const json = lc.toJSON() as LocalizedConceptJson & {
|
|
280
|
-
language_code?: string;
|
|
281
|
-
};
|
|
282
|
-
delete json.language_code;
|
|
283
|
-
loc[lang] = json;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
} else {
|
|
287
|
-
obj.localizations = {};
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
if (this.relatedConcepts.length > 0) {
|
|
291
|
-
obj.related = this.relatedConcepts.map((rc) => rc.toJSON());
|
|
292
|
-
}
|
|
293
|
-
const grouped = groupHyperedgesByWireKey(this.relations);
|
|
294
|
-
for (const [wireKey, rels] of Object.entries(grouped)) {
|
|
295
|
-
if (rels.length > 0) obj[wireKey] = rels.map((r) => r.toJSON());
|
|
296
|
-
}
|
|
297
|
-
if (this.domains.length > 0) {
|
|
298
|
-
obj.domains = this.domains.map((d) => d.toJSON());
|
|
299
|
-
}
|
|
300
|
-
if (this.tags.length > 0) {
|
|
301
|
-
obj.tags = [...this.tags];
|
|
302
|
-
}
|
|
303
|
-
if (this.dates.length > 0) {
|
|
304
|
-
obj.dates = this.dates.map((d) => d.toJSON());
|
|
305
|
-
}
|
|
306
|
-
if (this.sources.length > 0) {
|
|
307
|
-
obj.sources = this.sources.map((s) => s.toJSON());
|
|
308
|
-
}
|
|
309
|
-
this._serialize(obj as unknown as Record<string, unknown>, 'figures', '_figures', '_rawFigures');
|
|
310
|
-
this._serialize(obj as unknown as Record<string, unknown>, 'tables', '_tables', '_rawTables');
|
|
311
|
-
this._serialize(obj as unknown as Record<string, unknown>, 'formulas', '_formulas', '_rawFormulas');
|
|
312
|
-
if (this.status != null) obj.status = this.status;
|
|
313
|
-
obj.schema_version = this.schemaVersion;
|
|
314
|
-
return obj;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
static override fromJSON(data: ConceptJson): Concept {
|
|
318
|
-
return new Concept(data);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function _mapInstances<T, J>(
|
|
323
|
-
arr: ReadonlyArray<T | J>,
|
|
324
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
325
|
-
Cls: new (...args: any[]) => T,
|
|
326
|
-
): ReadonlyArray<T> {
|
|
327
|
-
return arr.map((item) => (item instanceof Cls ? item : new Cls(item))) as ReadonlyArray<T>;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
type HyperedgeInput =
|
|
331
|
-
| AbstractHyperedge
|
|
332
|
-
| (AbstractHyperedgeJson & { type?: string })
|
|
333
|
-
| { type: string; [key: string]: unknown }
|
|
334
|
-
| { toJSON(): unknown };
|
|
335
|
-
|
|
336
|
-
function _resolveHyperedges(data: ConceptJson): ReadonlyArray<AbstractHyperedge> {
|
|
337
|
-
_assertNoAmbiguousInput(data);
|
|
338
|
-
|
|
339
|
-
const relations = data.relations as ReadonlyArray<HyperedgeInput> | undefined;
|
|
340
|
-
if (Array.isArray(relations)) {
|
|
341
|
-
const out: AbstractHyperedge[] = [];
|
|
342
|
-
for (const r of relations) {
|
|
343
|
-
const coerced = _coerceHyperedge(r);
|
|
344
|
-
if (coerced) out.push(coerced);
|
|
345
|
-
}
|
|
346
|
-
return _dedupeOrThrow(out);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
const out: AbstractHyperedge[] = [];
|
|
350
|
-
|
|
351
|
-
for (const cls of HyperedgeRegistry.allClasses()) {
|
|
352
|
-
const arr = data[cls.wireKey] as ReadonlyArray<HyperedgeInput> | undefined;
|
|
353
|
-
const camelArr = data[_camelCase(cls.wireKey)] as
|
|
354
|
-
| ReadonlyArray<HyperedgeInput>
|
|
355
|
-
| undefined;
|
|
356
|
-
const source = arr ?? camelArr;
|
|
357
|
-
if (!Array.isArray(source)) continue;
|
|
358
|
-
for (const r of source) {
|
|
359
|
-
const coerced = _coerceHyperedge(r, cls);
|
|
360
|
-
if (coerced) out.push(coerced);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
for (const cls of HyperedgeRegistry.allClasses()) {
|
|
365
|
-
for (const v1Key of cls.v1WireKeys ?? []) {
|
|
366
|
-
const camelV1 = _camelCase(v1Key);
|
|
367
|
-
const arr = data[v1Key] as
|
|
368
|
-
| ReadonlyArray<Record<string, unknown>>
|
|
369
|
-
| undefined;
|
|
370
|
-
const camelArr = data[camelV1] as
|
|
371
|
-
| ReadonlyArray<Record<string, unknown>>
|
|
372
|
-
| undefined;
|
|
373
|
-
const source = arr ?? camelArr;
|
|
374
|
-
if (!Array.isArray(source)) continue;
|
|
375
|
-
for (const h of source) {
|
|
376
|
-
const migrated = _migrateV1Hash(cls, v1Key, h);
|
|
377
|
-
if (migrated) {
|
|
378
|
-
const Ctor = cls as unknown as new (data: unknown) => AbstractHyperedge;
|
|
379
|
-
out.push(new Ctor(migrated));
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
return _dedupeOrThrow(out);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function _assertNoAmbiguousInput(data: ConceptJson): void {
|
|
389
|
-
if (!Array.isArray(data.relations)) return;
|
|
390
|
-
const typedKeys: string[] = [];
|
|
391
|
-
for (const cls of HyperedgeRegistry.allClasses()) {
|
|
392
|
-
if (Array.isArray(data[cls.wireKey])) typedKeys.push(cls.wireKey);
|
|
393
|
-
const camelWire = _camelCase(cls.wireKey);
|
|
394
|
-
if (camelWire !== cls.wireKey && Array.isArray(data[camelWire])) {
|
|
395
|
-
typedKeys.push(camelWire);
|
|
396
|
-
}
|
|
397
|
-
for (const v1 of cls.v1WireKeys ?? []) {
|
|
398
|
-
if (Array.isArray(data[v1])) typedKeys.push(v1);
|
|
399
|
-
const camelV1 = _camelCase(v1);
|
|
400
|
-
if (camelV1 !== v1 && Array.isArray(data[camelV1])) typedKeys.push(camelV1);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
if (typedKeys.length > 0) {
|
|
404
|
-
throw new Error(
|
|
405
|
-
`Concept input is ambiguous: pass either 'relations' (unified) ` +
|
|
406
|
-
`or typed wire keys (${typedKeys.join(', ')}), not both.`,
|
|
407
|
-
);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
function _dedupeOrThrow(
|
|
412
|
-
relations: ReadonlyArray<AbstractHyperedge>,
|
|
413
|
-
): ReadonlyArray<AbstractHyperedge> {
|
|
414
|
-
const seen = new Map<string, AbstractHyperedge>();
|
|
415
|
-
for (const r of relations) {
|
|
416
|
-
const id = _hyperedgeIdentity(r);
|
|
417
|
-
if (seen.has(id)) {
|
|
418
|
-
throw new Error(
|
|
419
|
-
`Concept input has duplicate hyperedge (identity=${id}). ` +
|
|
420
|
-
`Passing the same relation twice is a bug.`,
|
|
421
|
-
);
|
|
422
|
-
}
|
|
423
|
-
seen.set(id, r);
|
|
424
|
-
}
|
|
425
|
-
return relations;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
function _hyperedgeIdentity(r: AbstractHyperedge | null | undefined): string {
|
|
429
|
-
if (r == null) return '';
|
|
430
|
-
const Cls = r.constructor as {
|
|
431
|
-
name: string;
|
|
432
|
-
identityOf?: (v: unknown) => string;
|
|
433
|
-
};
|
|
434
|
-
if (typeof Cls?.identityOf === 'function') {
|
|
435
|
-
return `${Cls.name}::${Cls.identityOf(r)}`;
|
|
436
|
-
}
|
|
437
|
-
return String(r);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
function _coerceHyperedge(
|
|
441
|
-
value: HyperedgeInput | null | undefined,
|
|
442
|
-
fallbackClass?: HyperedgeClass,
|
|
443
|
-
): AbstractHyperedge | null {
|
|
444
|
-
if (value == null) return null;
|
|
445
|
-
if (value instanceof AbstractHyperedge) return value;
|
|
446
|
-
|
|
447
|
-
const hash =
|
|
448
|
-
typeof (value as { toJSON?: () => unknown }).toJSON === 'function'
|
|
449
|
-
? ((value as { toJSON: () => unknown }).toJSON() as Record<string, unknown>)
|
|
450
|
-
: (value as Record<string, unknown>);
|
|
451
|
-
const cls = _classForHash(hash) ?? fallbackClass;
|
|
452
|
-
if (!cls) return null;
|
|
453
|
-
const Ctor = cls as unknown as new (data: unknown) => AbstractHyperedge;
|
|
454
|
-
return new Ctor(hash);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
function _classForHash(hash: unknown): HyperedgeClass | null {
|
|
458
|
-
if (!hash || typeof hash !== 'object') return null;
|
|
459
|
-
const type = (hash as { type?: unknown }).type;
|
|
460
|
-
if (typeof type !== 'string') return null;
|
|
461
|
-
return HyperedgeRegistry.forTypeTag(type);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
function _migrateV1Hash(
|
|
465
|
-
cls: HyperedgeClass,
|
|
466
|
-
v1Key: string,
|
|
467
|
-
hash: Record<string, unknown>,
|
|
468
|
-
): Record<string, unknown> | null {
|
|
469
|
-
if (cls === PartitiveHyperedge && v1Key === 'partitive_hyperedges') {
|
|
470
|
-
return migrateHyperedgeToRelation(hash) as unknown as Record<string, unknown>;
|
|
471
|
-
}
|
|
472
|
-
return null;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
function _camelCase(s: string): string {
|
|
476
|
-
if (typeof s !== 'string' || !s.includes('_')) return s;
|
|
477
|
-
return s.replace(/_([a-z])/g, (_, c: string) => c.toUpperCase());
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
function _normalizeDomains(
|
|
481
|
-
domains: ReadonlyArray<ConceptReferenceJson | ConceptReference> | null | undefined,
|
|
482
|
-
groups: ReadonlyArray<unknown> | null | undefined,
|
|
483
|
-
): ReadonlyArray<ConceptReference> {
|
|
484
|
-
if (domains) {
|
|
485
|
-
return domains.map((d) =>
|
|
486
|
-
d instanceof ConceptReference
|
|
487
|
-
? d
|
|
488
|
-
: new ConceptReference(d as ConceptReferenceJson),
|
|
489
|
-
);
|
|
490
|
-
}
|
|
491
|
-
if (groups) {
|
|
492
|
-
return groups.map((g) =>
|
|
493
|
-
typeof g === 'string'
|
|
494
|
-
? ConceptReference.domain(g)
|
|
495
|
-
: new ConceptReference(g as ConceptReferenceJson),
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
return [];
|
|
499
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// Per-dataset color spec, light/dark variants.
|
|
2
|
-
//
|
|
3
|
-
// A DatasetColor may be:
|
|
4
|
-
// - a single hex string (legacy, applied to both modes)
|
|
5
|
-
// - an explicit { light, dark } pair
|
|
6
|
-
//
|
|
7
|
-
// Round-trips through Register.toJSON unchanged so the data lives in
|
|
8
|
-
// the GCR package. Consumers call resolveColor(mode) to pick the
|
|
9
|
-
// right hex for the current UI mode.
|
|
10
|
-
|
|
11
|
-
export type ColorMode = 'light' | 'dark';
|
|
12
|
-
|
|
13
|
-
export type DatasetColorSpec = string;
|
|
14
|
-
|
|
15
|
-
export interface DatasetColorPair {
|
|
16
|
-
light?: string;
|
|
17
|
-
dark?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type DatasetColor = DatasetColorSpec | DatasetColorPair;
|
|
21
|
-
|
|
22
|
-
export const COLOR_MODES: ReadonlyArray<ColorMode> = Object.freeze([
|
|
23
|
-
'light',
|
|
24
|
-
'dark',
|
|
25
|
-
]);
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Returns the right hex for the given mode. Falls back to the single
|
|
29
|
-
* hex when the spec is a string. Returns null when the spec is null
|
|
30
|
-
* or when the requested mode is missing from a pair.
|
|
31
|
-
*/
|
|
32
|
-
export function resolveColor(
|
|
33
|
-
color: DatasetColor | null | undefined,
|
|
34
|
-
mode: ColorMode,
|
|
35
|
-
): string | null {
|
|
36
|
-
if (color == null) return null;
|
|
37
|
-
if (typeof color === 'string') return color;
|
|
38
|
-
if (typeof color === 'object') {
|
|
39
|
-
if (!mode) return color.light ?? color.dark ?? null;
|
|
40
|
-
return color[mode] ?? null;
|
|
41
|
-
}
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* True when the spec declares an explicit {light, dark} object.
|
|
47
|
-
*/
|
|
48
|
-
export function isColorPair(
|
|
49
|
-
color: DatasetColor | null | undefined,
|
|
50
|
-
): color is DatasetColorPair {
|
|
51
|
-
return color != null && typeof color === 'object';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Validates a color spec. A valid spec is either:
|
|
56
|
-
* - a string matching /^#[0-9a-fA-F]{3,8}$/
|
|
57
|
-
* - an object with `light` and `dark` string fields, each matching
|
|
58
|
-
* the same pattern
|
|
59
|
-
*
|
|
60
|
-
* Returns null when valid, or an error message describing the issue.
|
|
61
|
-
*/
|
|
62
|
-
export function validateColor(
|
|
63
|
-
color: DatasetColor | null | undefined,
|
|
64
|
-
): string | null {
|
|
65
|
-
if (color == null) return null;
|
|
66
|
-
if (typeof color === 'string') return hexError(color);
|
|
67
|
-
if (typeof color === 'object') {
|
|
68
|
-
if (color.light == null && color.dark == null) {
|
|
69
|
-
return 'color pair must have at least one of `light` or `dark`';
|
|
70
|
-
}
|
|
71
|
-
if (color.light != null) {
|
|
72
|
-
const e = hexError(color.light);
|
|
73
|
-
if (e) return `color.light: ${e}`;
|
|
74
|
-
}
|
|
75
|
-
if (color.dark != null) {
|
|
76
|
-
const e = hexError(color.dark);
|
|
77
|
-
if (e) return `color.dark: ${e}`;
|
|
78
|
-
}
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
return `unexpected color type ${typeof color}`;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const HEX_RE = /^#[0-9a-fA-F]{3,8}$/;
|
|
85
|
-
function hexError(s: unknown): string | null {
|
|
86
|
-
if (typeof s !== 'string') return `expected string, got ${typeof s}`;
|
|
87
|
-
return HEX_RE.test(s) ? null : `not a valid hex color: ${JSON.stringify(s)}`;
|
|
88
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { GlossaristModel } from './base.js';
|
|
2
|
-
|
|
3
|
-
export const DESIGNATION_RELATIONSHIP_TYPES: ReadonlyArray<string> = Object.freeze([
|
|
4
|
-
// TBX (ISO 30042) / ISO 12620 term-level relationships
|
|
5
|
-
'abbreviated_form_for', 'short_form_for',
|
|
6
|
-
]);
|
|
7
|
-
|
|
8
|
-
export type DesignationRelationshipType = string;
|
|
9
|
-
|
|
10
|
-
export interface DesignationRelationshipJson {
|
|
11
|
-
type?: DesignationRelationshipType | null;
|
|
12
|
-
content?: string | null;
|
|
13
|
-
target?: string | null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export class DesignationRelationship extends GlossaristModel {
|
|
17
|
-
readonly type: DesignationRelationshipType | null;
|
|
18
|
-
readonly content: string | null;
|
|
19
|
-
readonly target: string | null;
|
|
20
|
-
|
|
21
|
-
constructor(data: DesignationRelationshipJson = {}) {
|
|
22
|
-
super();
|
|
23
|
-
this.type = data.type ?? null;
|
|
24
|
-
this.content = data.content ?? null;
|
|
25
|
-
this.target = data.target ?? null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
override toJSON(): DesignationRelationshipJson {
|
|
29
|
-
const obj: DesignationRelationshipJson = {};
|
|
30
|
-
if (this.type != null) obj.type = this.type;
|
|
31
|
-
if (this.content != null) obj.content = this.content;
|
|
32
|
-
if (this.target != null) obj.target = this.target;
|
|
33
|
-
return obj;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
static override fromJSON(data: DesignationRelationshipJson): DesignationRelationship {
|
|
37
|
-
return new DesignationRelationship(data);
|
|
38
|
-
}
|
|
39
|
-
}
|