glossarist 0.4.46 → 0.4.48

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.
Files changed (43) hide show
  1. package/package.json +1 -1
  2. package/src/compiled-format.ts +0 -1
  3. package/src/concept-diff.ts +0 -1
  4. package/src/dataset-asset.ts +0 -1
  5. package/src/diff/collection-diff.ts +2 -2
  6. package/src/diff/concept-diff.ts +6 -6
  7. package/src/diff/diff-patch.ts +1 -1
  8. package/src/diff/diff-renderer.ts +1 -1
  9. package/src/diff/index.ts +0 -1
  10. package/src/entity-directory.ts +0 -1
  11. package/src/index.ts +0 -1
  12. package/src/rdf/agents-emitter.ts +1 -1
  13. package/src/rdf/bibliography-emitter.ts +1 -1
  14. package/src/rdf/build-activity-emitter.ts +1 -2
  15. package/src/rdf/curie.ts +1 -0
  16. package/src/rdf/dataset-emitter.ts +1 -2
  17. package/src/rdf/document-writer.ts +1 -1
  18. package/src/rdf/gloss-detailed-definition.ts +0 -1
  19. package/src/rdf/gloss-generic-hyperedge.ts +0 -1
  20. package/src/rdf/gloss-localized-concept.ts +0 -1
  21. package/src/rdf/gloss-partitive-member.ts +0 -1
  22. package/src/rdf/gloss-partitive-relation.ts +0 -1
  23. package/src/rdf/gloss-source.ts +0 -1
  24. package/src/rdf/group-emitter.ts +1 -2
  25. package/src/rdf/image-variant-emitter.ts +1 -2
  26. package/src/rdf/index.ts +0 -1
  27. package/src/rdf/prefixes.ts +6 -2
  28. package/src/rdf/provenance-emitter.ts +1 -2
  29. package/src/rdf/sections-builder.ts +1 -1
  30. package/src/rdf/shacl-entry.ts +0 -1
  31. package/src/rdf/version-emitter.ts +1 -2
  32. package/src/rdf/vocabulary-emitter.ts +1 -2
  33. package/src/reference-mention.ts +0 -1
  34. package/src/validators/binary-has-part-redundancy-rule.ts +0 -1
  35. package/src/validators/delimiting-coherence-rule.ts +0 -1
  36. package/src/validators/external-concept-shape-rule.ts +0 -1
  37. package/src/validators/hyperedge-coherence-rule.ts +0 -1
  38. package/src/validators/index.ts +0 -1
  39. package/src/validators/partitive-relation-coherence-rule.ts +0 -1
  40. package/src/validators/ref-keys.ts +0 -1
  41. package/src/validators/register-validator.ts +0 -1
  42. package/src/validators/relationship-type-rule.ts +0 -1
  43. package/src/validators/sourced-from-locality-rule.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glossarist",
