@domorium/validator 2.1.0 → 2.2.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/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to `@domorium/validator` are documented here.
4
4
 
5
+ ## 2.2.0
6
+
7
+ - **The lexer's mode stack no longer grows with the document.** Each line left
8
+ one or two frames behind until the lex ended — 3.56 million on a 50 MB export,
9
+ an estimated tens of megabytes at peak. Every line now returns the lexer to
10
+ where it began, so the stack is at most two deep. The tokens are unchanged
11
+ (#80).
12
+ - **`readDate` reads a date in a document checked against no dialect.** A file
13
+ whose header names no version, a Personal Ancestral File, or a version no
14
+ schema describes answered `null` for every date, so a consumer showing years
15
+ showed none for them. Such a document now reads a payload by the GEDCOM 5.5.1
16
+ grammar and, where that reads nothing, by the GEDCOM 7 one without `SCHMA`,
17
+ and answers `null` only where neither reads a possible date. Its diagnostics
18
+ are unchanged (#453).
19
+ - **Year 0 in the Gregorian or Julian calendar is reported** with the new code
20
+ `VAL016` (`ImpossibleYear`), in both dialects, and `readDate` answers `null`
21
+ for it. GEDCOM 7 states that neither calendar has a year 0; 5.5.1 is held to
22
+ the same rule. The year is judged as the grammar reads it, so `0BC` counts and
23
+ an extension calendar does not (#453).
24
+ - `GedcomDate.dualYear` documents that a date before the common era has none.
25
+
5
26
  ## 2.1.0
6
27
 
7
28
  - **`readDate(payload)` answers what a date says, not only whether it is
package/README.md CHANGED
@@ -140,6 +140,7 @@ const unresolved = errors.filter(
140
140
  | `VAL013` | `SubstitutedVersion` | a version checked against a different version's schema |
141
141
  | `VAL014` | `ImpossibleDay` | a date naming a day its calendar does not have, such as `31 FEB` |
142
142
  | `VAL015` | `PersonalAncestralFile` | a header naming `SYST` before `GEDC`, so the file is a Personal Ancestral File |
143
+ | `VAL016` | `ImpossibleYear` | a Gregorian or Julian date naming year 0, which neither calendar numbers |
143
144
  | `unresolved-xref` | `UnresolvedXref` | an xref naming no record of the required type |
144
145
  | `invalid-level` | `InvalidLevel` | a level that cannot follow the line above it |
145
146
  | `LEXER` | `Lexer` | the text could not be tokenized |
@@ -198,19 +199,19 @@ objects apiece. Read it freely at the edges, and use `startOffset` and
198
199
  Every method reads the document last given to `createDocument`, which returns
199
200
  the same instance so the two can be chained.
200
201
 
201
- | Method | Answers |
202
- | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
203
- | `createDocument(text, options?)` | Parses and validates, and returns the document itself. |
204
- | `getErrors()` | Every diagnostic, in the order found. |
205
- | `getNodes()` | The records, each with its substructures. |
206
- | `getVersion()` | The version read from `HEAD`.`GEDC`.`VERS`, as written. |
207
- | `getDialect()` | Which rules were applied: `"5.5.1"` or `"7.0"`. |
208
- | `getVersionResolution()` | How that was decided — `supported`, `substituted`, `unsupported`, `undetermined`, or `paf` for a file whose header names a writing program before its version. |
209
- | `getLabel(node)` | The specification's name for a structure, for a UI to show instead of the tag: `HEAD` answers `Header`. |
210
- | `getPointerTargetTag(node)` | The record tag a pointer line must name: `FAMC` answers `FAM`. |
211
- | `isRecordDeclaration(node)` | Whether the node declares a record other lines can point at. |
212
- | `getCompletions(position, lineText)` | What may be written at a position — `{ label, kind: "tag" \| "enum" \| "pointer", detail? }`. |
213
- | `readDate(payload)` | What a date payload says, read in the document's dialect — or `null` where the diagnostics would reject it as a date value. See `GedcomDateValue`. |
202
+ | Method | Answers |
203
+ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
204
+ | `createDocument(text, options?)` | Parses and validates, and returns the document itself. |
205
+ | `getErrors()` | Every diagnostic, in the order found. |
206
+ | `getNodes()` | The records, each with its substructures. |
207
+ | `getVersion()` | The version read from `HEAD`.`GEDC`.`VERS`, as written. |
208
+ | `getDialect()` | Which rules were applied: `"5.5.1"` or `"7.0"`. |
209
+ | `getVersionResolution()` | How that was decided — `supported`, `substituted`, `unsupported`, `undetermined`, or `paf` for a file whose header names a writing program before its version. |
210
+ | `getLabel(node)` | The specification's name for a structure, for a UI to show instead of the tag: `HEAD` answers `Header`. |
211
+ | `getPointerTargetTag(node)` | The record tag a pointer line must name: `FAMC` answers `FAM`. |
212
+ | `isRecordDeclaration(node)` | Whether the node declares a record other lines can point at. |
213
+ | `getCompletions(position, lineText)` | What may be written at a position — `{ label, kind: "tag" \| "enum" \| "pointer", detail? }`. |
214
+ | `readDate(payload)` | What a date payload says, read in the document's dialect — or `null` where the diagnostics would reject it as a date value. A document checked against no dialect reads by 5.5.1, then 7.0. See `GedcomDateValue`. |
214
215
 
215
216
  ## Scripts
216
217
 
@@ -32,9 +32,10 @@ export declare class GedcomDocument {
32
32
  getCompletions(position: Position, lineText: string): GedcomCompletion[];
33
33
  /**
34
34
  * Null wherever the document's own diagnostics would not call the payload a
35
- * valid date value, and for one with nothing to read: an empty payload, a
36
- * 5.5.1 date in a calendar the schema gives no months, or a document not
37
- * checked against any dialect.
35
+ * valid date value, and for one with nothing to read: an empty payload, or a
36
+ * 5.5.1 date in a calendar the schema gives no months. A document checked
37
+ * against no dialect reads by 5.5.1, then by 7.0 without its SCHMA, and is
38
+ * null only where neither reads a possible date.
38
39
  */
39
40
  readDate(value: string): GedcomDateValue | null;
40
41
  getErrors(): GedcomError[];