@speleotica/frcsdata 4.3.1 → 5.0.0-beta.2

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 (172) hide show
  1. package/ParseIssue.d.ts +98 -0
  2. package/ParseIssue.d.ts.map +1 -0
  3. package/ParseIssue.js +17 -0
  4. package/ParseIssue.js.map +1 -0
  5. package/SourceLoc.d.ts +67 -0
  6. package/SourceLoc.d.ts.map +1 -0
  7. package/SourceLoc.js +18 -0
  8. package/SourceLoc.js.map +1 -0
  9. package/chunksToLines.d.ts +5 -0
  10. package/chunksToLines.d.ts.map +1 -0
  11. package/chunksToLines.js +37 -0
  12. package/chunksToLines.js.map +1 -0
  13. package/cli/check-survey-correspondence.d.ts +2 -0
  14. package/cli/check-survey-correspondence.d.ts.map +1 -0
  15. package/cli/check-survey-correspondence.js +44 -0
  16. package/cli/check-survey-correspondence.js.map +1 -0
  17. package/cli/check-survey.d.ts +2 -0
  18. package/cli/check-survey.d.ts.map +1 -0
  19. package/cli/check-survey.js +27 -0
  20. package/cli/check-survey.js.map +1 -0
  21. package/cli/parse-survey.d.ts +2 -0
  22. package/cli/parse-survey.d.ts.map +1 -0
  23. package/cli/parse-survey.js +15 -0
  24. package/cli/parse-survey.js.map +1 -0
  25. package/cli/summarize-survey.d.ts +2 -0
  26. package/cli/summarize-survey.d.ts.map +1 -0
  27. package/cli/summarize-survey.js +33 -0
  28. package/cli/summarize-survey.js.map +1 -0
  29. package/cli.d.ts +2 -0
  30. package/cli.d.ts.map +1 -0
  31. package/cli.js +72 -0
  32. package/cli.js.map +1 -0
  33. package/formatFrcsTripSummaryFile.d.ts +3 -0
  34. package/formatFrcsTripSummaryFile.d.ts.map +1 -0
  35. package/formatFrcsTripSummaryFile.js +33 -0
  36. package/formatFrcsTripSummaryFile.js.map +1 -0
  37. package/formatIssues.d.ts +10 -0
  38. package/formatIssues.d.ts.map +1 -0
  39. package/formatIssues.js +52 -0
  40. package/formatIssues.js.map +1 -0
  41. package/index.d.ts +5 -7
  42. package/index.d.ts.map +1 -1
  43. package/index.js +16 -49
  44. package/index.js.map +1 -1
  45. package/node/index.d.ts +4 -2
  46. package/node/index.d.ts.map +1 -1
  47. package/node/index.js +6 -12
  48. package/node/index.js.map +1 -1
  49. package/package.json +8 -6
  50. package/parseFrcsPlotFile.js +112 -245
  51. package/parseFrcsPlotFile.js.map +1 -1
  52. package/parseFrcsTripSummaryFile.d.ts +3 -1
  53. package/parseFrcsTripSummaryFile.d.ts.map +1 -1
  54. package/parseFrcsTripSummaryFile.js +53 -119
  55. package/parseFrcsTripSummaryFile.js.map +1 -1
  56. package/src/ParseIssue.ts +19 -0
  57. package/src/SourceLoc.ts +13 -0
  58. package/src/chunksToLines.ts +26 -0
  59. package/src/cli/check-survey-correspondence.ts +49 -0
  60. package/src/cli/check-survey.ts +23 -0
  61. package/src/cli/parse-survey.ts +10 -0
  62. package/src/cli/summarize-survey.ts +28 -0
  63. package/src/cli.ts +63 -0
  64. package/src/formatFrcsTripSummaryFile.ts +45 -0
  65. package/src/formatIssues.ts +97 -0
  66. package/src/index.ts +9 -7
  67. package/src/node/index.ts +18 -5
  68. package/src/parseFrcsTripSummaryFile.ts +8 -2
  69. package/src/string/index.ts +18 -5
  70. package/src/survey/FrcsSurveyFile.ts +217 -0
  71. package/src/survey/FrcsSurveyFileJson.ts +46 -0
  72. package/src/survey/ZodFrcsSurveyFileJson.ts +260 -0
  73. package/src/survey/ZodFrcsSurveyFileToJson.ts +297 -0
  74. package/src/{formatFrcsShot.ts → survey/formatFrcsShot.ts} +39 -22
  75. package/src/{formatFrcsSurveyFile.ts → survey/formatFrcsSurveyFile.ts} +4 -5
  76. package/src/survey/getColumnRanges.ts +82 -0
  77. package/src/survey/normalizeTeamMemberName.ts +7 -0
  78. package/src/survey/parseFrcsSurveyFile.ts +848 -0
  79. package/src/survey/parsers.ts +128 -0
  80. package/src/survey/summarizeSurvey.ts +51 -0
  81. package/src/survey/validators.ts +24 -0
  82. package/src/underlineSource.ts +34 -0
  83. package/src/unwrapInvalid.ts +3 -0
  84. package/src/web/index.ts +27 -21
  85. package/string/index.d.ts +4 -2
  86. package/string/index.d.ts.map +1 -1
  87. package/string/index.js +8 -34
  88. package/string/index.js.map +1 -1
  89. package/survey/FrcsSurveyFile.d.ts +172 -0
  90. package/survey/FrcsSurveyFile.d.ts.map +1 -0
  91. package/{FrcsSurveyFile.js → survey/FrcsSurveyFile.js} +3 -1
  92. package/survey/FrcsSurveyFile.js.map +1 -0
  93. package/survey/FrcsSurveyFileJson.d.ts +15 -0
  94. package/survey/FrcsSurveyFileJson.d.ts.map +1 -0
  95. package/{FrcsTrip.js → survey/FrcsSurveyFileJson.js} +1 -1
  96. package/survey/FrcsSurveyFileJson.js.map +1 -0
  97. package/survey/ZodFrcsSurveyFileJson.d.ts +60549 -0
  98. package/survey/ZodFrcsSurveyFileJson.d.ts.map +1 -0
  99. package/survey/ZodFrcsSurveyFileJson.js +186 -0
  100. package/survey/ZodFrcsSurveyFileJson.js.map +1 -0
  101. package/survey/ZodFrcsSurveyFileToJson.d.ts +60390 -0
  102. package/survey/ZodFrcsSurveyFileToJson.d.ts.map +1 -0
  103. package/survey/ZodFrcsSurveyFileToJson.js +209 -0
  104. package/survey/ZodFrcsSurveyFileToJson.js.map +1 -0
  105. package/{formatFrcsShot.d.ts → survey/formatFrcsShot.d.ts} +2 -3
  106. package/survey/formatFrcsShot.d.ts.map +1 -0
  107. package/survey/formatFrcsShot.js +107 -0
  108. package/survey/formatFrcsShot.js.map +1 -0
  109. package/survey/formatFrcsSurveyFile.d.ts +3 -0
  110. package/survey/formatFrcsSurveyFile.d.ts.map +1 -0
  111. package/survey/formatFrcsSurveyFile.js +87 -0
  112. package/survey/formatFrcsSurveyFile.js.map +1 -0
  113. package/survey/getColumnRanges.d.ts +24 -0
  114. package/survey/getColumnRanges.d.ts.map +1 -0
  115. package/survey/getColumnRanges.js +62 -0
  116. package/survey/getColumnRanges.js.map +1 -0
  117. package/survey/normalizeTeamMemberName.d.ts +2 -0
  118. package/survey/normalizeTeamMemberName.d.ts.map +1 -0
  119. package/survey/normalizeTeamMemberName.js +12 -0
  120. package/survey/normalizeTeamMemberName.js.map +1 -0
  121. package/{parseFrcsSurveyFile.d.ts → survey/parseFrcsSurveyFile.d.ts} +2 -5
  122. package/survey/parseFrcsSurveyFile.d.ts.map +1 -0
  123. package/survey/parseFrcsSurveyFile.js +626 -0
  124. package/survey/parseFrcsSurveyFile.js.map +1 -0
  125. package/survey/parsers.d.ts +11 -0
  126. package/survey/parsers.d.ts.map +1 -0
  127. package/survey/parsers.js +119 -0
  128. package/survey/parsers.js.map +1 -0
  129. package/survey/summarizeSurvey.d.ts +6 -0
  130. package/survey/summarizeSurvey.d.ts.map +1 -0
  131. package/survey/summarizeSurvey.js +58 -0
  132. package/survey/summarizeSurvey.js.map +1 -0
  133. package/survey/validators.d.ts +7 -0
  134. package/survey/validators.d.ts.map +1 -0
  135. package/survey/validators.js +36 -0
  136. package/survey/validators.js.map +1 -0
  137. package/underlineSource.d.ts +6 -0
  138. package/underlineSource.d.ts.map +1 -0
  139. package/underlineSource.js +22 -0
  140. package/underlineSource.js.map +1 -0
  141. package/unwrapInvalid.d.ts +4 -0
  142. package/unwrapInvalid.d.ts.map +1 -0
  143. package/unwrapInvalid.js +10 -0
  144. package/unwrapInvalid.js.map +1 -0
  145. package/web/index.d.ts +6 -6
  146. package/web/index.d.ts.map +1 -1
  147. package/web/index.js +60 -118
  148. package/web/index.js.map +1 -1
  149. package/FrcsShot.d.ts +0 -57
  150. package/FrcsShot.d.ts.map +0 -1
  151. package/FrcsShot.js +0 -13
  152. package/FrcsShot.js.map +0 -1
  153. package/FrcsSurveyFile.d.ts +0 -29
  154. package/FrcsSurveyFile.d.ts.map +0 -1
  155. package/FrcsSurveyFile.js.map +0 -1
  156. package/FrcsTrip.d.ts +0 -23
  157. package/FrcsTrip.d.ts.map +0 -1
  158. package/FrcsTrip.js.map +0 -1
  159. package/formatFrcsShot.d.ts.map +0 -1
  160. package/formatFrcsShot.js +0 -96
  161. package/formatFrcsShot.js.map +0 -1
  162. package/formatFrcsSurveyFile.d.ts +0 -3
  163. package/formatFrcsSurveyFile.d.ts.map +0 -1
  164. package/formatFrcsSurveyFile.js +0 -165
  165. package/formatFrcsSurveyFile.js.map +0 -1
  166. package/parseFrcsSurveyFile.d.ts.map +0 -1
  167. package/parseFrcsSurveyFile.js +0 -812
  168. package/parseFrcsSurveyFile.js.map +0 -1
  169. package/src/FrcsShot.ts +0 -56
  170. package/src/FrcsSurveyFile.ts +0 -47
  171. package/src/FrcsTrip.ts +0 -25
  172. package/src/parseFrcsSurveyFile.ts +0 -788