3
- "version": "0.4.46",
3
+ "version": "0.4.48",
4
4
  "description": "JavaScript SDK for Glossarist GCR packages — read, write, validate, and manage terminology concepts",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  /**
3
2
  * Registry of compiled/machine formats that can be bundled inside a GCR package.
4
3
  *
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  /**
3
2
  * @deprecated Import from `glossarist/diff` (i.e. `src/diff/index.js`)
4
3
  * instead. This file is a backwards-compatibility shim left over from
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  /**
3
2
  * Registry of dataset assets that can be bundled inside a GCR package.
4
3
  *
@@ -1,11 +1,11 @@
1
- // @ts-nocheck — TEMPORARY bridge during TS migration. TODO(Phase 2e): remove this directive and type all parameters.
1
+ // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
2
  import { GlossaristModel } from '../models/base.js';
3
3
  import { Added, Removed, Matched, deserializeChange } from './change.js';
4
4
  import { ConceptDiff, DiffStats, diffConcepts } from './concept-diff.js';
5
5
  import { averageSimilarity } from './similarity.js';
6
6
 
7
7
  export class ConceptCollectionDiff extends GlossaristModel {
8
- constructor(data = {}) {
8
+ constructor(data: Record<string, unknown> = {}) {
9
9
  super();
10
10
  this.oldCount = data.oldCount ?? data.old_count ?? 0;
11
11
  this.newCount = data.newCount ?? data.new_count ?? 0;
@@ -1,4 +1,4 @@
1
- // @ts-nocheck — TEMPORARY bridge during TS migration. TODO(Phase 2e): remove this directive and type all parameters.
1
+ // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
2
  import { GlossaristModel } from '../models/base.js';
3
3
  import { PartitiveHyperedge } from '../models/partitive-hyperedge.js';
4
4
  import { GenericHyperedge } from '../models/generic-hyperedge.js';
@@ -33,7 +33,7 @@ const LOCALIZATION_METADATA_FIELDS = Object.freeze([
33
33
  // (See file-top comment about why they're duplicated rather than imported.)
34
34
 
35
35
  export class DiffStats extends GlossaristModel {
36
- constructor(data = {}) {
36
+ constructor(data: Record<string, unknown> = {}) {
37
37
  super();
38
38
  this._added = data.added ?? 0;
39
39
  this._removed = data.removed ?? 0;
@@ -55,7 +55,7 @@ export class DiffStats extends GlossaristModel {
55
55
  }
56
56
 
57
57
  export class MetadataDiff extends GlossaristModel {
58
- constructor(data = {}) {
58
+ constructor(data: Record<string, unknown> = {}) {
59
59
  super();
60
60
  this._changes = {};
61
61
  const raw = data.changes ?? data ?? {};
@@ -97,7 +97,7 @@ export class MetadataDiff extends GlossaristModel {
97
97
  }
98
98
 
99
99
  export class ConceptLevelDiff extends GlossaristModel {
100
- constructor(data = {}) {
100
+ constructor(data: Record<string, unknown> = {}) {
101
101
  super();
102
102
  this._sources = wrapListDiff(data.sources);
103
103
  this._dates = wrapListDiff(data.dates);
@@ -193,7 +193,7 @@ export class ConceptLevelDiff extends GlossaristModel {
193
193
  }
194
194
 
195
195
  export class LocalizedConceptDiff extends GlossaristModel {
196
- constructor(data = {}) {
196
+ constructor(data: Record<string, unknown> = {}) {
197
197
  super();
198
198
  this.languageCode = data.languageCode ?? data.language_code ?? null;
199
199
  this._designations = wrapListDiff(data.designations);
@@ -279,7 +279,7 @@ export class LocalizedConceptDiff extends GlossaristModel {
279
279
  }
280
280
 
281
281
  export class ConceptDiff extends GlossaristModel {
282
- constructor(data = {}) {
282
+ constructor(data: Record<string, unknown> = {}) {
283
283
  super();
284
284
  this._oldId = data.oldId ?? data.old_id ?? null;
285
285
  this._newId = data.newId ?? data.new_id ?? null;
@@ -1,4 +1,4 @@
1
- // @ts-nocheck — TEMPORARY bridge during TS migration. TODO(Phase 2e): remove this directive and type all parameters.
1
+ // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
2
  import { Concept } from '../models/concept.js';
3
3
  import { ConceptSource } from '../models/concept-source.js';
4
4
  import { ConceptDate } from '../models/concept-date.js';
@@ -1,4 +1,4 @@
1
- // @ts-nocheck — TEMPORARY bridge during TS migration. TODO(Phase 2e): remove this directive and type all parameters.
1
+ // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
2
  import { TextDiff } from './text-diff.js';
3
3
  import { resolveMultiplicity } from '../models/multiplicity.js';
4
4
 
package/src/diff/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY bridge during TS migration. TODO(Phase 2e): remove this directive and type all parameters.
2
1
  export {
3
2
  TextHunk,
4
3
  TextDiff,
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  const ENTITY_DIRECTORIES = Object.freeze(new Map([
3
2
  ['figure', 'figures'],
4
3
  ['table', 'tables'],
package/src/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  export { naturalSort } from './sort.js';
3
2
  export {
4
3
  diffConcepts,
@@ -8,7 +8,7 @@
8
8
  // prov:Organization, and the person is linked via prov:actedOnBehalfOf.
9
9
 
10
10
  import { namedNode, literal, quad } from './terms.js';
11
- import { PREFIXES } from './predicates.js';
11
+ import { PREFIXES } from './prefixes.js';
12
12
  import { RDF_TYPE } from './curie.js';
13
13
 
14
14
  const PROV_NS = PREFIXES.prov;
@@ -11,7 +11,7 @@
11
11
  // - dcterms:isPartOf (parent dataset)
12
12
 
13
13
  import { namedNode, literal, quad } from './terms.js';
14
- import { PREFIXES } from './predicates.js';
14
+ import { PREFIXES } from './prefixes.js';
15
15
  import { RDF_TYPE } from './curie.js';
16
16
 
17
17
  // Namespace IRIs from canonical PREFIXES. foaf is absent from the
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Build activity emitter — emits prov:Activity per build run.
3
2
  // Mirrors concept-browser's build-activity-emitter.ts.
4
3
  //
@@ -10,7 +9,7 @@
10
9
  // - prov:wasAssociatedWith for the CI bot agent
11
10
 
12
11
  import { namedNode, literal, quad } from './terms.js';
13
- import { PREFIXES } from './predicates.js';
12
+ import { PREFIXES } from './prefixes.js';
14
13
  import { RDF_TYPE } from './curie.js';
15
14
 
16
15
  const PROV_NS = PREFIXES.prov;
package/src/rdf/curie.ts CHANGED
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
1
2
  // CURIE helpers — resolve/compact IRIs against the canonical PREFIXES.
2
3
  //
3
4
  // Single source of truth for CURIE ↔ IRI conversion. Previously
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Dataset emitter — emits dcat:Dataset + skos:ConceptScheme per
3
2
  // register. Mirrors concept-browser's dataset-emitter.ts.
4
3
  //
@@ -12,7 +11,7 @@
12
11
  // for cascading section membership).
13
12
 
14
13
  import { namedNode, blankNode, literal, quad } from './terms.js';
15
- import { PREFIXES } from './predicates.js';
14
+ import { PREFIXES } from './prefixes.js';
16
15
  import { RDF_TYPE } from './curie.js';
17
16
  import { deterministicBnodeId } from './bnode-id.js';
18
17
 
@@ -6,7 +6,7 @@
6
6
  // as a stable fallback that doesn't depend on prefix maps.
7
7
  import { Writer as N3Writer } from 'n3';
8
8
  import jsonld from 'jsonld';
9
- import { PREFIXES } from './predicates.js';
9
+ import { PREFIXES } from './prefixes.js';
10
10
 
11
11
  // Collects all quads yielded by an emitter into an array. Useful for tests
12
12
  // and for callers that want to inspect the quad stream directly.
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // DetailedDefinition → RDF quads. Mirrors glossarist-ruby's
3
2
  // `Rdf::GlossDetailedDefinition`. Used for definitions, notes, examples,
4
3
  // and annotations — they all share the same shape (content + optional
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // GenericHyperedge → RDF quads.
3
2
  //
4
3
  // Shape (mirrors gloss-partitive-relation.js, swapping partitive
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // LocalizedConcept → RDF quads. Mirrors glossarist-ruby's
3
2
  // `Rdf::GlossLocalizedConcept` + the `EmitsExtraTriples` hook.
4
3
  //
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // PartitiveMember → RDF quads.
3
2
  //
4
3
  // Emits per-member predicates (presence, count, is_delimiting,
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // PartitiveHyperedge → RDF quads.
3
2
  //
4
3
  // Shape (per concept-model ontology, v3.2.0):
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // ConceptSource → RDF quads. Mirrors glossarist-ruby's
3
2
  // `Rdf::GlossConceptSource` + `Rdf::GlossCitation`. Sources are reified
4
3
  // resources linked from their parent (concept or localized concept or
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Group emitter — emits dcat:DatasetSeries (lineage) or dcat:Catalog
3
2
  // (topic/family/collection) for dataset groups. Mirrors concept-browser's
4
3
  // group-emitter.ts.
@@ -13,7 +12,7 @@
13
12
  // Both kinds are also typed as skos:ConceptScheme for SKOS interop.
14
13
 
15
14
  import { namedNode, literal, quad } from './terms.js';
16
- import { PREFIXES } from './predicates.js';
15
+ import { PREFIXES } from './prefixes.js';
17
16
  import { RDF_TYPE } from './curie.js';
18
17
 
19
18
  // Namespace IRIs from canonical PREFIXES.
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Image variant emitter — emits foaf:Image per format/language variant
3
2
  // of a dataset figure. Mirrors concept-browser's image-variant-emitter.ts.
4
3
  //
@@ -9,7 +8,7 @@
9
8
  // - dcat:downloadURL (canonical download)
10
9
 
11
10
  import { namedNode, literal, quad } from './terms.js';
12
- import { PREFIXES } from './predicates.js';
11
+ import { PREFIXES } from './prefixes.js';
13
12
  import { RDF_TYPE } from './curie.js';
14
13
 
15
14
  const FOAF_NS = PREFIXES.foaf ?? 'http://xmlns.com/foaf/0.1/';
package/src/rdf/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Public RDF layer. Mirrors lib/glossarist/rdf/ in glossarist-ruby.
3
2
  export { PRED, PREFIXES, SKOSXL, WELL_KNOWN } from './prefixes.js';
4
3
  export {
@@ -6,9 +6,13 @@
6
6
  // constants (`rdf:type`, `skos:Concept`) because JSON-LD handles them via
7
7
  // the `@type` keyword. We construct those from the namespace URIs here so
8
8
  // downstream emitters don't have to repeat the construction.
9
- import { PRED, PREFIXES } from './predicates.js';
9
+ import { PRED, PREFIXES as _PREFIXES } from './predicates.js';
10
10
 
11
- export { PRED, PREFIXES };
11
+ // Widen the type so emitters can access keys not in the JSON-LD context
12
+ // (foaf, dcat) via `PREFIXES.foaf ?? 'fallback'`. The runtime values
13
+ // are the same; the type just permits unknown-key access.
14
+ export const PREFIXES: Record<string, string> = _PREFIXES as Record<string, string>;
15
+ export { PRED };
12
16
 
13
17
  // SKOS-XL label predicates — same local name as SKOS, so we construct them
14
18
  // from the SKOS-XL namespace URI.
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Provenance emitter — emits prov:wasGeneratedBy + prov:Activity quads
3
2
  // for any resource that needs build/view-time provenance.
4
3
  //
@@ -7,7 +6,7 @@
7
6
  // on standard RDF/JS Quad[] (no RdfGraph abstraction).
8
7
 
9
8
  import { namedNode, blankNode, literal, quad } from './terms.js';
10
- import { PREFIXES } from './predicates.js';
9
+ import { PREFIXES } from './prefixes.js';
11
10
  import { RDF_TYPE, RDFS_LABEL } from './curie.js';
12
11
  import { deterministicBnodeId } from './bnode-id.js';
13
12
 
@@ -20,7 +20,7 @@
20
20
  // use it.
21
21
 
22
22
  import { RDF_TYPE, RDFS_LABEL, compactIri } from './curie.js';
23
- import { PREFIXES } from './predicates.js';
23
+ import { PREFIXES } from './prefixes.js';
24
24
 
25
25
  const SKOS_PREF_LABEL = `${PREFIXES.skos}prefLabel`;
26
26
 
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Node-only SHACL validator entry. Separated from glossarist/rdf so that
3
2
  // browser bundles can import RDF emitters/writers without pulling in
4
3
  // node:fs/promises, node:path, node:url.
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Version emitter — emits prov:Entity version chain per dataset.
3
2
  // Mirrors concept-browser's version-emitter.ts.
4
3
  //
@@ -10,7 +9,7 @@
10
9
  // - prov:wasAssociatedWith (optional agent)
11
10
 
12
11
  import { namedNode, literal, quad } from './terms.js';
13
- import { PREFIXES } from './predicates.js';
12
+ import { PREFIXES } from './prefixes.js';
14
13
  import { RDF_TYPE } from './curie.js';
15
14
 
16
15
  const PROV_NS = PREFIXES.prov;
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Vocabulary graph emitter — emits SKOS ConceptSchemes for the
3
2
  // enumeration IRIs that glossarist emits in instance data
4
3
  // (gloss:status/*, gloss:entstatus/*, gloss:norm/*, gloss:srcstatus/*,
@@ -14,7 +13,7 @@
14
13
  // PREFIXES.
15
14
 
16
15
  import { namedNode, literal, quad } from './terms.js';
17
- import { PREFIXES } from './predicates.js';
16
+ import { PREFIXES } from './prefixes.js';
18
17
  import { resolveIri, RDF_TYPE, RDFS_LABEL } from './curie.js';
19
18
 
20
19
  const SKOS_NS = PREFIXES.skos;
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  /**
3
2
  * Mention parser for {{...}} inline references in concept text.
4
3
  *
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Warns when binary `has_part` / `is_part_of` edges duplicate
3
2
  // PartitiveHyperedge members, or when a concept has many binary
4
3
  // has_part edges that should be consolidated into a PartitiveHyperedge.
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Validates delimiting coherence across a concept's PartitiveRelations
3
2
  // per ISO 704:2022.
4
3
  //
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Validates ExternalConcept shape (status: external).
3
2
  //
4
3
  // Per TODO.partitive-relation-v2 item 06, an ExternalConcept is a
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Validates hyperedge coherence per ISO 704 / ISO 12620.
3
2
  //
4
3
  // Applies to every AbstractHyperedge subclass (PartitiveHyperedge,
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  export { ValidationError } from './validation-error.js';
3
2
  export { ValidationRule } from './validation-rule.js';
4
3
  export { ValidationResult } from './validation-result.js';
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Deprecated. This rule has been generalized and renamed to
3
2
  // HyperedgeCoherenceRule (see ./hyperedge-coherence-rule.js). The
4
3
  // new rule is type-blind — it validates every AbstractHyperedge
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Shared identity-key helpers for cross-relation validators.
3
2
  //
4
3
  // Extracted from HyperedgeCoherenceRule and
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  import { ValidationResult } from './validation-result.js';
3
2
 
4
3
  export class RegisterValidator {
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  import { ValidationRule } from './validation-rule.js';
3
2
  import { RELATIONSHIP_TYPES } from '../models/related-concept.js';
4
3
  import { DESIGNATION_RELATIONSHIP_TYPES } from '../models/designation-relationship.js';
@@ -1,4 +1,3 @@
1
- // @ts-nocheck — TEMPORARY during TS migration. TODO(Phase 2e): remove and type fully.
2
1
  // Validates that every ConceptSource#sourced_from Citation includes a
3
2
  // locality. Per concept-model commit 9c065df ("sourced_from citations
4
3
  // must include locality"), a sourced_from entry without a locality is