@speleotica/frcsdata 5.0.0-beta.4 → 5.0.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.
Files changed (102) hide show
  1. package/cli/{check-survey-correspondence.d.ts → check-correspondence.d.ts} +1 -1
  2. package/cli/check-correspondence.d.ts.map +1 -0
  3. package/cli/{check-survey-correspondence.js → check-correspondence.js} +4 -5
  4. package/cli/check-correspondence.js.map +1 -0
  5. package/cli/{check-survey.d.ts → check.d.ts} +1 -1
  6. package/cli/check.d.ts.map +1 -0
  7. package/cli/{check-survey.js → check.js} +3 -3
  8. package/cli/check.js.map +1 -0
  9. package/cli/compareNames.d.ts +2 -0
  10. package/cli/compareNames.d.ts.map +1 -0
  11. package/cli/compareNames.js +15 -0
  12. package/cli/compareNames.js.map +1 -0
  13. package/cli/formatNamesFile.d.ts +4 -0
  14. package/cli/formatNamesFile.d.ts.map +1 -0
  15. package/cli/formatNamesFile.js +13 -0
  16. package/cli/formatNamesFile.js.map +1 -0
  17. package/cli/list-names.d.ts +5 -0
  18. package/cli/list-names.d.ts.map +1 -0
  19. package/cli/list-names.js +74 -0
  20. package/cli/list-names.js.map +1 -0
  21. package/cli/merge-names-files.d.ts +2 -0
  22. package/cli/merge-names-files.d.ts.map +1 -0
  23. package/cli/merge-names-files.js +25 -0
  24. package/cli/merge-names-files.js.map +1 -0
  25. package/cli/parse-survey.d.ts.map +1 -1
  26. package/cli/parse-survey.js +3 -2
  27. package/cli/parse-survey.js.map +1 -1
  28. package/cli/parseNamesFile.d.ts +4 -0
  29. package/cli/parseNamesFile.d.ts.map +1 -0
  30. package/cli/parseNamesFile.js +19 -0
  31. package/cli/parseNamesFile.js.map +1 -0
  32. package/cli/readFile.d.ts +2 -0
  33. package/cli/readFile.d.ts.map +1 -0
  34. package/cli/readFile.js +13 -0
  35. package/cli/readFile.js.map +1 -0
  36. package/cli/replace-names.d.ts +2 -0
  37. package/cli/replace-names.d.ts.map +1 -0
  38. package/cli/replace-names.js +45 -0
  39. package/cli/replace-names.js.map +1 -0
  40. package/cli/{summarize-survey.d.ts → summarize.d.ts} +1 -1
  41. package/cli/summarize.d.ts.map +1 -0
  42. package/cli/{summarize-survey.js → summarize.js} +3 -3
  43. package/cli/summarize.js.map +1 -0
  44. package/cli.js +72 -7
  45. package/cli.js.map +1 -1
  46. package/index.d.ts +8 -6
  47. package/index.d.ts.map +1 -1
  48. package/index.js +7 -28
  49. package/index.js.map +1 -1
  50. package/node/index.d.ts +1 -1
  51. package/node/index.d.ts.map +1 -1
  52. package/package.json +2 -1
  53. package/replaceRanges.d.ts +6 -0
  54. package/replaceRanges.d.ts.map +1 -0
  55. package/replaceRanges.js +23 -0
  56. package/replaceRanges.js.map +1 -0
  57. package/src/cli/{check-survey-correspondence.ts → check-correspondence.ts} +6 -5
  58. package/src/cli/{check-survey.ts → check.ts} +2 -2
  59. package/src/cli/compareNames.ts +13 -0
  60. package/src/cli/formatNamesFile.ts +13 -0
  61. package/src/cli/list-names.ts +94 -0
  62. package/src/cli/merge-names-files.ts +18 -0
  63. package/src/cli/parse-survey.ts +3 -2
  64. package/src/cli/parseNamesFile.ts +10 -0
  65. package/src/cli/readFile.ts +6 -0
  66. package/src/cli/replace-names.ts +41 -0
  67. package/src/cli/{summarize-survey.ts → summarize.ts} +2 -2
  68. package/src/cli.ts +67 -7
  69. package/src/index.ts +22 -7
  70. package/src/replaceRanges.ts +21 -0
  71. package/src/survey/FrcsSurveyFile.ts +1 -0
  72. package/src/survey/ZodFrcsSurveyFileJson.ts +1 -0
  73. package/src/survey/formatFrcsShot.ts +5 -7
  74. package/src/survey/normalizeTeamMemberName.ts +15 -3
  75. package/src/survey/parseFrcsSurveyFile.ts +193 -8
  76. package/string/index.d.ts +1 -1
  77. package/string/index.d.ts.map +1 -1
  78. package/survey/FrcsSurveyFile.d.ts +1 -0
  79. package/survey/FrcsSurveyFile.d.ts.map +1 -1
  80. package/survey/FrcsSurveyFile.js.map +1 -1
  81. package/survey/ZodFrcsSurveyFileJson.d.ts +283 -280
  82. package/survey/ZodFrcsSurveyFileJson.d.ts.map +1 -1
  83. package/survey/ZodFrcsSurveyFileJson.js +2 -1
  84. package/survey/ZodFrcsSurveyFileJson.js.map +1 -1
  85. package/survey/ZodFrcsSurveyFileToJson.d.ts +280 -280
  86. package/survey/formatFrcsShot.d.ts.map +1 -1
  87. package/survey/formatFrcsShot.js +3 -4
  88. package/survey/formatFrcsShot.js.map +1 -1
  89. package/survey/normalizeTeamMemberName.d.ts +1 -0
  90. package/survey/normalizeTeamMemberName.d.ts.map +1 -1
  91. package/survey/normalizeTeamMemberName.js +11 -1
  92. package/survey/normalizeTeamMemberName.js.map +1 -1
  93. package/survey/parseFrcsSurveyFile.d.ts +1 -1
  94. package/survey/parseFrcsSurveyFile.d.ts.map +1 -1
  95. package/survey/parseFrcsSurveyFile.js +128 -12
  96. package/survey/parseFrcsSurveyFile.js.map +1 -1
  97. package/cli/check-survey-correspondence.d.ts.map +0 -1
  98. package/cli/check-survey-correspondence.js.map +0 -1
  99. package/cli/check-survey.d.ts.map +0 -1
  100. package/cli/check-survey.js.map +0 -1
  101. package/cli/summarize-survey.d.ts.map +0 -1
  102. package/cli/summarize-survey.js.map +0 -1