@@ -0,0 +1,217 @@
1
+ import { ParseIssue } from '../ParseIssue'
2
+ import { SourceLoc } from '../SourceLoc'
3
+ import { Unit, Length, Angle, UnitizedNumber } from '@speleotica/unitized'
4
+
5
+ type Invalid<T> = {
6
+ INVALID: T
7
+ /**
8
+ * An array of indexes of issues in {@link InvalidFrcsSurveyFile['issues']} within the
9
+ * `INVALID` node
10
+ */
11
+ issues?: number[]
12
+ }
13
+
14
+ // eslint-disable-next-line @typescript-eslint/ban-types
15
+ type Prettify<T> = { [K in keyof T]: T[K] } & {}
16
+
17
+ type Replace<T, U> = Prettify<Omit<T, keyof U> & U>
18
+
19
+ export type FrcsSurveyFile = {
20
+ cave?: string
21
+ columns?: FrcsShotColumnConfig
22
+ location?: string
23
+ comment?: string
24
+ trips: FrcsTrip[]
25
+ locs?: {
26
+ cave?: SourceLoc
27
+ location?: SourceLoc
28
+ comment?: SourceLoc
29
+ }
30
+ issues?: ParseIssue[]
31
+ }
32
+
33
+ export type FrcsShotColumnConfig = {
34
+ toStation: number
35
+ fromStation: number
36
+ distance: number
37
+ distanceFeet: number
38
+ distanceInches: number
39
+ kind: number
40
+ exclude: number
41
+ frontsightAzimuth: number
42
+ backsightAzimuth: number
43
+ frontsightInclination: number
44
+ backsightInclination: number
45
+ left: number
46
+ right: number
47
+ up: number
48
+ down: number
49
+ }
50
+
51
+ export type InvalidFrcsSurveyFile = {
52
+ INVALID: Replace<
53
+ FrcsSurveyFile,
54
+ {
55
+ trips: (FrcsTrip | InvalidFrcsTrip)[]
56
+ }
57
+ >
58
+ issues: ParseIssue[]
59
+ }
60
+
61
+ export type FrcsUnits = {
62
+ distanceUnit: Unit<Length>
63
+ azimuthUnit: Unit<Angle>
64
+ inclinationUnit: Unit<Angle>
65
+ backsightAzimuthCorrected?: boolean
66
+ backsightInclinationCorrected?: boolean
67
+ hasBacksightAzimuth?: boolean
68
+ hasBacksightInclination?: boolean
69
+ loc?: SourceLoc
70
+ locs?: {
71
+ distanceUnit?: SourceLoc
72
+ azimuthUnit?: SourceLoc
73
+ inclinationUnit?: SourceLoc
74
+ backsightAzimuthCorrected?: SourceLoc
75
+ backsightInclinationCorrected?: SourceLoc
76
+ hasBacksightAzimuth?: SourceLoc
77
+ hasBacksightInclination?: SourceLoc
78
+ }
79
+ }
80
+
81
+ export type InvalidFrcsUnits = Invalid<Partial<FrcsUnits>>
82
+
83
+ export type FrcsTripHeader = {
84
+ name: string
85
+ comment?: string
86
+ section?: string
87
+ date?: Date
88
+ team?: string[]
89
+ loc?: SourceLoc
90
+ locs?: {
91
+ name: SourceLoc
92
+ comment?: SourceLoc
93
+ section?: SourceLoc
94
+ date?: SourceLoc
95
+ team?: SourceLoc[]
96
+ }
97
+ }
98
+
99
+ export type InvalidFrcsTripHeader = Invalid<Partial<FrcsTripHeader>>
100
+
101
+ export type FrcsTrip = {
102
+ tripNumber: number
103
+ header: FrcsTripHeader
104
+ units: FrcsUnits
105
+ shots: FrcsShot[]
106
+ loc?: SourceLoc
107
+ }
108
+
109
+ export type InvalidFrcsTrip = Invalid<
110
+ Replace<
111
+ FrcsTrip,
112
+ {
113
+ tripNumber?: number
114
+ header: FrcsTripHeader | InvalidFrcsTripHeader
115
+ units: FrcsUnits | InvalidFrcsUnits
116
+ shots: (FrcsShot | InvalidFrcsShot)[]
117
+ }
118
+ >
119
+ >
120
+
121
+ export type FrcsShotBase = {
122
+ /**
123
+ * Name of from station
124
+ */
125
+ from: string
126
+ /**
127
+ * Name of to station
128
+ */
129
+ to?: string
130
+ specialKind?: 'horizontal' | 'diagonal'
131
+ distance: UnitizedNumber<Length>
132
+ horizontalDistance?: UnitizedNumber<Length>
133
+ verticalDistance?: UnitizedNumber<Length>
134
+ frontsightAzimuth?: UnitizedNumber<Angle>
135
+ frontsightInclination?: UnitizedNumber<Angle>
136
+ backsightAzimuth?: UnitizedNumber<Angle>
137
+ backsightInclination?: UnitizedNumber<Angle>
138
+ /**
139
+ * LRUDs at from station
140
+ */
141
+ fromLruds?: {
142
+ left?: UnitizedNumber<Length>
143
+ right?: UnitizedNumber<Length>
144
+ up?: UnitizedNumber<Length>
145
+ down?: UnitizedNumber<Length>
146
+ }
147
+ /**
148
+ * LRUDs at to station
149
+ */
150
+ toLruds?: {
151
+ left?: UnitizedNumber<Length>
152
+ right?: UnitizedNumber<Length>
153
+ up?: UnitizedNumber<Length>
154
+ down?: UnitizedNumber<Length>
155
+ }
156
+ excludeDistance?: boolean
157
+ isSplay?: boolean
158
+ comment?: string
159
+ loc?: SourceLoc
160
+ locs?: {
161
+ comment?: SourceLoc
162
+ }
163
+ }
164
+
165
+ export type FrcsShot = FrcsShotBase & {
166
+ /**
167
+ * In the edge case that the surveyors changed measurement units or
168
+ * corrected/uncorrected backsights in the middle of a trip, the measurements
169
+ * will be normalized to the initial trip settings, and this field will contain
170
+ * the actual values recorded, verbatim. The first shot of the group with
171
+ * changed units will include the changed units.
172
+ */
173
+ recorded?: FrcsShotBase & { units?: FrcsUnits }
174
+ }
175
+
176
+ export type InvalidFrcsShot = Invalid<
177
+ Partial<
178
+ Replace<
179
+ FrcsShot,
180
+ {
181
+ recorded?:
182
+ | FrcsShot['recorded']
183
+ | Invalid<Partial<FrcsShotBase> & { units?: InvalidFrcsUnits }>
184
+ }
185
+ >
186
+ >
187
+ >
188
+
189
+ export const defaultFrcsShotColumnConfig: FrcsShotColumnConfig = {
190
+ toStation: 5,
191
+ fromStation: 5,
192
+ distance: 6,
193
+ distanceFeet: 4,
194
+ distanceInches: 3,
195
+ kind: 1,
196
+ exclude: 1,
197
+ frontsightAzimuth: 6,
198
+ backsightAzimuth: 6,
199
+ frontsightInclination: 5,
200
+ backsightInclination: 5,
201
+ left: 3,
202
+ right: 3,
203
+ up: 3,
204
+ down: 3,
205
+ }
206
+
207
+ export type ParseFrcsSurveyFileOptions = {
208
+ columns?: FrcsShotColumnConfig
209
+ outputColumns?: boolean
210
+ normalizeNames?: boolean
211
+ suppressWarnings?:
212
+ | boolean
213
+ | {
214
+ missingTripTeam?: boolean
215
+ missingTripDate?: boolean
216
+ }
217
+ }
@@ -0,0 +1,46 @@
1
+ import {
2
+ FrcsSurveyFile,
3
+ InvalidFrcsSurveyFile,
4
+ ParseFrcsSurveyFileOptions,
5
+ } from './FrcsSurveyFile'
6
+
7
+ import { Unit, Length, Angle, UnitizedNumber } from '@speleotica/unitized'
8
+ import { ParseIssue } from '../ParseIssue'
9
+ import { SourceLoc } from '../SourceLoc'
10
+
11
+ export type JsonLengthUnit = 'm' | 'km' | 'cm' | 'ft' | 'mi' | 'yd' | 'in'
12
+ export type JsonAngleUnit = 'rad' | 'deg' | 'grad' | 'mil' | '%'
13
+
14
+ export type JsonLength = [number, JsonLengthUnit]
15
+ export type JsonAngle = [number, JsonAngleUnit]
16
+
17
+ export type DeepMapJson<T> = T extends
18
+ | string
19
+ | number
20
+ | boolean
21
+ | undefined
22
+ | ParseIssue
23
+ | SourceLoc
24
+ ? T
25
+ : T extends Date
26
+ ? string
27
+ : T extends readonly (infer E)[]
28
+ ? DeepMapJson<E>[]
29
+ : T extends Unit<Length>
30
+ ? JsonLengthUnit
31
+ : T extends Unit<Angle>
32
+ ? JsonAngleUnit
33
+ : T extends UnitizedNumber<Length>
34
+ ? JsonLength
35
+ : T extends UnitizedNumber<Angle>
36
+ ? JsonAngle
37
+ : {
38
+ [K in keyof T]: DeepMapJson<T[K]>
39
+ }
40
+
41
+ export type FrcsSurveyFileJson = DeepMapJson<FrcsSurveyFile>
42
+
43
+ export type InvalidFrcsSurveyFileJson = DeepMapJson<InvalidFrcsSurveyFile>
44
+
45
+ export type ParseFrcsSurveyFileOptionsJson =
46
+ DeepMapJson<ParseFrcsSurveyFileOptions>
@@ -0,0 +1,260 @@
1
+ import { Angle, Length, Unit, UnitizedNumber } from '@speleotica/unitized'
2
+ import z from 'zod'
3
+ import type { DeepMapJson } from './FrcsSurveyFileJson'
4
+ import type { SourceLoc } from '../SourceLoc'
5
+ import type {
6
+ FrcsShot,
7
+ FrcsSurveyFile,
8
+ FrcsTrip,
9
+ FrcsTripHeader,
10
+ FrcsUnits,
11
+ InvalidFrcsShot,
12
+ InvalidFrcsSurveyFile,
13
+ InvalidFrcsTrip,
14
+ InvalidFrcsTripHeader,
15
+ InvalidFrcsUnits,
16
+ ParseFrcsSurveyFileOptions,
17
+ } from './FrcsSurveyFile'
18
+ import { ParseIssue } from '../ParseIssue'
19
+
20
+ type DeepMapJsonSchema<T> = z.ZodType<DeepMapJson<T>>
21
+
22
+ const ZodLengthUnit = z.enum(['m', 'km', 'cm', 'ft', 'in', 'yd', 'mi'])
23
+
24
+ ZodLengthUnit satisfies DeepMapJsonSchema<Unit<Length>>
25
+
26
+ const ZodAngleUnit = z.enum(['deg', 'rad', 'grad', 'mil', '%'])
27
+
28
+ ZodAngleUnit satisfies DeepMapJsonSchema<Unit<Angle>>
29
+
30
+ const ZodLength = z.tuple([z.number(), ZodLengthUnit])
31
+
32
+ ZodLength satisfies DeepMapJsonSchema<UnitizedNumber<Length>>
33
+
34
+ const ZodAngle = z.tuple([z.number(), ZodAngleUnit])
35
+
36
+ ZodAngle satisfies DeepMapJsonSchema<UnitizedNumber<Angle>>
37
+
38
+ const ZodSourceLoc = z.strictObject({
39
+ start: z.strictObject({
40
+ index: z.number(),
41
+ line: z.number(),
42
+ column: z.number(),
43
+ }),
44
+ end: z.strictObject({
45
+ index: z.number(),
46
+ line: z.number(),
47
+ column: z.number(),
48
+ }),
49
+ })
50
+
51
+ ZodSourceLoc satisfies DeepMapJsonSchema<SourceLoc>
52
+
53
+ const ZodFrcsShotBase = z.strictObject({
54
+ from: z.string(),
55
+ to: z.string().optional(),
56
+ specialKind: z.enum(['horizontal', 'diagonal']).optional(),
57
+ distance: ZodLength,
58
+ horizontalDistance: ZodLength.optional(),
59
+ verticalDistance: ZodLength.optional(),
60
+ frontsightAzimuth: ZodAngle.optional(),
61
+ frontsightInclination: ZodAngle.optional(),
62
+ backsightAzimuth: ZodAngle.optional(),
63
+ backsightInclination: ZodAngle.optional(),
64
+ /**
65
+ * LRUDs at from station
66
+ */
67
+ fromLruds: z
68
+ .strictObject({
69
+ left: ZodLength.optional(),
70
+ right: ZodLength.optional(),
71
+ up: ZodLength.optional(),
72
+ down: ZodLength.optional(),
73
+ })
74
+ .optional(),
75
+ /**
76
+ * LRUDs at to station
77
+ */
78
+ toLruds: z
79
+ .strictObject({
80
+ left: ZodLength.optional(),
81
+ right: ZodLength.optional(),
82
+ up: ZodLength.optional(),
83
+ down: ZodLength.optional(),
84
+ })
85
+ .optional(),
86
+
87
+ excludeDistance: z
88
+ .boolean()
89
+ .optional()
90
+ .transform((b) => (b === false ? undefined : b)),
91
+ isSplay: z.boolean().optional(),
92
+ comment: z.string().optional(),
93
+ loc: ZodSourceLoc.optional(),
94
+ locs: z
95
+ .strictObject({
96
+ comment: ZodSourceLoc.optional(),
97
+ })
98
+ .optional(),
99
+ })
100
+
101
+ const ZodFrcsUnits = z.strictObject({
102
+ distanceUnit: ZodLengthUnit,
103
+ azimuthUnit: ZodAngleUnit,
104
+ inclinationUnit: ZodAngleUnit,
105
+ backsightAzimuthCorrected: z.boolean().optional(),
106
+ backsightInclinationCorrected: z.boolean().optional(),
107
+ hasBacksightAzimuth: z.boolean().optional(),
108
+ hasBacksightInclination: z.boolean().optional(),
109
+ loc: ZodSourceLoc.optional(),
110
+ locs: z
111
+ .strictObject({
112
+ distanceUnit: ZodSourceLoc.optional(),
113
+ azimuthUnit: ZodSourceLoc.optional(),
114
+ inclinationUnit: ZodSourceLoc.optional(),
115
+ backsightAzimuthCorrected: ZodSourceLoc.optional(),
116
+ backsightInclinationCorrected: ZodSourceLoc.optional(),
117
+ hasBacksightAzimuth: ZodSourceLoc.optional(),
118
+ hasBacksightInclination: ZodSourceLoc.optional(),
119
+ })
120
+ .optional(),
121
+ })
122
+
123
+ ZodFrcsUnits satisfies DeepMapJsonSchema<FrcsUnits>
124
+
125
+ const ZodFrcsShot = ZodFrcsShotBase.extend({
126
+ recorded: ZodFrcsShotBase.extend({
127
+ units: ZodFrcsUnits.optional(),
128
+ }).optional(),
129
+ })
130
+
131
+ ZodFrcsShot satisfies DeepMapJsonSchema<FrcsShot>
132
+
133
+ const ZodFrcsTripHeader = z.strictObject({
134
+ name: z.string(),
135
+ comment: z.string().optional(),
136
+ section: z.string().optional(),
137
+ date: z
138
+ .string()
139
+ .regex(/\d{4}-\d{2}-\d{2}/, 'must be in yyyy-mm-dd format')
140
+ .optional(),
141
+ team: z.array(z.string()).optional(),
142
+ loc: ZodSourceLoc.optional(),
143
+ locs: z
144
+ .strictObject({
145
+ name: ZodSourceLoc,
146
+ comment: ZodSourceLoc.optional(),
147
+ section: ZodSourceLoc.optional(),
148
+ date: ZodSourceLoc.optional(),
149
+ team: z.array(ZodSourceLoc).optional(),
150
+ })
151
+ .optional(),
152
+ })
153
+
154
+ ZodFrcsTripHeader satisfies DeepMapJsonSchema<FrcsTripHeader>
155
+
156
+ const ZodFrcsTrip = z.strictObject({
157
+ tripNumber: z.number().int().min(1),
158
+ header: ZodFrcsTripHeader,
159
+ units: ZodFrcsUnits,
160
+ shots: z.array(ZodFrcsShot),
161
+ loc: ZodSourceLoc.optional(),
162
+ })
163
+
164
+ ZodFrcsTrip satisfies DeepMapJsonSchema<FrcsTrip>
165
+
166
+ export const ZodFrcsShotColumnConfigJson = z.strictObject({
167
+ toStation: z.number(),
168
+ fromStation: z.number(),
169
+ distance: z.number(),
170
+ distanceFeet: z.number(),
171
+ distanceInches: z.number(),
172
+ kind: z.number(),
173
+ exclude: z.number(),
174
+ frontsightAzimuth: z.number(),
175
+ backsightAzimuth: z.number(),
176
+ frontsightInclination: z.number(),
177
+ backsightInclination: z.number(),
178
+ left: z.number(),
179
+ right: z.number(),
180
+ up: z.number(),
181
+ down: z.number(),
182
+ })
183
+
184
+ export const ZodFrcsSurveyFileJson = z.strictObject({
185
+ cave: z.string().optional(),
186
+ columns: ZodFrcsShotColumnConfigJson.optional(),
187
+ location: z.string().optional(),
188
+ comment: z.string().optional(),
189
+ trips: z.array(ZodFrcsTrip),
190
+ locs: z
191
+ .strictObject({
192
+ cave: ZodSourceLoc.optional(),
193
+ location: ZodSourceLoc.optional(),
194
+ comment: ZodSourceLoc.optional(),
195
+ })
196
+ .optional(),
197
+ issues: z.array(ParseIssue).optional(),
198
+ })
199
+
200
+ ZodFrcsSurveyFileJson satisfies DeepMapJsonSchema<FrcsSurveyFile>
201
+
202
+ function Invalid<T extends z.ZodTypeAny>(schema: T) {
203
+ return z.strictObject({
204
+ INVALID: schema,
205
+ issues: z.array(z.number()).optional(),
206
+ })
207
+ }
208
+
209
+ const ZodInvalidFrcsShot = Invalid(ZodFrcsShot.partial())
210
+
211
+ ZodInvalidFrcsShot satisfies DeepMapJsonSchema<InvalidFrcsShot>
212
+
213
+ const ZodInvalidFrcsUnits = Invalid(ZodFrcsUnits.partial())
214
+
215
+ ZodInvalidFrcsUnits satisfies DeepMapJsonSchema<InvalidFrcsUnits>
216
+
217
+ const ZodInvalidFrcsTripHeader = Invalid(ZodFrcsTripHeader.partial())
218
+
219
+ ZodInvalidFrcsTripHeader satisfies DeepMapJsonSchema<InvalidFrcsTripHeader>
220
+
221
+ const ZodInvalidFrcsTrip = Invalid(
222
+ z.strictObject({
223
+ tripNumber: z.number().int().min(1).optional(),
224
+ header: z.union([ZodInvalidFrcsTripHeader, ZodFrcsTripHeader]),
225
+ units: z.union([ZodInvalidFrcsUnits, ZodFrcsUnits]),
226
+ shots: z.array(z.union([ZodInvalidFrcsShot, ZodFrcsShot])),
227
+ })
228
+ )
229
+
230
+ ZodInvalidFrcsTrip satisfies DeepMapJsonSchema<InvalidFrcsTrip>
231
+
232
+ export const ZodInvalidFrcsSurveyFileJson = z.strictObject({
233
+ INVALID: ZodFrcsSurveyFileJson.extend({
234
+ trips: z.array(z.union([ZodInvalidFrcsTrip, ZodFrcsTrip])),
235
+ }),
236
+ issues: z.array(ParseIssue),
237
+ })
238
+
239
+ ZodInvalidFrcsSurveyFileJson satisfies DeepMapJsonSchema<InvalidFrcsSurveyFile>
240
+
241
+ export const ZodValidOrInvalidFrcsSurveyFileJson = z.union([
242
+ ZodInvalidFrcsSurveyFileJson,
243
+ ZodFrcsSurveyFileJson,
244
+ ])
245
+
246
+ export const ZodParseFrcsSurveyFileOptionsJson = z.object({
247
+ columns: ZodFrcsShotColumnConfigJson.optional(),
248
+ outputColumns: z.boolean().optional(),
249
+ normalizeNames: z.boolean().optional(),
250
+ suppressWarnings: z
251
+ .union([
252
+ z.boolean(),
253
+ z
254
+ .object({ missingTripTeam: z.boolean(), missingTripDate: z.boolean() })
255
+ .partial(),
256
+ ])
257
+ .optional(),
258
+ })
259
+
260
+ ZodParseFrcsSurveyFileOptionsJson satisfies DeepMapJsonSchema<ParseFrcsSurveyFileOptions>