@glossarist/concept-browser 0.7.87 → 0.7.89
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/package.json +1 -1
- package/scripts/__tests__/bibliography.test.mjs +29 -0
- package/scripts/generate-data.mjs +4 -2
- package/scripts/lib/bibliography.mjs +18 -0
- package/src/__tests__/cross-repo-multiplicity-contract.test.ts +84 -0
- package/src/__tests__/model-bridge-partitive-migration.test.ts +153 -0
- package/src/__tests__/uri-router.test.ts +29 -0
- package/src/__tests__/wire-keys.test.ts +65 -0
- package/src/adapters/GraphDataSource.ts +1 -1
- package/src/adapters/UriRouter.ts +7 -3
- package/src/adapters/concept-identity.ts +6 -2
- package/src/adapters/model-bridge/jsonld-types.ts +169 -0
- package/src/adapters/model-bridge.ts +172 -297
- package/src/adapters/non-verbal/glossarist-augment.d.ts +8 -17
- package/src/adapters/wire-keys.ts +154 -0
- package/vite.config.ts +4 -1
|
@@ -224,6 +224,12 @@ declare module 'glossarist' {
|
|
|
224
224
|
// Re-declare the same exports under the 'glossarist/models' subpath so
|
|
225
225
|
// deep-import callers can use them. Upstream's d.ts is stale on this
|
|
226
226
|
// subpath too.
|
|
227
|
+
//
|
|
228
|
+
// The duplication between the 'glossarist' block above and this block
|
|
229
|
+
// is forced by upstream's broken d.ts (PR glossarist/glossarist-js#31).
|
|
230
|
+
// We cannot `export import` from a local namespace because TypeScript
|
|
231
|
+
// requires `declare module` blocks to be self-contained. When upstream
|
|
232
|
+
// ships proper d.ts, DELETE this entire file.
|
|
227
233
|
declare module 'glossarist/models' {
|
|
228
234
|
export type Completeness = 'complete' | 'partial';
|
|
229
235
|
export const COMPLETENESS: { readonly COMPLETE: 'complete'; readonly PARTIAL: 'partial' };
|
|
@@ -252,23 +258,8 @@ declare module 'glossarist/models' {
|
|
|
252
258
|
export function isValidMultiplicity(value: unknown): value is Multiplicity;
|
|
253
259
|
export function multiplicityFromPair(presence: PartitivePresence, count: PartitiveCount): Multiplicity;
|
|
254
260
|
export function pairFromMultiplicity(name: Multiplicity): { presence: PartitivePresence; count: PartitiveCount };
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
constructor(data?: {
|
|
258
|
-
isShared?: boolean;
|
|
259
|
-
is_shared?: boolean;
|
|
260
|
-
isUncertain?: boolean;
|
|
261
|
-
is_uncertain?: boolean;
|
|
262
|
-
sharedType?: ConceptRef;
|
|
263
|
-
shared_type?: ConceptRef;
|
|
264
|
-
});
|
|
265
|
-
readonly isShared: boolean;
|
|
266
|
-
readonly isUncertain: boolean;
|
|
267
|
-
readonly sharedType: ConceptRef | null;
|
|
268
|
-
hasSharedType(): boolean;
|
|
269
|
-
toJSON(): { is_shared: boolean; is_uncertain?: boolean; shared_type?: ReturnType<ConceptRef['toJSON']> };
|
|
270
|
-
static fromJSON(data: Record<string, unknown>): TypeSharedPlurality;
|
|
271
|
-
}
|
|
261
|
+
// (TypeSharedPlurality removed — superseded by presence/count on
|
|
262
|
+
// PartitiveMember per MECE refactor. Was dead code.)
|
|
272
263
|
|
|
273
264
|
// ── PartitiveRelation (glossarist 0.4.26 — MECE presence × count) ─
|
|
274
265
|
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire-format keys for the JSON-LD bridge.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the `'gl:*'` and `'@*'` string keys used
|
|
5
|
+
* across `src/adapters/model-bridge*.ts` to read the JSON-LD wire
|
|
6
|
+
* format produced by `scripts/generate-data.mjs`.
|
|
7
|
+
*
|
|
8
|
+
* Why this exists:
|
|
9
|
+
* - Replaces ~230 inline string literals that were spread across
|
|
10
|
+
* adapter files. Typos like `'gl:presnce'` were undetectable at
|
|
11
|
+
* compile time.
|
|
12
|
+
* - When glossarist-js's JSON-LD context adds/renames a field, the
|
|
13
|
+
* change is one entry here, not a grep-and-replace exercise.
|
|
14
|
+
*
|
|
15
|
+
* The interface declarations in `model-bridge/jsonld-types.ts` still
|
|
16
|
+
* use string literals — TypeScript interface keys cannot reference
|
|
17
|
+
* a `const`. The literals there MUST agree with the constants here;
|
|
18
|
+
* the `WireKeys` type at the bottom of this file constrains them to
|
|
19
|
+
* the same set.
|
|
20
|
+
*
|
|
21
|
+
* Adding a new wire field:
|
|
22
|
+
* 1. Add the key constant here.
|
|
23
|
+
* 2. Add the interface field in `jsonld-types.ts`.
|
|
24
|
+
* 3. Add the mapper logic in `model-bridge.ts`.
|
|
25
|
+
*
|
|
26
|
+
* (3 steps for new fields instead of touching 5+ files.)
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export const GL = {
|
|
30
|
+
// JSON-LD core
|
|
31
|
+
ID: '@id',
|
|
32
|
+
TYPE: '@type',
|
|
33
|
+
|
|
34
|
+
// Concept-level
|
|
35
|
+
IDENTIFIER: 'gl:identifier',
|
|
36
|
+
TERM: 'gl:term',
|
|
37
|
+
LOCALIZED_CONCEPT: 'gl:localizedConcept',
|
|
38
|
+
RELATED: 'gl:related',
|
|
39
|
+
PARTITIVE_RELATIONS: 'gl:partitiveRelations',
|
|
40
|
+
TAGS: 'gl:tags',
|
|
41
|
+
|
|
42
|
+
// LocalizedConcept
|
|
43
|
+
LANGUAGE_CODE: 'gl:languageCode',
|
|
44
|
+
ENTRY_STATUS: 'gl:entryStatus',
|
|
45
|
+
CLASSIFICATION: 'gl:classification',
|
|
46
|
+
REVIEW_TYPE: 'gl:reviewType',
|
|
47
|
+
DOMAIN: 'gl:domain',
|
|
48
|
+
RELEASE: 'gl:release',
|
|
49
|
+
LINEAGE_SOURCE_SIMILARITY: 'gl:lineageSourceSimilarity',
|
|
50
|
+
SCRIPT: 'gl:script',
|
|
51
|
+
SYSTEM: 'gl:system',
|
|
52
|
+
DESIGNATION: 'gl:designation',
|
|
53
|
+
DEFINITION: 'gl:definition',
|
|
54
|
+
NOTES: 'gl:notes',
|
|
55
|
+
ANNOTATIONS: 'gl:annotations',
|
|
56
|
+
EXAMPLES: 'gl:examples',
|
|
57
|
+
SOURCE: 'gl:source',
|
|
58
|
+
DATES: 'gl:dates',
|
|
59
|
+
REFERENCES: 'gl:references',
|
|
60
|
+
|
|
61
|
+
// Review fields
|
|
62
|
+
REVIEW_DATE: 'gl:reviewDate',
|
|
63
|
+
REVIEW_DECISION_DATE: 'gl:reviewDecisionDate',
|
|
64
|
+
REVIEW_DECISION_EVENT: 'gl:reviewDecisionEvent',
|
|
65
|
+
REVIEW_STATUS: 'gl:reviewStatus',
|
|
66
|
+
REVIEW_DECISION: 'gl:reviewDecision',
|
|
67
|
+
REVIEW_DECISION_NOTES: 'gl:reviewDecisionNotes',
|
|
68
|
+
|
|
69
|
+
// Designation
|
|
70
|
+
NORMATIVE_STATUS: 'gl:normativeStatus',
|
|
71
|
+
ABSENT: 'gl:absent',
|
|
72
|
+
FIELD_OF_APPLICATION: 'gl:fieldOfApplication',
|
|
73
|
+
USAGE_INFO: 'gl:usageInfo',
|
|
74
|
+
GEOGRAPHICAL_AREA: 'gl:geographicalArea',
|
|
75
|
+
LANGUAGE: 'gl:language',
|
|
76
|
+
INTERNATIONAL: 'gl:international',
|
|
77
|
+
TERM_TYPE: 'gl:termType',
|
|
78
|
+
PRONUNCIATION: 'gl:pronunciation',
|
|
79
|
+
PREFIX: 'gl:prefix',
|
|
80
|
+
GENDER: 'gl:gender',
|
|
81
|
+
GRAMMAR_INFO: 'gl:grammarInfo',
|
|
82
|
+
|
|
83
|
+
// GrammarInfo
|
|
84
|
+
NUMBER: 'gl:number',
|
|
85
|
+
PART_OF_SPEECH: 'gl:partOfSpeech',
|
|
86
|
+
NOUN: 'gl:noun',
|
|
87
|
+
VERB: 'gl:verb',
|
|
88
|
+
ADJ: 'gl:adj',
|
|
89
|
+
ADVERB: 'gl:adverb',
|
|
90
|
+
PREPOSITION: 'gl:preposition',
|
|
91
|
+
PARTICIPLE: 'gl:participle',
|
|
92
|
+
|
|
93
|
+
// Pronunciation
|
|
94
|
+
COUNTRY: 'gl:country',
|
|
95
|
+
|
|
96
|
+
// Content (definition, notes, examples, annotations)
|
|
97
|
+
CONTENT: 'gl:content',
|
|
98
|
+
|
|
99
|
+
// Date
|
|
100
|
+
DATE: 'gl:date',
|
|
101
|
+
DATE_TYPE: 'gl:dateType',
|
|
102
|
+
|
|
103
|
+
// ConceptRef / Citation.Origin
|
|
104
|
+
REF: 'gl:ref',
|
|
105
|
+
LOCALITY: 'gl:locality',
|
|
106
|
+
LINK: 'gl:link',
|
|
107
|
+
VERSION: 'gl:version',
|
|
108
|
+
TEXT: 'gl:text',
|
|
109
|
+
|
|
110
|
+
// Locally-scoped id within source/origin/ref (NOT JSON-LD's @id)
|
|
111
|
+
LOCAL_ID: 'gl:id',
|
|
112
|
+
|
|
113
|
+
// Locality
|
|
114
|
+
LOCALITY_TYPE: 'gl:localityType',
|
|
115
|
+
REFERENCE_FROM: 'gl:referenceFrom',
|
|
116
|
+
REFERENCE_TO: 'gl:referenceTo',
|
|
117
|
+
|
|
118
|
+
// ConceptSource
|
|
119
|
+
SOURCE_TYPE: 'gl:sourceType',
|
|
120
|
+
SOURCE_STATUS: 'gl:sourceStatus',
|
|
121
|
+
MODIFICATION: 'gl:modification',
|
|
122
|
+
ORIGIN: 'gl:origin',
|
|
123
|
+
SOURCED_FROM: 'gl:sourcedFrom',
|
|
124
|
+
SOURCED_FROM_ALT: 'gl:sourced_from',
|
|
125
|
+
|
|
126
|
+
// RelatedConcept
|
|
127
|
+
RELATIONSHIP_TYPE: 'gl:relationshipType',
|
|
128
|
+
TARGET: 'gl:target',
|
|
129
|
+
SOURCE_ID: 'gl:sourceId',
|
|
130
|
+
CITATION: 'gl:citation',
|
|
131
|
+
|
|
132
|
+
// PartitiveMember (MECE)
|
|
133
|
+
PRESENCE: 'gl:presence',
|
|
134
|
+
COUNT: 'gl:count',
|
|
135
|
+
IS_DELIMITING: 'gl:isDelimiting',
|
|
136
|
+
MULTIPLICITY: 'gl:multiplicity',
|
|
137
|
+
CERTAINTY: 'gl:certainty',
|
|
138
|
+
|
|
139
|
+
// PartitiveRelation
|
|
140
|
+
COMPREHENSIVE: 'gl:comprehensive',
|
|
141
|
+
HAS_PARTITIVE: 'gl:hasPartitive',
|
|
142
|
+
COMPLETENESS: 'gl:completeness',
|
|
143
|
+
CRITERION: 'gl:criterion',
|
|
144
|
+
|
|
145
|
+
// Non-verbal entity references at concept level
|
|
146
|
+
FIGURE_REF: 'gl:figureRef',
|
|
147
|
+
TABLE_REF: 'gl:tableRef',
|
|
148
|
+
FORMULA_REF: 'gl:formulaRef',
|
|
149
|
+
|
|
150
|
+
// NonVerbalReference display string
|
|
151
|
+
DISPLAY: 'gl:display',
|
|
152
|
+
} as const;
|
|
153
|
+
|
|
154
|
+
export type WireKey = typeof GL[keyof typeof GL];
|
package/vite.config.ts
CHANGED