package/src/index.ts CHANGED
@@ -3,29 +3,44 @@ import type {
3
3
  FrcsSurveyFile,
4
4
  FrcsTrip,
5
5
  FrcsTripHeader,
6
+ InvalidFrcsShot,
7
+ InvalidFrcsSurveyFile,
8
+ InvalidFrcsTrip,
9
+ InvalidFrcsTripHeader,
10
+ InvalidFrcsUnits,
6
11
  } from './survey/FrcsSurveyFile'
7
12
  import parseFrcsSurveyFile from './survey/parseFrcsSurveyFile'
8
- import { FrcsPlotShot } from './FrcsPlotShot'
9
- import { FrcsPlotFile } from './FrcsPlotFile'
13
+ import type { FrcsPlotShot } from './FrcsPlotShot'
14
+ import type { FrcsPlotFile } from './FrcsPlotFile'
10
15
  import parseFrcsPlotFile from './parseFrcsPlotFile'
11
- import { FrcsTripSummary } from './FrcsTripSummary'
12
- import { FrcsTripSummaryFile } from './FrcsTripSummaryFile'
16
+ import type { FrcsTripSummary } from './FrcsTripSummary'
17
+ import { type FrcsTripSummaryFile } from './FrcsTripSummaryFile'
13
18
  import parseFrcsTripSummaryFile from './parseFrcsTripSummaryFile'
14
19
  import formatFrcsShot from './survey/formatFrcsShot'
15
20
  import { formatFrcsSurveyFile } from './survey/formatFrcsSurveyFile'
21
+ import { formatIssues } from './formatIssues'
16
22
 
17
- export {
23
+ export type {
18
24
  FrcsShot,
19
25
  FrcsSurveyFile,
20
26
  FrcsTrip,
21
27
  FrcsTripHeader,
22
- parseFrcsSurveyFile,
28
+ InvalidFrcsShot,
29
+ InvalidFrcsSurveyFile,
30
+ InvalidFrcsTrip,
31
+ InvalidFrcsTripHeader,
32
+ InvalidFrcsUnits,
23
33
  FrcsPlotShot,
24
34
  FrcsPlotFile,
25
- parseFrcsPlotFile,
26
35
  FrcsTripSummary,
27
36
  FrcsTripSummaryFile,
37
+ }
38
+
39
+ export {
40
+ parseFrcsSurveyFile,
41
+ parseFrcsPlotFile,
28
42
  parseFrcsTripSummaryFile,
29
43
  formatFrcsShot,
30
44
  formatFrcsSurveyFile,
45
+ formatIssues,
31
46
  }
@@ -0,0 +1,21 @@
1
+ export function replaceRanges(
2
+ source: string,
3
+ replacements: { start: number; end: number; value: string }[]
4
+ ): string {
5
+ replacements.sort((a, b) => a.start - b.start)
6
+
7
+ const parts = []
8
+ let end = 0
9
+ for (const r of replacements) {
10
+ if (r.start > end) {
11
+ parts.push(source.substring(end, r.start))
12
+ }
13
+ parts.push(r.value)
14
+ end = r.end
15
+ }
16
+ if (end < source.length) {
17
+ parts.push(source.substring(end))
18
+ }
19
+
20
+ return parts.join('')
21
+ }
@@ -216,4 +216,5 @@ export type ParseFrcsSurveyFileOptions = {
216
216
  missingTripTeam?: boolean
217
217
  missingTripDate?: boolean
218
218
  }
219
+ includeLocs?: boolean
219
220
  }
@@ -266,6 +266,7 @@ export const ZodParseFrcsSurveyFileOptionsJson = z.object({
266
266
  .partial(),
267
267
  ])
268
268
  .optional(),
269
+ includeLocs: z.boolean().optional(),
269
270
  })
270
271
 
271
272
  ZodParseFrcsSurveyFileOptionsJson satisfies DeepMapJsonSchema<ParseFrcsSurveyFileOptions>
@@ -55,13 +55,11 @@ export function makeFormatFrcsShot({
55
55
  return formatNum(num.get(verbatim ? num.unit : unit || num.unit))
56
56
  }
57
57
  if (num == null || !Number.isFinite(num)) return ' '.repeat(width)
58
- const formatted = trimZeroes(num.toFixed(2))
59
- if (formatted.length <= width) return formatted.padStart(width, ' ')
60
- if (formatted.length > width + 2) return formatted.substring(0, width)
61
- return trimZeroes(num.toFixed(2 - formatted.length + width)).padStart(
62
- width,
63
- ' '
64
- )
58
+ const precision = Math.max(0, width - String(Math.trunc(num)).length - 1)
59
+ const formatted = trimZeroes(num.toFixed(precision))
60
+ return formatted.length <= width
61
+ ? formatted.padStart(width, ' ')
62
+ : formatted.substring(0, width)
65
63
  }
