@primmel/primmel 1.8.2 → 1.9.0
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/dist/src/check-rules.d.ts.map +1 -1
- package/dist/src/check-rules.js +55 -0
- package/dist/src/check-rules.js.map +1 -1
- package/dist/src/check.d.ts +74 -2
- package/dist/src/check.d.ts.map +1 -1
- package/dist/src/check.js +514 -15
- package/dist/src/check.js.map +1 -1
- package/dist/src/export/impact.d.ts +45 -0
- package/dist/src/export/impact.d.ts.map +1 -0
- package/dist/src/export/impact.js +234 -0
- package/dist/src/export/impact.js.map +1 -0
- package/dist/src/export/rdf.d.ts.map +1 -1
- package/dist/src/export/rdf.js +4 -1
- package/dist/src/export/rdf.js.map +1 -1
- package/dist/src/export/retrieval.d.ts +408 -0
- package/dist/src/export/retrieval.d.ts.map +1 -0
- package/dist/src/export/retrieval.js +1156 -0
- package/dist/src/export/retrieval.js.map +1 -0
- package/dist/src/model-diff.d.ts +23 -0
- package/dist/src/model-diff.d.ts.map +1 -1
- package/dist/src/model-diff.js +132 -30
- package/dist/src/model-diff.js.map +1 -1
- package/dist/src/ser-des/config/calculation.d.ts.map +1 -1
- package/dist/src/ser-des/config/calculation.js +119 -4
- package/dist/src/ser-des/config/calculation.js.map +1 -1
- package/dist/src/ser-des/config/dimension.d.ts +12 -0
- package/dist/src/ser-des/config/dimension.d.ts.map +1 -0
- package/dist/src/ser-des/config/dimension.js +57 -0
- package/dist/src/ser-des/config/dimension.js.map +1 -0
- package/dist/src/ser-des/config/index.d.ts.map +1 -1
- package/dist/src/ser-des/config/index.js +5 -0
- package/dist/src/ser-des/config/index.js.map +1 -1
- package/dist/src/ser-des/config/packageManifest.d.ts.map +1 -1
- package/dist/src/ser-des/config/packageManifest.js +7 -1
- package/dist/src/ser-des/config/packageManifest.js.map +1 -1
- package/dist/src/ser-des/config/quantityRegister.d.ts.map +1 -1
- package/dist/src/ser-des/config/quantityRegister.js +38 -0
- package/dist/src/ser-des/config/quantityRegister.js.map +1 -1
- package/dist/src/ser-des/config/reference.d.ts.map +1 -1
- package/dist/src/ser-des/config/reference.js +18 -0
- package/dist/src/ser-des/config/reference.js.map +1 -1
- package/dist/src/ser-des/config/requirement.d.ts.map +1 -1
- package/dist/src/ser-des/config/requirement.js +43 -0
- package/dist/src/ser-des/config/requirement.js.map +1 -1
- package/dist/src/ser-des/config/subject.d.ts +10 -1
- package/dist/src/ser-des/config/subject.d.ts.map +1 -1
- package/dist/src/ser-des/config/subject.js +96 -63
- package/dist/src/ser-des/config/subject.js.map +1 -1
- package/dist/src/ser-des/config/term.d.ts.map +1 -1
- package/dist/src/ser-des/config/term.js +82 -20
- package/dist/src/ser-des/config/term.js.map +1 -1
- package/dist/src/ser-des/parse-block.d.ts +1 -0
- package/dist/src/ser-des/parse-block.d.ts.map +1 -1
- package/dist/src/ser-des/parse-block.js +34 -0
- package/dist/src/ser-des/parse-block.js.map +1 -1
- package/dist/src/ser-des/parse.d.ts.map +1 -1
- package/dist/src/ser-des/parse.js +2 -0
- package/dist/src/ser-des/parse.js.map +1 -1
- package/dist/src/ser-des/types.d.ts +2 -1
- package/dist/src/ser-des/types.d.ts.map +1 -1
- package/dist/src/types/Calculation.d.ts +15 -0
- package/dist/src/types/Calculation.d.ts.map +1 -1
- package/dist/src/types/Package.d.ts +8 -0
- package/dist/src/types/Package.d.ts.map +1 -1
- package/dist/src/types/Quantity.d.ts +7 -0
- package/dist/src/types/Quantity.d.ts.map +1 -1
- package/dist/src/types/Reference.d.ts +11 -0
- package/dist/src/types/Reference.d.ts.map +1 -1
- package/dist/src/types/Requirement.d.ts +17 -0
- package/dist/src/types/Requirement.d.ts.map +1 -1
- package/dist/src/types/Standard.d.ts +2 -1
- package/dist/src/types/Standard.d.ts.map +1 -1
- package/dist/src/types/Subject.d.ts +10 -0
- package/dist/src/types/Subject.d.ts.map +1 -1
- package/dist/src/types/Term.d.ts +33 -1
- package/dist/src/types/Term.d.ts.map +1 -1
- package/dist-browser/index.mjs +1647 -1459
- package/dist-cli/primmel.mjs +2118 -166
- package/package.json +1 -1
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import type Standard from '../types/Standard';
|
|
2
|
+
import type { PackageManifest } from '../types/Package';
|
|
3
|
+
import type Term from '../types/Term';
|
|
4
|
+
import type { ApplicabilityEntry } from '../types/Form';
|
|
5
|
+
import type { SpellingEntry } from '../types/Text';
|
|
6
|
+
/**
|
|
7
|
+
* The projection shape version (semver'd by the document, not the
|
|
8
|
+
* package): a shape change — a field renamed, removed, or re-typed —
|
|
9
|
+
* bumps the version and is a re-index signal for every consumer;
|
|
10
|
+
* additive fields within a version are legal (consumers ignore what
|
|
11
|
+
* they do not read).
|
|
12
|
+
*/
|
|
13
|
+
export declare const RETRIEVAL_PROJECTION = "primmel-retrieval/1";
|
|
14
|
+
/**
|
|
15
|
+
* The facet shape version (ask 3 — the pre-flattened retrieval facet):
|
|
16
|
+
* semver'd independently of the projection — a facet key renamed,
|
|
17
|
+
* removed, or re-typed bumps it (a re-index signal); additive keys
|
|
18
|
+
* within a version are legal (indexes ignore what they do not read).
|
|
19
|
+
*/
|
|
20
|
+
export declare const RETRIEVAL_FACET_VERSION = "retrieval-facet/1";
|
|
21
|
+
/**
|
|
22
|
+
* The facet (ask 3): one FLAT scalar map per unit — string values only,
|
|
23
|
+
* no nesting — the metadata a retrieval index accepts per vector. The
|
|
24
|
+
* key set is documented in docs/retrieval-export.md and congruent with
|
|
25
|
+
* the deployed consumer's chunk wire schema where the two overlap.
|
|
26
|
+
*/
|
|
27
|
+
export type RetrievalFacet = Record<string, string>;
|
|
28
|
+
/** The unit kind vocabulary (the consumer's tokens where deployed). */
|
|
29
|
+
export type RetrievalUnitKind = 'requirement' | 'conformance_test' | 'term' | 'attribute' | 'behavior' | 'calculation' | 'formula' | 'symbol' | 'constraint' | 'characteristic' | 'table' | 'sequence' | 'note' | 'state_machine' | 'dimension';
|
|
30
|
+
/**
|
|
31
|
+
* One provenance edge of a unit, normalized onto the DOCUMENT's own
|
|
32
|
+
* numbering (ask 1). `clause` is always the document's clause number —
|
|
33
|
+
* a producer-internal anchor (a metanorma UUID, or a non-clause
|
|
34
|
+
* fragment such as a table anchor) rides as `anchor`, an optional
|
|
35
|
+
* EXTRA, never the only machine reference the unit carries.
|
|
36
|
+
*/
|
|
37
|
+
export interface RetrievalClause {
|
|
38
|
+
/** The document identifier (the edition-carrying publication URN). */
|
|
39
|
+
doc: string;
|
|
40
|
+
/** The document's own clause number ('' when the source names none). */
|
|
41
|
+
clause: string;
|
|
42
|
+
/**
|
|
43
|
+
* The citable URN: `<doc>#clause-<clause>` when a clause is known
|
|
44
|
+
* (plus the `/s<N>` sentence sub-address when carried), `<doc>#<anchor>`
|
|
45
|
+
* when only a non-UUID fragment anchor is known, the bare doc otherwise.
|
|
46
|
+
*/
|
|
47
|
+
urn: string;
|
|
48
|
+
/** The producer-internal anchor the source carried — optional extra. */
|
|
49
|
+
anchor?: string;
|
|
50
|
+
/** The sentence sub-address (TODO.roadmap/26's fragment grammar). */
|
|
51
|
+
fragment?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The machine passport (ask 6): the compact per-unit digest an agent
|
|
55
|
+
* carries and verifies without loading the package. Every field is
|
|
56
|
+
* present (empty string / empty list when the unit declares nothing) so
|
|
57
|
+
* the canonical serialized form has one shape per passport version.
|
|
58
|
+
*/
|
|
59
|
+
export interface UnitPassport {
|
|
60
|
+
/** The passport shape version. */
|
|
61
|
+
v: 1;
|
|
62
|
+
kind: RetrievalUnitKind;
|
|
63
|
+
id: string;
|
|
64
|
+
/** The headline prose: statement ?? definition ?? name. */
|
|
65
|
+
text: string;
|
|
66
|
+
/** The machine expression (limit OCL / check / derivation / formula). */
|
|
67
|
+
expression: string;
|
|
68
|
+
/** The declared measurement units (sorted, de-duplicated). */
|
|
69
|
+
units: string[];
|
|
70
|
+
/** The applicability filter, canonical-compact ('' = applies to all). */
|
|
71
|
+
applicability: string;
|
|
72
|
+
/** The acceptance summary ('' when the unit declares none). */
|
|
73
|
+
acceptance: string;
|
|
74
|
+
/** The provenance clause URNs (document-numbered form). */
|
|
75
|
+
provenance: string[];
|
|
76
|
+
/** The unit's content hash (the currency signal — see the unit). */
|
|
77
|
+
content_hash: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* One typed retrieval unit — the atom a RAG consumer indexes. Fields
|
|
81
|
+
* are omitted when the unit declares nothing for them (the canonical
|
|
82
|
+
* JSON stays tight); `id`, `kind`, `content_hash`, `passport`, and
|
|
83
|
+
* `facet` are always present.
|
|
84
|
+
*/
|
|
85
|
+
export interface RetrievalUnit {
|
|
86
|
+
/**
|
|
87
|
+
* The package-authored identifier — a STABLE PUBLIC IDENTIFIER (the
|
|
88
|
+
* contract's stability tier): it moves only when the package
|
|
89
|
+
* re-authors the identifier; a rename of display text never moves it.
|
|
90
|
+
*/
|
|
91
|
+
id: string;
|
|
92
|
+
kind: RetrievalUnitKind;
|
|
93
|
+
/** The parent class/scope id (requirements, conformance tests). */
|
|
94
|
+
class?: string;
|
|
95
|
+
name?: string;
|
|
96
|
+
statement?: string;
|
|
97
|
+
definition?: string;
|
|
98
|
+
guidance?: string;
|
|
99
|
+
obligation?: string;
|
|
100
|
+
/** The limit modality (requirements): the declared token, shall default. */
|
|
101
|
+
modality?: string;
|
|
102
|
+
/** The machine expression the unit carries (limit OCL, check, derive). */
|
|
103
|
+
expression?: string;
|
|
104
|
+
/** The expression's declared inputs (limit uses / derivation inputs). */
|
|
105
|
+
expression_inputs?: string[];
|
|
106
|
+
/** The declared measurement units (sorted, de-duplicated). */
|
|
107
|
+
units?: string[];
|
|
108
|
+
/** The classification applicability filter (typed, as authored). */
|
|
109
|
+
applicability?: ApplicabilityEntry[];
|
|
110
|
+
/** Subject-chain paths the unit binds (the INV-3 discipline). */
|
|
111
|
+
binds_to?: string[];
|
|
112
|
+
/** Requirement ids a conformance test verifies. */
|
|
113
|
+
targets?: string[];
|
|
114
|
+
/** The acceptance chain, compact (accepts triple / pass_if / criteria). */
|
|
115
|
+
acceptance?: string;
|
|
116
|
+
/** The raw acceptance-criteria block (requirements) when authored. */
|
|
117
|
+
acceptance_criteria?: string;
|
|
118
|
+
/** The verification method + description (requirements). */
|
|
119
|
+
verification?: {
|
|
120
|
+
method: string;
|
|
121
|
+
description: string;
|
|
122
|
+
};
|
|
123
|
+
/** The channel dimension a requirement is verified per value of. */
|
|
124
|
+
channel?: string;
|
|
125
|
+
/** Requirement/test ids this unit depends on. */
|
|
126
|
+
dependencies?: string[];
|
|
127
|
+
/**
|
|
128
|
+
* The base prose value's spelling — the package's `default_spelling`
|
|
129
|
+
* (ISO 24229; ask 7). The default spelling's values live inline (the
|
|
130
|
+
* `name`/`statement`/`definition` fields above); this is their tag.
|
|
131
|
+
* Omitted when the package declares no default spelling.
|
|
132
|
+
*/
|
|
133
|
+
language?: string;
|
|
134
|
+
/**
|
|
135
|
+
* The ISO 24229 alternate spellings of the unit's prose fields
|
|
136
|
+
* (ask 7), resolved from the package's `text` blocks: keyed by the
|
|
137
|
+
* addressed field path relative to the element (`statement`, or the
|
|
138
|
+
* nested `<path…>.<field>` form of gap-close E13), values in authored
|
|
139
|
+
* order. AUTHORED content — a translation change moves the
|
|
140
|
+
* content_hash like any other content change.
|
|
141
|
+
*/
|
|
142
|
+
variants?: Record<string, SpellingEntry[]>;
|
|
143
|
+
/** Kind-specific payload (typed IO, table columns, sequence steps…). */
|
|
144
|
+
payload?: Record<string, unknown>;
|
|
145
|
+
/** The primary provenance edge (the first of `clauses`). */
|
|
146
|
+
clause?: RetrievalClause;
|
|
147
|
+
/** Every provenance edge, in authored order, de-duplicated by URN. */
|
|
148
|
+
clauses?: RetrievalClause[];
|
|
149
|
+
/**
|
|
150
|
+
* sha256 over the unit's canonical JSON content (every field above,
|
|
151
|
+
* content_hash, passport and facet excluded): the currency signal.
|
|
152
|
+
* Identity is the id; the digest says whether the CONTENT moved.
|
|
153
|
+
*/
|
|
154
|
+
content_hash: string;
|
|
155
|
+
/** The machine passport (ask 6) — the compact verifiable digest. */
|
|
156
|
+
passport: UnitPassport;
|
|
157
|
+
/**
|
|
158
|
+
* The flat retrieval facet (ask 3) — the pre-flattened scalar metadata
|
|
159
|
+
* map, derived from the unit's authored content plus the package's
|
|
160
|
+
* document block. A DERIVED projection: excluded from the content_hash
|
|
161
|
+
* input (the digest covers authored content; the facet re-derives
|
|
162
|
+
* from it deterministically). Attached by the export, after the
|
|
163
|
+
* digest.
|
|
164
|
+
*/
|
|
165
|
+
facet: RetrievalFacet;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The document block (ask 2): `edition` and `model_version` are two
|
|
169
|
+
* distinct, stable fields — the publication edition the model
|
|
170
|
+
* corresponds to, and the package's own version. Neither ever borrows
|
|
171
|
+
* the other's value.
|
|
172
|
+
*/
|
|
173
|
+
export interface RetrievalPackage {
|
|
174
|
+
id: string;
|
|
175
|
+
title: string;
|
|
176
|
+
kind: string;
|
|
177
|
+
/** The publication edition (the manifest's newest editions entry). */
|
|
178
|
+
edition: string;
|
|
179
|
+
/** The package's own version (the manifest `version`). */
|
|
180
|
+
model_version: string;
|
|
181
|
+
/** The publication-edition register, newest first. */
|
|
182
|
+
editions: string[];
|
|
183
|
+
base_urn: string;
|
|
184
|
+
status?: string;
|
|
185
|
+
/** The package's default spelling (ISO 24229 code, e.g. eng-Latn). */
|
|
186
|
+
default_spelling: string;
|
|
187
|
+
/** The declared spelling set (the default plus localizations). */
|
|
188
|
+
spellings: string[];
|
|
189
|
+
/** The earlier-edition package URNs this edition supersedes. */
|
|
190
|
+
supersedes?: string[];
|
|
191
|
+
}
|
|
192
|
+
/** The retrieval document: the versioned projection of one package. */
|
|
193
|
+
export interface RetrievalDocument {
|
|
194
|
+
projection: typeof RETRIEVAL_PROJECTION;
|
|
195
|
+
/** The facet shape version every unit's `facet` map follows (ask 3). */
|
|
196
|
+
facet_version: typeof RETRIEVAL_FACET_VERSION;
|
|
197
|
+
package: RetrievalPackage;
|
|
198
|
+
/**
|
|
199
|
+
* sha256 over every byte of the package directory (the freshness
|
|
200
|
+
* signal — the SAME algorithm the deployed consumer's
|
|
201
|
+
* derive-model-plane.ts runs, so the pins key without translation).
|
|
202
|
+
* Present when the export ran from a directory; absent on the pure
|
|
203
|
+
* Standard form.
|
|
204
|
+
*/
|
|
205
|
+
source_hash?: string;
|
|
206
|
+
units: RetrievalUnit[];
|
|
207
|
+
}
|
|
208
|
+
/** Tallies + honesty bookkeeping for one export run. */
|
|
209
|
+
export interface RetrievalExportStats {
|
|
210
|
+
units: number;
|
|
211
|
+
/** Per-kind tallies (only kinds with at least one unit appear). */
|
|
212
|
+
byKind: Partial<Record<RetrievalUnitKind, number>>;
|
|
213
|
+
/** Units carrying at least one document-numbered clause edge. */
|
|
214
|
+
withClause: number;
|
|
215
|
+
/**
|
|
216
|
+
* Units whose ONLY provenance is a producer-internal anchor (a UUID
|
|
217
|
+
* or fragment, never a clause number) — the ask-1 debt, counted so it
|
|
218
|
+
* is visible, never silently presented as citable provenance.
|
|
219
|
+
*/
|
|
220
|
+
anchorOnlyProvenance: number;
|
|
221
|
+
/**
|
|
222
|
+
* Units with at least one edge whose doc is NOT a publication URN (a
|
|
223
|
+
* legacy doc token like "OIML-V1") — provenance that names no document
|
|
224
|
+
* identifier, the same debt class ask 1 names, counted for visibility.
|
|
225
|
+
*/
|
|
226
|
+
nonUrnDocRefs: number;
|
|
227
|
+
/** Units with no provenance at all. */
|
|
228
|
+
withoutProvenance: number;
|
|
229
|
+
/**
|
|
230
|
+
* Units carrying at least one language-tagged variant field (ask 7).
|
|
231
|
+
*/
|
|
232
|
+
withVariants: number;
|
|
233
|
+
/**
|
|
234
|
+
* `text` blocks whose variants reached no unit: the address resolves
|
|
235
|
+
* to an element the projection does not ship as a unit (a form, a
|
|
236
|
+
* subject, an instrument), or resolves to nothing at all (a C89-red
|
|
237
|
+
* package). Counted, never silently dropped.
|
|
238
|
+
*/
|
|
239
|
+
droppedTextBlocks: number;
|
|
240
|
+
}
|
|
241
|
+
/** The export product: the document, its canonical JSON, and the stats. */
|
|
242
|
+
export interface RetrievalExport {
|
|
243
|
+
document: RetrievalDocument;
|
|
244
|
+
/**
|
|
245
|
+
* The canonical serialization: UTF-8 JSON, object keys sorted
|
|
246
|
+
* recursively, two-space indent, trailing newline — byte-deterministic
|
|
247
|
+
* per package state (the deployed consumer's bundle byte format).
|
|
248
|
+
*/
|
|
249
|
+
json: string;
|
|
250
|
+
stats: RetrievalExportStats;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The canonical JSON form: sorted keys, compact separators, UTF-8 — the
|
|
254
|
+
* form every JSON stack reproduces (`json.dumps(c, sort_keys=True,
|
|
255
|
+
* separators=(",", ":"), ensure_ascii=False)`). The digest input.
|
|
256
|
+
*/
|
|
257
|
+
export declare function canonicalJson(value: unknown): string;
|
|
258
|
+
/** sha256 hex over the canonical JSON of a value — the currency digest. */
|
|
259
|
+
export declare function retrievalDigest(value: unknown): string;
|
|
260
|
+
/**
|
|
261
|
+
* The canonical serialized form of a unit's passport (ask 6): the
|
|
262
|
+
* string an agent carries and re-hashes to verify the unit.
|
|
263
|
+
*/
|
|
264
|
+
export declare function passportCanonical(passport: UnitPassport): string;
|
|
265
|
+
/**
|
|
266
|
+
* sha256 over every file of the package (path + bytes), deterministic —
|
|
267
|
+
* the SAME algorithm the deployed consumer's derive-model-plane.ts runs
|
|
268
|
+
* (sorted walk, `.DS_Store` skipped, relative path + NUL + the file's
|
|
269
|
+
* own sha256 + LF), so a source_hash here and a source_hash there are
|
|
270
|
+
* the same signal and the consumer's pins key without translation. ANY
|
|
271
|
+
* package change — a constraint re-authored, a clause re-cited — moves
|
|
272
|
+
* the hash; that byte-sensitivity is deliberate (identity rides the
|
|
273
|
+
* unit ids, currency rides the digests).
|
|
274
|
+
*/
|
|
275
|
+
export declare function packageSourceHash(dir: string): string;
|
|
276
|
+
interface RawRef {
|
|
277
|
+
doc?: string;
|
|
278
|
+
clause?: string;
|
|
279
|
+
fragment?: string;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Normalize one raw provenance edge onto the document's own numbering.
|
|
283
|
+
* The `doc` slot of a loaded ref may carry an embedded `#fragment` (the
|
|
284
|
+
* derives-from fold's shape for non-clause anchors — ref.ts); a
|
|
285
|
+
* `#clause-<n>` fragment restores the clause, any other fragment rides
|
|
286
|
+
* as the `anchor` extra. A UUID-shaped clause or fragment is an anchor,
|
|
287
|
+
* never a clause.
|
|
288
|
+
*/
|
|
289
|
+
export declare function normalizeClause(doc: string, clause: string, fragment?: string): RetrievalClause;
|
|
290
|
+
/**
|
|
291
|
+
* Collect every provenance edge of an element, normalized and
|
|
292
|
+
* de-duplicated by URN, in authored order: the structured channels
|
|
293
|
+
* (source / sourceRef / sourceRefs), the scalar reference URN (the
|
|
294
|
+
* conformance test's v2 channel), and urn-targeted refs not already
|
|
295
|
+
* folded. The first edge is the unit's primary `clause`.
|
|
296
|
+
*/
|
|
297
|
+
export declare function collectClauses(el: {
|
|
298
|
+
source?: RawRef | null;
|
|
299
|
+
sourceRef?: RawRef | null;
|
|
300
|
+
sourceRefs?: RawRef[] | null;
|
|
301
|
+
reference?: string;
|
|
302
|
+
refs?: {
|
|
303
|
+
predicate: string;
|
|
304
|
+
target: string;
|
|
305
|
+
}[] | null;
|
|
306
|
+
}): RetrievalClause[];
|
|
307
|
+
/**
|
|
308
|
+
* A term's provenance (ask 1's sharpest case): the `source` facet is a
|
|
309
|
+
* plain string carrying whitespace-separated URNs (e.g. the VIML URN
|
|
310
|
+
* plus the Recommendation's clause URN); each parses onto a normalized
|
|
311
|
+
* edge. When no parsed edge carries a clause number and the term
|
|
312
|
+
* declares a `section` (the document's own terminology clause), the
|
|
313
|
+
* section becomes an edge on the package's base URN — the document's
|
|
314
|
+
* own numbering, exactly as authored.
|
|
315
|
+
*/
|
|
316
|
+
export declare function termClauses(term: Term, baseUrn: string): RetrievalClause[];
|
|
317
|
+
/** The canonical-compact applicability summary: `dim=v1|v2; …`, sorted. */
|
|
318
|
+
export declare function applicabilitySummary(entries: ApplicabilityEntry[] | undefined): string;
|
|
319
|
+
/**
|
|
320
|
+
* The document-URN parts the facet flattens per unit, parsed with the
|
|
321
|
+
* deployed consumer's grammar (`urn:oiml:pub:<type>:<number>[:<year>]`,
|
|
322
|
+
* type ∈ r/d/b/g/e) extended with the part suffix the publication URNs
|
|
323
|
+
* carry (`60-1`); a non-matching base URN yields empty parts, never an
|
|
324
|
+
* invented value (the register mapping stays consumer-side).
|
|
325
|
+
*/
|
|
326
|
+
export interface RetrievalDocParts {
|
|
327
|
+
/** The lower-case publication-type letter (`r`, `d`, `b`, `g`, `e`). */
|
|
328
|
+
doctype: string;
|
|
329
|
+
/** The document number, part suffix included (`60`, `60-1`). */
|
|
330
|
+
doc_number: string;
|
|
331
|
+
/** The URN's publication year ('' when the URN carries none). */
|
|
332
|
+
year: string;
|
|
333
|
+
/** The display label (`OIML R 60:2021`; '' when unparseable). */
|
|
334
|
+
label: string;
|
|
335
|
+
}
|
|
336
|
+
export declare function retrievalDocParts(baseUrn: string): RetrievalDocParts;
|
|
337
|
+
/**
|
|
338
|
+
* Build the unit's flat facet (ask 3): the document fields every vector
|
|
339
|
+
* of this package carries, the unit's kind + currency keys, its primary
|
|
340
|
+
* clause anchor, and its applicability dimensions flattened to
|
|
341
|
+
* `app_<dim>` keys (values sorted, `|`-joined; a non-`any` match mode
|
|
342
|
+
* rides beside as `app_<dim>_match`).
|
|
343
|
+
*
|
|
344
|
+
* Key congruence with the deployed consumer's chunk wire schema
|
|
345
|
+
* (ChunkMetaModel): `doc_id`, `docidentifier`, `doctype`, `doc_number`,
|
|
346
|
+
* `edition`, `language`, `clause_anchor`, `clause_title`, `status`,
|
|
347
|
+
* `unit_id`, `block`, `unit_hash` carry the same names and semantics.
|
|
348
|
+
* The lane constants the schema also carries (`tier`, `corpus`,
|
|
349
|
+
* `producer`, `text_ref`, `superseded_by`) are DEPLOYMENT stamps, not
|
|
350
|
+
* package content — the consumer's adapter sets them per lane; the
|
|
351
|
+
* facet never invents them. Three deliberate value choices:
|
|
352
|
+
*
|
|
353
|
+
* - `language` is the package's authored default spelling (the
|
|
354
|
+
* ISO 24229 code, e.g. `eng-Latn`) — the consumer lanes stamp a
|
|
355
|
+
* constant two-letter code today; the facet carries the authored
|
|
356
|
+
* truth and the adapter maps.
|
|
357
|
+
* - `clause_anchor` is the primary edge's document clause number, ''
|
|
358
|
+
* when the unit names no clause (never a producer UUID — ask 1
|
|
359
|
+
* already demoted those to `anchor`). The consumer's "model"
|
|
360
|
+
* fallback for clause-less model units is its lane marker, applied
|
|
361
|
+
* at its adapter.
|
|
362
|
+
* - `edition` is the package block's canonical edition (ask 2), not
|
|
363
|
+
* a re-parse of the base URN — the two coincide on URN-carrying
|
|
364
|
+
* packages, and the package block is authoritative when they drift.
|
|
365
|
+
*/
|
|
366
|
+
export declare function retrievalFacet(unit: RetrievalUnit, pkg: RetrievalPackage): RetrievalFacet;
|
|
367
|
+
/**
|
|
368
|
+
* Resolve a `text` block's address onto its element: the LONGEST
|
|
369
|
+
* dot-boundary prefix registered in the package (element ids may
|
|
370
|
+
* themselves carry dots — `r144-3/sec-3.4`); the rest is the path into
|
|
371
|
+
* the element's structure, the terminal segment the prose field. The
|
|
372
|
+
* same rule the C89 linter resolves with (check.ts) — the projection
|
|
373
|
+
* and the linter never disagree about which element a text block
|
|
374
|
+
* addresses.
|
|
375
|
+
*/
|
|
376
|
+
export declare function resolveTextAddress(address: string, elementIds: ReadonlySet<string>): {
|
|
377
|
+
elementId: string;
|
|
378
|
+
path: string;
|
|
379
|
+
} | null;
|
|
380
|
+
/**
|
|
381
|
+
* The publication edition the model corresponds to: the manifest's
|
|
382
|
+
* newest `editions` entry (the register is newest-first), the base
|
|
383
|
+
* URN's trailing year segment as fallback. NEVER the package version —
|
|
384
|
+
* the two fields answer different questions (edition steering vs
|
|
385
|
+
* freshness gating) and never borrow each other's value.
|
|
386
|
+
*/
|
|
387
|
+
export declare function packageEdition(manifest: PackageManifest | null | undefined): string;
|
|
388
|
+
/** Options for the pure export form. */
|
|
389
|
+
export interface RetrievalExportOptions {
|
|
390
|
+
/**
|
|
391
|
+
* A precomputed package source hash (the bundle freshness signal).
|
|
392
|
+
* `exportPackageRetrieval` computes it from the directory; a caller
|
|
393
|
+
* with its own hash pipeline may supply it here.
|
|
394
|
+
*/
|
|
395
|
+
sourceHash?: string;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Project a loaded Standard into the retrieval document (pure — no I/O;
|
|
399
|
+
* the id projection, the clause normalization, the digests).
|
|
400
|
+
*/
|
|
401
|
+
export declare function exportStandardRetrieval(standard: Standard, options?: RetrievalExportOptions): RetrievalExport;
|
|
402
|
+
/**
|
|
403
|
+
* Export a package directory: load, hash the package bytes (the bundle
|
|
404
|
+
* freshness signal — the deployed consumer's exact algorithm), project.
|
|
405
|
+
*/
|
|
406
|
+
export declare function exportPackageRetrieval(dir: string): RetrievalExport;
|
|
407
|
+
export {};
|
|
408
|
+
//# sourceMappingURL=retrieval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieval.d.ts","sourceRoot":"","sources":["../../../src/export/retrieval.ts"],"names":[],"mappings":"AAuGA,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAStC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAQnD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,wBAAwB,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,uBA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