66
64
  return formatNum
67
65
  }
@@ -1,7 +1,19 @@
1
1
  export function normalizeTeamMemberName(name: string) {
2
- name = name.replace(/(\S)(\S*)/g, (match, head, tail) =>
3
- match.toUpperCase() === match ? `${head}${tail.toLowerCase()}` : match
4
- )
2
+ name = normalizeNameCapitalization(name)
5
3
  name = name.replace(/_/g, ' ')
6
4
  return name
7
5
  }
6
+
7
+ export function normalizeNameCapitalization(name: string) {
8
+ return name.replace(/([^. _]+)/g, (match) => {
9
+ if (match.toUpperCase() !== match) return match
10
+ if (/^(mc|.')/i.test(match)) {
11
+ return (
12
+ match.substring(0, 2) +
13
+ match[2].toUpperCase() +
14
+ match.substring(3).toLowerCase()
15
+ )
16
+ }
17
+ return match[0] + match.substring(1).toLowerCase()
18
+ })
19
+ }
@@ -9,6 +9,7 @@ import type {
9
9
  InvalidFrcsUnits,
10
10
  InvalidFrcsTrip,
11
11
  InvalidFrcsShot,
12
+ FrcsTripHeader,
12
13
  } from './FrcsSurveyFile'
13
14
  import { Angle, Length, UnitizedNumber, Unitize } from '@speleotica/unitized'
14
15
  import { ParseIssue, ParseIssueSeverity } from '../ParseIssue'
@@ -34,6 +35,7 @@ import {
34
35
  } from './parsers'
35
36
  import { normalizeTeamMemberName } from './normalizeTeamMemberName'
36
37
  import { unwrapInvalid } from '../unwrapInvalid'
38
+ import { SourceLoc } from '../SourceLoc'
37
39
 
38
40
  /**
39
41
  * Parses a raw cdata.fr survey file. These look like so:
@@ -88,6 +90,7 @@ export default async function parseFrcsSurveyFile(
88
90
  outputColumns = false,
89
91
  normalizeNames = true,
90
92
  suppressWarnings,
93
+ includeLocs,
91
94
  }: ParseFrcsSurveyFileOptions = {}
92
95
  ): Promise<FrcsSurveyFile | InvalidFrcsSurveyFile> {
93
96
  const columnRanges = getColumnRanges(columns)
@@ -98,11 +101,15 @@ export default async function parseFrcsSurveyFile(
98
101
  let cave: string | undefined = undefined
99
102
  let location: string | undefined = undefined
100
103
  const trips: (FrcsTrip | InvalidFrcsTrip)[] = []
104
+ const rootLocs: FrcsSurveyFile['locs'] = {}
101
105
  const issues: ParseIssue[] = []
102
106
 
103
107
  let tripName: string | undefined
108
+ let tripNameLoc: SourceLoc | undefined
104
109
  let tripTeam: string[] | undefined
110
+ let tripTeamLoc: SourceLoc[] | undefined
105
111
  let tripDate: Date | undefined
112
+ let tripDateLoc: SourceLoc | undefined
106
113
  let inTripComment = true
107
114
  let tripCommentStartLine = 1
108
115
  let tripCommentEndLine = -1
@@ -111,6 +118,7 @@ export default async function parseFrcsSurveyFile(
111
118
  let trip: FrcsTrip | InvalidFrcsTrip | undefined = undefined
112
119
  let inBlockComment = false
113
120
  let section
121
+ let sectionLoc: SourceLoc | undefined
114
122
  const commentFromStationLruds = new Map<
115
123
  string,
116
124
  NonNullable<FrcsShot['fromLruds']>
@@ -139,11 +147,25 @@ export default async function parseFrcsSurveyFile(
139
147
  if (/^\s+\*/.test(line)) {
140
148
  continue
141
149
  }
142
- const match = /^\s*([^,]+)(,(.*))?/.exec(line)
150
+ const match = /^\s*([^,]+)(,(.*))?/d.exec(line)
143
151
  if (match) {
144
152
  cave = match[1].trim()
153
+ if (includeLocs && match.indices) {
154
+ rootLocs.cave = makeLineLoc(
155
+ lineNumber,
156
+ lineStartIndex,
157
+ ...match.indices[1]
158
+ )
159
+ }
145
160
  if (match[3]) {
146
161
  location = match[3].trim()
162
+ if (includeLocs && match.indices) {
163
+ rootLocs.cave = makeLineLoc(
164
+ lineNumber,
165
+ lineStartIndex,
166
+ ...match.indices[3]
167
+ )
168
+ }
147
169
  }
148
170
  }
149
171
  }
@@ -157,9 +179,14 @@ export default async function parseFrcsSurveyFile(
157
179
  alternateUnits = nextShotUnits = undefined
158
180
  unitsChanged = false
159
181
  if (inTripComment) {
182
+ tripName = undefined
183
+ tripNameLoc = undefined
160
184
  section = undefined
185
+ sectionLoc = undefined
161
186
  tripTeam = undefined
187
+ tripTeamLoc = undefined
162
188
  tripDate = undefined
189
+ tripDateLoc = undefined
163
190
  tripComment.length = 0
164
191
  tripCommentStartLine = lineNumber
165
192
  } else {
@@ -167,17 +194,49 @@ export default async function parseFrcsSurveyFile(
167
194
  }
168
195
  } else if (inTripComment) {
169
196
  if (lineNumber === tripCommentStartLine + 1) {
170
- tripName = line && line.trim()
197
+ tripName = line.trim()
198
+ const startColumn = /\S/.exec(line)?.index ?? 0
199
+ const endColumn = startColumn + tripName.length
200
+ tripNameLoc = makeLineLoc(
201
+ lineNumber,
202
+ lineStartIndex,
203
+ startColumn,
204
+ endColumn
205
+ )
171
206
  } else if (lineNumber === tripCommentStartLine + 2) {
172
207
  const dateMatch =
173
- /(?:[-.]\s*)?((\d+)[-/](\d+)[-/](\d{2,4})|((\d+)[-/ ](january|february|march|april|may|june|july|august|september|october|november|december|(?:jan|feb|mar|apr|jun|jul|aug|sept?|oct|nov|dec)\.?)[-/ ](\d{2,4}))|((january|february|march|april|may|june|july|august|september|october|november|december|(?:jan|feb|mar|apr|jun|jul|aug|sept?|oct|nov|dec)\.?)\s+(\d+)(?:,\s*|,?\s+)(\d{2,4})))/i.exec(
208
+ /(?:[-.]\s*)?((\d+)[-/](\d+)[-/](\d{2,4})|((\d+)[-/ ](january|february|march|april|may|june|july|august|september|october|november|december|(?:jan|feb|mar|apr|jun|jul|aug|sept?|oct|nov|dec)\.?)[-/ ](\d{2,4}))|((january|february|march|april|may|june|july|august|september|october|november|december|(?:jan|feb|mar|apr|jun|jul|aug|sept?|oct|nov|dec)\.?)\s+(\d+)(?:,\s*|,?\s+)(\d{2,4})))/di.exec(
174
209
  line
175
210
  )
176
211
  if (dateMatch) {
177
- const team = line.substring(0, dateMatch.index)
178
- tripTeam = team
179
- .split(team.indexOf(';') >= 0 ? ';' : ',')
180
- .flatMap((member) => member.trim() || [])
212
+ const team = line.substring(0, dateMatch.index).replace(/\.?\s*$/, '')
213
+ tripTeam = []
214
+ tripTeamLoc = []
215
+ for (const match of team.matchAll(
216
+ team.includes(';')
217
+ ? /\s*([^;]+)\s*/dg
218
+ : team.includes(',')
219
+ ? /\s*([^,]+)\s*/dg
220
+ : team.includes('&')
221
+ ? /\s*([^&]+)\s*/dg
222
+ : /\S {2,}\S/.test(team)
223
+ ? /(\S+( \S+)*)/dg
224
+ : /(\S+( \S\.? )? \S{2,})/dg
225
+ )) {
226
+ const name = match[1].trim()
227
+ tripTeam.push(name)
228
+ if (includeLocs && match.indices) {
229
+ const index = match.indices[1][0]
230
+ tripTeamLoc.push(
231
+ makeLineLoc(
232
+ lineNumber,
233
+ lineStartIndex,
234
+ index,
235
+ index + name.length
236
+ )
237
+ )
238
+ }
239
+ }
181
240
  if (!tripTeam.length) {
182
241
  addIssue(
183
242
  'warning',
@@ -204,6 +263,13 @@ export default async function parseFrcsSurveyFile(
204
263
  year = parseInt(dateMatch[12])
205
264
  }
206
265
  tripDate = new Date(year < 60 ? year + 2000 : year, month - 1, day)
266
+ if (includeLocs && dateMatch.indices) {
267
+ tripDateLoc = makeLineLoc(
268
+ lineNumber,
269
+ lineStartIndex,
270
+ ...dateMatch.indices[1]
271
+ )
272
+ }
207
273
  } else {
208
274
  addIssue(
209
275
  'warning',
@@ -256,12 +322,23 @@ export default async function parseFrcsSurveyFile(
256
322
  addCommentLine(line)
257
323
  } else if (lineNumber === tripCommentEndLine + 1) {
258
324
  if (trip) trips.push(trip)
325
+ const comment = tripComment.join('\n') || undefined
326
+ const headerLocs: FrcsTripHeader['locs'] =
327
+ includeLocs && tripNameLoc
328
+ ? {
329
+ name: tripNameLoc,
330
+ date: tripDateLoc,
331
+ section: sectionLoc,
332
+ team: tripTeamLoc,
333
+ }
334
+ : undefined
259
335
  const header = {
260
336
  name: tripName || '',
261
- comment: (tripComment && tripComment.join('\n')) || undefined,
337
+ comment,
262
338
  section,
263
339
  date: tripDate,
264
340
  team: tripTeam,
341
+ ...(headerLocs && { locs: headerLocs }),
265
342
  }
266
343
  const units = parseUnits()
267
344
  if (
@@ -520,11 +597,23 @@ export default async function parseFrcsSurveyFile(
520
597
  validate(...ranges.backsightInclination, 'inclination', isValidOptFloat)
521
598
  frontsightInclination = parseNumber(incFsStr, inclinationUnit)
522
599
  backsightInclination = parseNumber(incBsStr, inclinationUnit)
600
+
601
+ validateInclinationRange(
602
+ frontsightInclination,
603
+ ...ranges.frontsightInclination
604
+ )
605
+ validateInclinationRange(
606
+ backsightInclination,
607
+ ...ranges.backsightInclination
608
+ )
523
609
  }
524
610
 
525
611
  const frontsightAzimuth = parseAzimuth(azmFsStr, azimuthUnit)
526
612
  const backsightAzimuth = parseAzimuth(azmBsStr, azimuthUnit)
527
613
 
614
+ validateAzimuthRange(frontsightAzimuth, ...ranges.frontsightAzimuth)
615
+ validateAzimuthRange(backsightAzimuth, ...ranges.backsightAzimuth)
616
+
528
617
  if (!/\S/.test(incFsStr) && !/\S/.test(incBsStr)) {
529
618
  frontsightInclination = Unitize.degrees(0)
530
619
  }
@@ -547,6 +636,9 @@ export default async function parseFrcsSurveyFile(
547
636
  },
548
637
  excludeDistance,
549
638
  comment,
639
+ ...(includeLocs && {
640
+ loc: makeLineLoc(lineNumber, lineStartIndex, 0, line.length),
641
+ }),
550
642
  }
551
643
  if (isSplay) shot.isSplay = true
552
644
  if (fromLruds) shot.fromLruds = fromLruds
@@ -571,6 +663,9 @@ export default async function parseFrcsSurveyFile(
571
663
  },
572
664
  excludeDistance,
573
665
  comment,
666
+ ...(includeLocs && {
667
+ loc: makeLineLoc(lineNumber, lineStartIndex, 0, line.length),
668
+ }),
574
669
  }
575
670
  if (isSplay) shot.isSplay = true
576
671
  if (fromLruds) shot.fromLruds = fromLruds
@@ -595,6 +690,7 @@ export default async function parseFrcsSurveyFile(
595
690
  location,
596
691
  trips,
597
692
  ...(issues.length ? { issues } : undefined),
693
+ ...(includeLocs && { locs: rootLocs }),
598
694
  }
599
695
  }
600
696
 
@@ -604,6 +700,7 @@ export default async function parseFrcsSurveyFile(
604
700
  columns: outputColumns ? columns : undefined,
605
701
  location,
606
702
  trips,
703
+ ...(includeLocs && { locs: rootLocs }),
607
704
  },
608
705
  issues,
609
706
  }
@@ -772,6 +869,74 @@ export default async function parseFrcsSurveyFile(
772
869
  return field
773
870
  }
774
871
 
872
+ function validateAzimuthRange(
873
+ azimuth: UnitizedNumber<Angle> | undefined,
874
+ startColumn: number,
875
+ endColumn: number
876
+ ) {
877
+ if (!azimuth) return
878
+ const rawValue = azimuth.get(azimuth.unit)
879
+ let max = Infinity
880
+ switch (azimuth.unit) {
881
+ case Angle.degrees:
882
+ max = 360
883
+ break
884
+ case Angle.gradians:
885
+ max = 400
886
+ break
887
+ case Angle.radians:
888
+ max = Math.PI * 2
889
+ break
890
+ case Angle.milsNATO:
891
+ max = 6400
892
+ break
893
+ }
894
+ if (rawValue < 0 || rawValue >= max) {
895
+ addIssue(
896
+ 'error',
897
+ 'azimuthOutOfRange',
898
+ 'Azimuth out of range',
899
+ startColumn,
900
+ endColumn,
901
+ lineIssues
902
+ )
903
+ }
904
+ }
905
+
906
+ function validateInclinationRange(
907
+ inclination: UnitizedNumber<Angle> | undefined,
908
+ startColumn: number,
909
+ endColumn: number
910
+ ) {
911
+ if (!inclination) return
912
+ const rawValue = inclination.get(inclination.unit)
913
+ let max = Infinity
914
+ switch (inclination.unit) {
915
+ case Angle.degrees:
916
+ max = 90
917
+ break
918
+ case Angle.gradians:
919
+ max = 100
920
+ break
921
+ case Angle.radians:
922
+ max = Math.PI / 2
923
+ break
924
+ case Angle.milsNATO:
925
+ max = 1600
926
+ break
927
+ }
928
+ if (rawValue < -max || rawValue > max) {
929
+ addIssue(
930
+ 'error',
931
+ 'inclinationOutOfRange',
932
+ 'Inclination out of range',
933
+ startColumn,
934
+ endColumn,
935
+ lineIssues
936
+ )
937
+ }
938
+ }
939
+
775
940
  function addShot(shot: FrcsShot | InvalidFrcsShot) {
776
941
  if (!trip) return
777
942
  if (alternateUnits) {
@@ -860,3 +1025,23 @@ export default async function parseFrcsSurveyFile(
860
1025
  }
861
1026
  }
862
1027
  }
1028
+
1029
+ function makeLineLoc(
1030
+ line: number,
1031
+ lineStartIndex: number,
1032
+ startColumn: number,
1033
+ endColumn: number
1034
+ ): SourceLoc {
1035
+ return {
1036
+ start: {
1037
+ index: lineStartIndex + startColumn,
1038
+ line,
1039
+ column: startColumn,
1040
+ },
1041
+ end: {
1042
+ index: lineStartIndex + endColumn,
1043
+ line,
1044
+ column: endColumn,
1045
+ },
1046
+ }
1047
+ }
package/string/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const parseFrcsSurveyFile: (file: string, str: string, rest_0?: import("../survey/FrcsSurveyFile").ParseFrcsSurveyFileOptions | undefined) => Promise<import("..").FrcsSurveyFile | import("../survey/FrcsSurveyFile").InvalidFrcsSurveyFile>;
1
+ export declare const parseFrcsSurveyFile: (file: string, str: string, rest_0?: import("../survey/FrcsSurveyFile").ParseFrcsSurveyFileOptions | undefined) => Promise<import("..").FrcsSurveyFile | import("..").InvalidFrcsSurveyFile>;
2
2
  export declare const parseFrcsPlotFile: (file: string, str: string) => Promise<import("..").FrcsPlotFile>;
3
3
  export declare const parseFrcsTripSummaryFile: (file: string, str: string, rest_0?: {
4
4
  indexBy?: "tripNumber" | "occurrence";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/string/index.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,mBAAmB,SAHvB,MAAM,OAAO,MAAM,wLAG8C,CAAA;AAC1E,eAAO,MAAM,iBAAiB,SAfrB,MAAM,OAAO,MAAM,uCAeyC,CAAA;AACrE,eAAO,MAAM,wBAAwB,SAhB5B,MAAM,OAAO,MAAM;;2DAkB3B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/string/index.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,mBAAmB,SAHvB,MAAM,OAAO,MAAM,kKAG8C,CAAA;AAC1E,eAAO,MAAM,iBAAiB,SAfrB,MAAM,OAAO,MAAM,uCAeyC,CAAA;AACrE,eAAO,MAAM,wBAAwB,SAhB5B,MAAM,OAAO,MAAM;;2DAkB3B,CAAA"}
@@ -167,6 +167,7 @@ export type ParseFrcsSurveyFileOptions = {
167
167
  missingTripTeam?: boolean;
168
168
  missingTripDate?: boolean;
169
169
  };
170
+ includeLocs?: boolean;
170
171
  };
171
172
  export {};
172
173
  //# sourceMappingURL=FrcsSurveyFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FrcsSurveyFile.d.ts","sourceRoot":"","sources":["../../src/survey/FrcsSurveyFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1E,KAAK,OAAO,CAAC,CAAC,IAAI;IAChB,OAAO,EAAE,CAAC,CAAA;IACV;;;OAGG;IACH,MAAM,CAAC,EAAE,MA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,MAAM,CAAC,CAAA;KAC9B,CAAA;IACD,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,SAAS,CAAA;IACf,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,SAAS,CAAA;KACpB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG;IACpC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,YAAY,GAAG;QAAE,KAAK,CAAC,EAAE,SAAS,CAAA;KAAE,CAAA;CAChD,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,CACnC,OAAO,CACL,OAAO,CACL,QAAQ,EACR;IACE,QAAQ,CAAC,EACL,QAAQ,CAAC,UAAU,CAAC,GACpB,OAAO,CACL,OAAO,CAAC,YAAY,CAAC,GAAG;QAAE,KAAK,CAAC,EAAE,SAAS,GAAG,gBAAgB,CAAA;KAAE,CACjE,CAAA;CACN,CACF,CACF,CACF,CAAA;AAED,eAAO,MAAM,2BAA2B,EAAE,oBAgBzC,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,CAAC,EAAE,oBAAoB,CAAA;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,gBAAgB,CAAC,EACb,OAAO,GACP;QACE,eAAe,CAAC,EAAE,OAAO,CAAA;QACzB,eAAe,CAAC,EAAE,OAAO,CAAA;KAC1B,CAAA;IACL,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"FrcsSurveyFile.js","names":["defaultFrcsShotColumnConfig","exports","toStation","fromStation","distance","distanceFeet","distanceInches","kind","exclude","frontsightAzimuth","backsightAzimuth","frontsightInclination","backsightInclination","left","right","up","down"],"sources":["../../src/survey/FrcsSurveyFile.ts"],"sourcesContent":["import { ParseIssue } from '../ParseIssue'\nimport { SourceLoc } from '../SourceLoc'\nimport { Unit, Length, Angle, UnitizedNumber } from '@speleotica/unitized'\n\ntype Invalid<T> = {\n INVALID: T\n /**\n * An array of indexes of issues in {@link InvalidFrcsSurveyFile['issues']} within the\n * `INVALID` node\n */\n issues?: number[]\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype Prettify<T> = { [K in keyof T]: T[K] } & {}\n\ntype Replace<T, U> = Prettify<Omit<T, keyof U> & U>\n\nexport type FrcsSurveyFile = {\n cave?: string\n columns?: FrcsShotColumnConfig\n location?: string\n comment?: string\n trips: FrcsTrip[]\n locs?: {\n cave?: SourceLoc\n location?: SourceLoc\n comment?: SourceLoc\n }\n issues?: ParseIssue[]\n}\n\nexport type FrcsShotColumnConfig = {\n toStation: number\n fromStation: number\n distance: number\n distanceFeet: number\n distanceInches: number\n kind: number\n exclude: number\n frontsightAzimuth: number\n backsightAzimuth: number\n frontsightInclination: number\n backsightInclination: number\n left: number\n right: number\n up: number\n down: number\n}\n\nexport type InvalidFrcsSurveyFile = {\n INVALID: Replace<\n FrcsSurveyFile,\n {\n trips: (FrcsTrip | InvalidFrcsTrip)[]\n }\n >\n issues: ParseIssue[]\n}\n\nexport type FrcsUnits = {\n distanceUnit: Unit<Length>\n azimuthUnit: Unit<Angle>\n inclinationUnit: Unit<Angle>\n backsightAzimuthCorrected?: boolean\n backsightInclinationCorrected?: boolean\n hasBacksightAzimuth?: boolean\n hasBacksightInclination?: boolean\n loc?: SourceLoc\n locs?: {\n distanceUnit?: SourceLoc\n azimuthUnit?: SourceLoc\n inclinationUnit?: SourceLoc\n backsightAzimuthCorrected?: SourceLoc\n backsightInclinationCorrected?: SourceLoc\n hasBacksightAzimuth?: SourceLoc\n hasBacksightInclination?: SourceLoc\n }\n}\n\nexport type InvalidFrcsUnits = Invalid<Partial<FrcsUnits>>\n\nexport type FrcsTripHeader = {\n name: string\n comment?: string\n section?: string\n date?: Date\n team?: string[]\n loc?: SourceLoc\n locs?: {\n name: SourceLoc\n comment?: SourceLoc\n section?: SourceLoc\n date?: SourceLoc\n team?: SourceLoc[]\n }\n}\n\nexport type InvalidFrcsTripHeader = Invalid<Partial<FrcsTripHeader>>\n\nexport type FrcsTrip = {\n tripNumber: number\n header: FrcsTripHeader\n units: FrcsUnits\n shots: FrcsShot[]\n loc?: SourceLoc\n}\n\nexport type InvalidFrcsTrip = Invalid<\n Replace<\n FrcsTrip,\n {\n tripNumber?: number\n header: FrcsTripHeader | InvalidFrcsTripHeader\n units: FrcsUnits | InvalidFrcsUnits\n shots: (FrcsShot | InvalidFrcsShot)[]\n }\n >\n>\n\nexport type FrcsShotBase = {\n /**\n * Name of from station\n */\n from: string\n /**\n * Name of to station\n */\n to?: string\n specialKind?: 'horizontal' | 'diagonal'\n distance: UnitizedNumber<Length>\n horizontalDistance?: UnitizedNumber<Length>\n verticalDistance?: UnitizedNumber<Length>\n frontsightAzimuth?: UnitizedNumber<Angle>\n frontsightInclination?: UnitizedNumber<Angle>\n backsightAzimuth?: UnitizedNumber<Angle>\n backsightInclination?: UnitizedNumber<Angle>\n /**\n * LRUDs at from station\n */\n fromLruds?: {\n left?: UnitizedNumber<Length>\n right?: UnitizedNumber<Length>\n up?: UnitizedNumber<Length>\n down?: UnitizedNumber<Length>\n }\n /**\n * LRUDs at to station\n */\n toLruds?: {\n left?: UnitizedNumber<Length>\n right?: UnitizedNumber<Length>\n up?: UnitizedNumber<Length>\n down?: UnitizedNumber<Length>\n }\n excludeDistance?: boolean\n isSplay?: boolean\n comment?: string\n loc?: SourceLoc\n locs?: {\n comment?: SourceLoc\n }\n}\n\nexport type FrcsShot = FrcsShotBase & {\n /**\n * In the edge case that the surveyors changed measurement units or\n * corrected/uncorrected backsights in the middle of a trip, the measurements\n * will be normalized to the initial trip settings, and this field will contain\n * the actual values recorded, verbatim. The first shot of the group with\n * changed units will include the changed units.\n */\n recorded?: FrcsShotBase & { units?: FrcsUnits }\n}\n\nexport type InvalidFrcsShot = Invalid<\n Partial<\n Replace<\n FrcsShot,\n {\n recorded?:\n | FrcsShot['recorded']\n | Invalid<\n Partial<FrcsShotBase> & { units?: FrcsUnits | InvalidFrcsUnits }\n >\n }\n >\n >\n>\n\nexport const defaultFrcsShotColumnConfig: FrcsShotColumnConfig = {\n toStation: 5,\n fromStation: 5,\n distance: 6,\n distanceFeet: 4,\n distanceInches: 3,\n kind: 1,\n exclude: 1,\n frontsightAzimuth: 6,\n backsightAzimuth: 6,\n frontsightInclination: 5,\n backsightInclination: 5,\n left: 3,\n right: 3,\n up: 3,\n down: 3,\n}\n\nexport type ParseFrcsSurveyFileOptions = {\n columns?: FrcsShotColumnConfig\n outputColumns?: boolean\n normalizeNames?: boolean\n suppressWarnings?:\n | boolean\n | {\n missingTripTeam?: boolean\n missingTripDate?: boolean\n }\n}\n"],"mappings":";;;;;;AAaA;;AAiLO,MAAMA,2BAAiD,GAAAC,OAAA,CAAAD,2BAAA,GAAG;EAC/DE,SAAS,EAAE,CAAC;EACZC,WAAW,EAAE,CAAC;EACdC,QAAQ,EAAE,CAAC;EACXC,YAAY,EAAE,CAAC;EACfC,cAAc,EAAE,CAAC;EACjBC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,CAAC;EACVC,iBAAiB,EAAE,CAAC;EACpBC,gBAAgB,EAAE,CAAC;EACnBC,qBAAqB,EAAE,CAAC;EACxBC,oBAAoB,EAAE,CAAC;EACvBC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,EAAE,EAAE,CAAC;EACLC,IAAI,EAAE;AACR,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"FrcsSurveyFile.js","names":["defaultFrcsShotColumnConfig","exports","toStation","fromStation","distance","distanceFeet","distanceInches","kind","exclude","frontsightAzimuth","backsightAzimuth","frontsightInclination","backsightInclination","left","right","up","down"],"sources":["../../src/survey/FrcsSurveyFile.ts"],"sourcesContent":["import { ParseIssue } from '../ParseIssue'\nimport { SourceLoc } from '../SourceLoc'\nimport { Unit, Length, Angle, UnitizedNumber } from '@speleotica/unitized'\n\ntype Invalid<T> = {\n INVALID: T\n /**\n * An array of indexes of issues in {@link InvalidFrcsSurveyFile['issues']} within the\n * `INVALID` node\n */\n issues?: number[]\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype Prettify<T> = { [K in keyof T]: T[K] } & {}\n\ntype Replace<T, U> = Prettify<Omit<T, keyof U> & U>\n\nexport type FrcsSurveyFile = {\n cave?: string\n columns?: FrcsShotColumnConfig\n location?: string\n comment?: string\n trips: FrcsTrip[]\n locs?: {\n cave?: SourceLoc\n location?: SourceLoc\n comment?: SourceLoc\n }\n issues?: ParseIssue[]\n}\n\nexport type FrcsShotColumnConfig = {\n toStation: number\n fromStation: number\n distance: number\n distanceFeet: number\n distanceInches: number\n kind: number\n exclude: number\n frontsightAzimuth: number\n backsightAzimuth: number\n frontsightInclination: number\n backsightInclination: number\n left: number\n right: number\n up: number\n down: number\n}\n\nexport type InvalidFrcsSurveyFile = {\n INVALID: Replace<\n FrcsSurveyFile,\n {\n trips: (FrcsTrip | InvalidFrcsTrip)[]\n }\n >\n issues: ParseIssue[]\n}\n\nexport type FrcsUnits = {\n distanceUnit: Unit<Length>\n azimuthUnit: Unit<Angle>\n inclinationUnit: Unit<Angle>\n backsightAzimuthCorrected?: boolean\n backsightInclinationCorrected?: boolean\n hasBacksightAzimuth?: boolean\n hasBacksightInclination?: boolean\n loc?: SourceLoc\n locs?: {\n distanceUnit?: SourceLoc\n azimuthUnit?: SourceLoc\n inclinationUnit?: SourceLoc\n backsightAzimuthCorrected?: SourceLoc\n backsightInclinationCorrected?: SourceLoc\n hasBacksightAzimuth?: SourceLoc\n hasBacksightInclination?: SourceLoc\n }\n}\n\nexport type InvalidFrcsUnits = Invalid<Partial<FrcsUnits>>\n\nexport type FrcsTripHeader = {\n name: string\n comment?: string\n section?: string\n date?: Date\n team?: string[]\n loc?: SourceLoc\n locs?: {\n name: SourceLoc\n comment?: SourceLoc\n section?: SourceLoc\n date?: SourceLoc\n team?: SourceLoc[]\n }\n}\n\nexport type InvalidFrcsTripHeader = Invalid<Partial<FrcsTripHeader>>\n\nexport type FrcsTrip = {\n tripNumber: number\n header: FrcsTripHeader\n units: FrcsUnits\n shots: FrcsShot[]\n loc?: SourceLoc\n}\n\nexport type InvalidFrcsTrip = Invalid<\n Replace<\n FrcsTrip,\n {\n tripNumber?: number\n header: FrcsTripHeader | InvalidFrcsTripHeader\n units: FrcsUnits | InvalidFrcsUnits\n shots: (FrcsShot | InvalidFrcsShot)[]\n }\n >\n>\n\nexport type FrcsShotBase = {\n /**\n * Name of from station\n */\n from: string\n /**\n * Name of to station\n */\n to?: string\n specialKind?: 'horizontal' | 'diagonal'\n distance: UnitizedNumber<Length>\n horizontalDistance?: UnitizedNumber<Length>\n verticalDistance?: UnitizedNumber<Length>\n frontsightAzimuth?: UnitizedNumber<Angle>\n frontsightInclination?: UnitizedNumber<Angle>\n backsightAzimuth?: UnitizedNumber<Angle>\n backsightInclination?: UnitizedNumber<Angle>\n /**\n * LRUDs at from station\n */\n fromLruds?: {\n left?: UnitizedNumber<Length>\n right?: UnitizedNumber<Length>\n up?: UnitizedNumber<Length>\n down?: UnitizedNumber<Length>\n }\n /**\n * LRUDs at to station\n */\n toLruds?: {\n left?: UnitizedNumber<Length>\n right?: UnitizedNumber<Length>\n up?: UnitizedNumber<Length>\n down?: UnitizedNumber<Length>\n }\n excludeDistance?: boolean\n isSplay?: boolean\n comment?: string\n loc?: SourceLoc\n locs?: {\n comment?: SourceLoc\n }\n}\n\nexport type FrcsShot = FrcsShotBase & {\n /**\n * In the edge case that the surveyors changed measurement units or\n * corrected/uncorrected backsights in the middle of a trip, the measurements\n * will be normalized to the initial trip settings, and this field will contain\n * the actual values recorded, verbatim. The first shot of the group with\n * changed units will include the changed units.\n */\n recorded?: FrcsShotBase & { units?: FrcsUnits }\n}\n\nexport type InvalidFrcsShot = Invalid<\n Partial<\n Replace<\n FrcsShot,\n {\n recorded?:\n | FrcsShot['recorded']\n | Invalid<\n Partial<FrcsShotBase> & { units?: FrcsUnits | InvalidFrcsUnits }\n >\n }\n >\n >\n>\n\nexport const defaultFrcsShotColumnConfig: FrcsShotColumnConfig = {\n toStation: 5,\n fromStation: 5,\n distance: 6,\n distanceFeet: 4,\n distanceInches: 3,\n kind: 1,\n exclude: 1,\n frontsightAzimuth: 6,\n backsightAzimuth: 6,\n frontsightInclination: 5,\n backsightInclination: 5,\n left: 3,\n right: 3,\n up: 3,\n down: 3,\n}\n\nexport type ParseFrcsSurveyFileOptions = {\n columns?: FrcsShotColumnConfig\n outputColumns?: boolean\n normalizeNames?: boolean\n suppressWarnings?:\n | boolean\n | {\n missingTripTeam?: boolean\n missingTripDate?: boolean\n }\n includeLocs?: boolean\n}\n"],"mappings":";;;;;;AAaA;;AAiLO,MAAMA,2BAAiD,GAAAC,OAAA,CAAAD,2BAAA,GAAG;EAC/DE,SAAS,EAAE,CAAC;EACZC,WAAW,EAAE,CAAC;EACdC,QAAQ,EAAE,CAAC;EACXC,YAAY,EAAE,CAAC;EACfC,cAAc,EAAE,CAAC;EACjBC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,CAAC;EACVC,iBAAiB,EAAE,CAAC;EACpBC,gBAAgB,EAAE,CAAC;EACnBC,qBAAqB,EAAE,CAAC;EACxBC,oBAAoB,EAAE,CAAC;EACvBC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,EAAE,EAAE,CAAC;EACLC,IAAI,EAAE;AACR,CAAC","ignoreList":[]}