@speleotica/frcsdata 5.0.0-beta.1 → 5.0.0-beta.3
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/ParseIssue.js +4 -4
- package/ParseIssue.js.map +1 -1
- package/SourceLoc.js +5 -5
- package/SourceLoc.js.map +1 -1
- package/chunksToLines.js +29 -131
- package/chunksToLines.js.map +1 -1
- package/cli/check-survey-correspondence.d.ts +2 -0
- package/cli/check-survey-correspondence.d.ts.map +1 -0
- package/cli/check-survey-correspondence.js +44 -0
- package/cli/check-survey-correspondence.js.map +1 -0
- package/cli/check-survey.d.ts.map +1 -1
- package/cli/check-survey.js +14 -75
- package/cli/check-survey.js.map +1 -1
- package/cli/parse-survey.js +4 -26
- package/cli/parse-survey.js.map +1 -1
- package/cli/summarize-survey.d.ts +2 -0
- package/cli/summarize-survey.d.ts.map +1 -0
- package/cli/summarize-survey.js +33 -0
- package/cli/summarize-survey.js.map +1 -0
- package/cli.js +61 -72
- package/cli.js.map +1 -1
- package/formatFrcsTripSummaryFile.d.ts +3 -0
- package/formatFrcsTripSummaryFile.d.ts.map +1 -0
- package/formatFrcsTripSummaryFile.js +33 -0
- package/formatFrcsTripSummaryFile.js.map +1 -0
- package/formatIssues.d.ts +10 -0
- package/formatIssues.d.ts.map +1 -0
- package/formatIssues.js +52 -0
- package/formatIssues.js.map +1 -0
- package/index.js +13 -13
- package/node/index.d.ts +3 -1
- package/node/index.d.ts.map +1 -1
- package/node/index.js +5 -19
- package/node/index.js.map +1 -1
- package/package.json +1 -1
- package/parseFrcsPlotFile.js +112 -245
- package/parseFrcsPlotFile.js.map +1 -1
- package/parseFrcsTripSummaryFile.d.ts +3 -1
- package/parseFrcsTripSummaryFile.d.ts.map +1 -1
- package/parseFrcsTripSummaryFile.js +53 -119
- package/parseFrcsTripSummaryFile.js.map +1 -1
- package/src/cli/check-survey-correspondence.ts +49 -0
- package/src/cli/check-survey.ts +8 -69
- package/src/cli/summarize-survey.ts +28 -0
- package/src/cli.ts +33 -0
- package/src/formatFrcsTripSummaryFile.ts +45 -0
- package/src/formatIssues.ts +97 -0
- package/src/parseFrcsTripSummaryFile.ts +8 -2
- package/src/survey/FrcsSurveyFile.ts +3 -1
- package/src/survey/ZodFrcsSurveyFileJson.ts +15 -4
- package/src/survey/ZodFrcsSurveyFileToJson.ts +15 -4
- package/src/survey/normalizeTeamMemberName.ts +3 -6
- package/src/survey/parseFrcsSurveyFile.ts +9 -25
- package/src/survey/summarizeSurvey.ts +51 -0
- package/src/unwrapInvalid.ts +3 -0
- package/string/index.d.ts +3 -1
- package/string/index.d.ts.map +1 -1
- package/string/index.js +7 -41
- package/string/index.js.map +1 -1
- package/survey/FrcsSurveyFile.d.ts +1 -1
- package/survey/FrcsSurveyFile.d.ts.map +1 -1
- package/survey/FrcsSurveyFile.js +1 -1
- package/survey/FrcsSurveyFile.js.map +1 -1
- package/survey/ZodFrcsSurveyFileJson.d.ts +13083 -457
- package/survey/ZodFrcsSurveyFileJson.d.ts.map +1 -1
- package/survey/ZodFrcsSurveyFileJson.js +89 -87
- package/survey/ZodFrcsSurveyFileJson.js.map +1 -1
- package/survey/ZodFrcsSurveyFileToJson.d.ts +12860 -234
- package/survey/ZodFrcsSurveyFileToJson.d.ts.map +1 -1
- package/survey/ZodFrcsSurveyFileToJson.js +83 -89
- package/survey/ZodFrcsSurveyFileToJson.js.map +1 -1
- package/survey/formatFrcsShot.js +45 -43
- package/survey/formatFrcsShot.js.map +1 -1
- package/survey/formatFrcsSurveyFile.js +52 -130
- package/survey/formatFrcsSurveyFile.js.map +1 -1
- package/survey/getColumnRanges.js +11 -19
- package/survey/getColumnRanges.js.map +1 -1
- package/survey/normalizeTeamMemberName.d.ts.map +1 -1
- package/survey/normalizeTeamMemberName.js +1 -5
- package/survey/normalizeTeamMemberName.js.map +1 -1
- package/survey/parseFrcsSurveyFile.d.ts.map +1 -1
- package/survey/parseFrcsSurveyFile.js +560 -750
- package/survey/parseFrcsSurveyFile.js.map +1 -1
- package/survey/parsers.js +20 -20
- package/survey/parsers.js.map +1 -1
- package/survey/summarizeSurvey.d.ts +6 -0
- package/survey/summarizeSurvey.d.ts.map +1 -0
- package/survey/summarizeSurvey.js +58 -0
- package/survey/summarizeSurvey.js.map +1 -0
- package/underlineSource.js +9 -17
- package/underlineSource.js.map +1 -1
- package/unwrapInvalid.d.ts +4 -0
- package/unwrapInvalid.d.ts.map +1 -0
- package/unwrapInvalid.js +10 -0
- package/unwrapInvalid.js.map +1 -0
- package/web/index.js +56 -116
- package/web/index.js.map +1 -1
package/cli.js
CHANGED
|
@@ -1,83 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
6
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
7
4
|
var _yargs = _interopRequireDefault(require("yargs/yargs"));
|
|
8
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function
|
|
9
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
10
|
-
void (0, _yargs
|
|
5
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
6
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
7
|
+
void (0, _yargs.default)(process.argv.slice(2)).command({
|
|
11
8
|
command: 'check-survey <file>',
|
|
12
9
|
describe: 'check survey file for errors or warnings',
|
|
13
|
-
builder:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
file = _ref.file;
|
|
26
|
-
_context.next = 3;
|
|
27
|
-
return Promise.resolve().then(function () {
|
|
28
|
-
return _interopRequireWildcard(require("./cli/check-survey.js"));
|
|
29
|
-
});
|
|
30
|
-
case 3:
|
|
31
|
-
_yield$import = _context.sent;
|
|
32
|
-
checkSurvey = _yield$import.checkSurvey;
|
|
33
|
-
_context.next = 7;
|
|
34
|
-
return checkSurvey(file);
|
|
35
|
-
case 7:
|
|
36
|
-
case "end":
|
|
37
|
-
return _context.stop();
|
|
38
|
-
}
|
|
39
|
-
}, _callee);
|
|
40
|
-
}));
|
|
41
|
-
function handler(_x) {
|
|
42
|
-
return _handler.apply(this, arguments);
|
|
43
|
-
}
|
|
44
|
-
return handler;
|
|
45
|
-
}()
|
|
10
|
+
builder: yargs => yargs.positional('file', {
|
|
11
|
+
type: 'string',
|
|
12
|
+
demandOption: true
|
|
13
|
+
}),
|
|
14
|
+
handler: async ({
|
|
15
|
+
file
|
|
16
|
+
}) => {
|
|
17
|
+
const {
|
|
18
|
+
checkSurvey
|
|
19
|
+
} = await Promise.resolve().then(() => _interopRequireWildcard(require("./cli/check-survey.js")));
|
|
20
|
+
await checkSurvey(file);
|
|
21
|
+
}
|
|
46
22
|
}).command({
|
|
47
23
|
command: 'parse-survey <file>',
|
|
48
24
|
describe: 'parse survey file and output JSON parse tree',
|
|
49
|
-
builder:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
25
|
+
builder: yargs => yargs.positional('file', {
|
|
26
|
+
type: 'string',
|
|
27
|
+
demandOption: true
|
|
28
|
+
}),
|
|
29
|
+
handler: async ({
|
|
30
|
+
file
|
|
31
|
+
}) => {
|
|
32
|
+
const {
|
|
33
|
+
parseSurvey
|
|
34
|
+
} = await Promise.resolve().then(() => _interopRequireWildcard(require("./cli/parse-survey.js")));
|
|
35
|
+
await parseSurvey(file);
|
|
36
|
+
}
|
|
37
|
+
}).command({
|
|
38
|
+
command: 'summarize-survey <file>',
|
|
39
|
+
describe: 'parse survey file and output trip summaries',
|
|
40
|
+
builder: yargs => yargs.positional('file', {
|
|
41
|
+
type: 'string',
|
|
42
|
+
demandOption: true
|
|
43
|
+
}),
|
|
44
|
+
handler: async ({
|
|
45
|
+
file
|
|
46
|
+
}) => {
|
|
47
|
+
const {
|
|
48
|
+
summarizeSurvey
|
|
49
|
+
} = await Promise.resolve().then(() => _interopRequireWildcard(require("./cli/summarize-survey.js")));
|
|
50
|
+
await summarizeSurvey(file);
|
|
51
|
+
}
|
|
52
|
+
}).command({
|
|
53
|
+
command: 'check-survey-correspondence <surveyFile> <summaryFile>',
|
|
54
|
+
describe: 'parse survey file and output trip summaries',
|
|
55
|
+
builder: yargs => yargs.positional('surveyFile', {
|
|
56
|
+
type: 'string',
|
|
57
|
+
demandOption: true
|
|
58
|
+
}).positional('summaryFile', {
|
|
59
|
+
type: 'string',
|
|
60
|
+
demandOption: true
|
|
61
|
+
}),
|
|
62
|
+
handler: async ({
|
|
63
|
+
surveyFile,
|
|
64
|
+
summaryFile
|
|
65
|
+
}) => {
|
|
66
|
+
const {
|
|
67
|
+
checkSurveyCorrespondence
|
|
68
|
+
} = await Promise.resolve().then(() => _interopRequireWildcard(require("./cli/check-survey-correspondence.js")));
|
|
69
|
+
await checkSurveyCorrespondence(surveyFile, summaryFile);
|
|
70
|
+
}
|
|
82
71
|
}).demandCommand().argv;
|
|
83
72
|
//# sourceMappingURL=cli.js.map
|
package/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","names":["_yargs","_interopRequireDefault","require","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","
|
|
1
|
+
{"version":3,"file":"cli.js","names":["_yargs","_interopRequireDefault","require","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","yargs","process","argv","slice","command","describe","builder","positional","type","demandOption","handler","file","checkSurvey","Promise","resolve","then","parseSurvey","summarizeSurvey","surveyFile","summaryFile","checkSurveyCorrespondence","demandCommand"],"sources":["src/cli.ts"],"sourcesContent":["import yargs from 'yargs/yargs'\n\nvoid yargs(process.argv.slice(2))\n .command({\n command: 'check-survey <file>',\n describe: 'check survey file for errors or warnings',\n builder: (yargs) =>\n yargs.positional('file', {\n type: 'string',\n demandOption: true,\n }),\n handler: async ({ file }) => {\n const { checkSurvey } = await import('./cli/check-survey')\n await checkSurvey(file)\n },\n })\n .command({\n command: 'parse-survey <file>',\n describe: 'parse survey file and output JSON parse tree',\n builder: (yargs) =>\n yargs.positional('file', {\n type: 'string',\n demandOption: true,\n }),\n handler: async ({ file }) => {\n const { parseSurvey } = await import('./cli/parse-survey')\n await parseSurvey(file)\n },\n })\n .command({\n command: 'summarize-survey <file>',\n describe: 'parse survey file and output trip summaries',\n builder: (yargs) =>\n yargs.positional('file', {\n type: 'string',\n demandOption: true,\n }),\n handler: async ({ file }) => {\n const { summarizeSurvey } = await import('./cli/summarize-survey')\n await summarizeSurvey(file)\n },\n })\n .command({\n command: 'check-survey-correspondence <surveyFile> <summaryFile>',\n describe: 'parse survey file and output trip summaries',\n builder: (yargs) =>\n yargs\n .positional('surveyFile', {\n type: 'string',\n demandOption: true,\n })\n .positional('summaryFile', {\n type: 'string',\n demandOption: true,\n }),\n handler: async ({ surveyFile, summaryFile }) => {\n const { checkSurveyCorrespondence } = await import(\n './cli/check-survey-correspondence'\n )\n await checkSurveyCorrespondence(surveyFile, summaryFile)\n },\n })\n .demandCommand().argv\n"],"mappings":";;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA+B,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAI,wBAAAJ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAM,OAAA,EAAAN,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAI,GAAA,CAAAP,CAAA,UAAAG,CAAA,CAAAK,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAf,CAAA,oBAAAe,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAe,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,C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csTripSummaryFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAI9D,wBAAiB,yBAAyB,CACxC,IAAI,EAAE,mBAAmB,GACxB,QAAQ,CAAC,MAAM,CAAC,CAqClB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.formatFrcsTripSummaryFile = formatFrcsTripSummaryFile;
|
|
7
|
+
var _unitized = require("@speleotica/unitized");
|
|
8
|
+
const nameLength = 78;
|
|
9
|
+
function* formatFrcsTripSummaryFile(file) {
|
|
10
|
+
for (const summary of file.tripSummaries) {
|
|
11
|
+
if (!summary) continue;
|
|
12
|
+
const {
|
|
13
|
+
tripNumber,
|
|
14
|
+
date,
|
|
15
|
+
totalLength,
|
|
16
|
+
numShots,
|
|
17
|
+
name,
|
|
18
|
+
excludedLength,
|
|
19
|
+
numExcludedShots,
|
|
20
|
+
team,
|
|
21
|
+
shots
|
|
22
|
+
} = summary;
|
|
23
|
+
const month = (date.getMonth() + 1).toFixed();
|
|
24
|
+
const day = date.getDate().toFixed();
|
|
25
|
+
const year = date.getFullYear().toFixed();
|
|
26
|
+
yield `${tripNumber.toFixed().padStart(3)} ${month.padStart(2)}/${day.padStart(2)}/${year.padStart(4)}${totalLength.get(_unitized.Length.feet).toFixed(2).padStart(10)}${numShots.toFixed().padStart(5)} ${name.slice(0, nameLength).padEnd(nameLength)} EXCLUDED:${excludedLength.get(_unitized.Length.feet).toFixed(2).padStart(7)}${numExcludedShots.toFixed().padStart(3)}`;
|
|
27
|
+
yield ' '.repeat(tripNumber >= 1000 ? 34 : 33) + team.join(' ');
|
|
28
|
+
for (let i = 0; i < shots.length; i += 4) {
|
|
29
|
+
yield ' '.repeat(tripNumber >= 1000 ? 36 : 35) + shots.slice(i, i + 4).map(s => s.padEnd(14)).join('');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=formatFrcsTripSummaryFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatFrcsTripSummaryFile.js","names":["_unitized","require","nameLength","formatFrcsTripSummaryFile","file","summary","tripSummaries","tripNumber","date","totalLength","numShots","name","excludedLength","numExcludedShots","team","shots","month","getMonth","toFixed","day","getDate","year","getFullYear","padStart","get","Length","feet","slice","padEnd","repeat","join","i","length","map","s"],"sources":["src/formatFrcsTripSummaryFile.ts"],"sourcesContent":["import { Length } from '@speleotica/unitized'\nimport { FrcsTripSummaryFile } from './FrcsTripSummaryFile.js'\n\nconst nameLength = 78\n\nexport function* formatFrcsTripSummaryFile(\n file: FrcsTripSummaryFile\n): Iterable<string> {\n for (const summary of file.tripSummaries) {\n if (!summary) continue\n const {\n tripNumber,\n date,\n totalLength,\n numShots,\n name,\n excludedLength,\n numExcludedShots,\n team,\n shots,\n } = summary\n const month = (date.getMonth() + 1).toFixed()\n const day = date.getDate().toFixed()\n const year = date.getFullYear().toFixed()\n yield `${tripNumber.toFixed().padStart(3)} ${month.padStart(\n 2\n )}/${day.padStart(2)}/${year.padStart(4)}${totalLength\n .get(Length.feet)\n .toFixed(2)\n .padStart(10)}${numShots.toFixed().padStart(5)} ${name\n .slice(0, nameLength)\n .padEnd(nameLength)} EXCLUDED:${excludedLength\n .get(Length.feet)\n .toFixed(2)\n .padStart(7)}${numExcludedShots.toFixed().padStart(3)}`\n yield ' '.repeat(tripNumber >= 1000 ? 34 : 33) + team.join(' ')\n for (let i = 0; i < shots.length; i += 4) {\n yield ' '.repeat(tripNumber >= 1000 ? 36 : 35) +\n shots\n .slice(i, i + 4)\n .map((s) => s.padEnd(14))\n .join('')\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAGA,MAAMC,UAAU,GAAG,EAAE;AAEd,UAAUC,yBAAyBA,CACx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AAM,CAACtB,UAAU,IAAI,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,GAAGO,IAAI,CAACgB,IAAI,CAAC,IAAI,CAAC;IAChE,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGhB,KAAK,CAACiB,MAAM,EAAED,CAAC,IAAI,CAAC,EAAE;MACxC,MAAM,GAAG,CAACF,MAAM,CAACtB,UAAU,IAAI,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,GAC5CQ,KAAK,CACFY,KAAK,CAACI,CAAC,EAAEA,CAAC,GAAG,CAAC,CAAC,CACfE,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACN,MAAM,CAAC,EAAE,CAAC,CAAC,CACxBE,IAAI,CAAC,EAAE,CAAC;IACf;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FrcsSurveyFile, InvalidFrcsSurveyFile } from './survey/FrcsSurveyFile';
|
|
2
|
+
import { FrcsSurveyFileJson, InvalidFrcsSurveyFileJson } from './survey/FrcsSurveyFileJson.js';
|
|
3
|
+
export declare function formatIssues({ parsed, source, file, errorStyle, warningStyle, }: {
|
|
4
|
+
parsed: FrcsSurveyFile | InvalidFrcsSurveyFile | FrcsSurveyFileJson | InvalidFrcsSurveyFileJson;
|
|
5
|
+
source: string;
|
|
6
|
+
file: string;
|
|
7
|
+
errorStyle?: (s: string) => string;
|
|
8
|
+
warningStyle?: (s: string) => string;
|
|
9
|
+
}): string;
|
|
10
|
+
//# sourceMappingURL=formatIssues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatIssues.d.ts","sourceRoot":"","sources":["src/formatIssues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/E,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,gCAAgC,CAAA;AAIvC,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,MAAM,EACN,IAAI,EACJ,UAAqB,EACrB,YAAuB,GACxB,EAAE;IACD,MAAM,EACF,cAAc,GACd,qBAAqB,GACrB,kBAAkB,GAClB,yBAAyB,CAAA;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IAClC,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CACrC,UAwEA"}
|
package/formatIssues.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.formatIssues = formatIssues;
|
|
7
|
+
var _underlineSource = require("./underlineSource.js");
|
|
8
|
+
var _unwrapInvalid = require("./unwrapInvalid.js");
|
|
9
|
+
function formatIssues({
|
|
10
|
+
parsed,
|
|
11
|
+
source,
|
|
12
|
+
file,
|
|
13
|
+
errorStyle = s => s,
|
|
14
|
+
warningStyle = s => s
|
|
15
|
+
}) {
|
|
16
|
+
const issues = parsed.issues || [];
|
|
17
|
+
const lines = [];
|
|
18
|
+
for (const issue of issues) {
|
|
19
|
+
const {
|
|
20
|
+
type,
|
|
21
|
+
loc,
|
|
22
|
+
message
|
|
23
|
+
} = issue;
|
|
24
|
+
const style = type === 'error' ? errorStyle : warningStyle;
|
|
25
|
+
lines.push(`${style(`${type === 'error' ? errorStyle('✘') : warningStyle('⚠')} ${`${type[0].toUpperCase()}${type.substring(1)}:`.padEnd(8)} ${message?.padEnd(40)}`)} (${file}:${loc?.start?.line}:${loc?.start?.column})`);
|
|
26
|
+
if (loc) {
|
|
27
|
+
lines.push((0, _underlineSource.underlineSource)(source, loc, {
|
|
28
|
+
underlineStyle: style
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const errorCount = issues.reduce((count, i) => i.type === 'error' ? count + 1 : count, 0);
|
|
33
|
+
const warningCount = issues.reduce((count, i) => i.type === 'warning' ? count + 1 : count, 0);
|
|
34
|
+
const trips = (0, _unwrapInvalid.unwrapInvalid)(parsed).trips;
|
|
35
|
+
const tripCount = trips.length;
|
|
36
|
+
const shotCount = trips.reduce((count, trip) => count + (0, _unwrapInvalid.unwrapInvalid)(trip).shots.length, 0);
|
|
37
|
+
const fmtErrorCount = `✘ ${errorCount}`;
|
|
38
|
+
const fmtWarningCount = `⚠ ${warningCount}`;
|
|
39
|
+
const fmtTripCount = `${tripCount}`;
|
|
40
|
+
const fmtShotCount = `${shotCount}`;
|
|
41
|
+
const countWidth = Math.max(fmtErrorCount.length, fmtWarningCount.length, fmtTripCount.length, fmtShotCount.length);
|
|
42
|
+
if (errorCount) {
|
|
43
|
+
lines.push(errorStyle(`${fmtErrorCount.padStart(countWidth)} error${errorCount === 1 ? '' : 's'}`));
|
|
44
|
+
}
|
|
45
|
+
if (warningCount) {
|
|
46
|
+
lines.push(warningStyle(`${fmtWarningCount.padStart(countWidth)} warning${warningCount === 1 ? '' : 's'}`));
|
|
47
|
+
}
|
|
48
|
+
lines.push(`${fmtTripCount.padStart(countWidth)} trip${tripCount === 1 ? '' : 's'}`);
|
|
49
|
+
lines.push(`${fmtShotCount.padStart(countWidth)} shot${shotCount === 1 ? '' : 's'}`);
|
|
50
|
+
return lines.join('\n');
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=formatIssues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatIssues.js","names":["_underlineSource","require","_unwrapInvalid","formatIssues","parsed","source","file","errorStyle","s","warningStyle","issues","lines","issue","type","loc","message","style","push","toUpperCase","substring","padEnd","start","line","column","underlineSource","underlineStyle","errorCount","reduce","count","i","warningCount","trips","unwrapInvalid","tripCount","length","shotCount","trip","shots","fmtErrorCount","fmtWarningCount","fmtTripCount","fmtShotCount","countWidth","Math","max","padStart","join"],"sources":["src/formatIssues.ts"],"sourcesContent":["import { FrcsSurveyFile, InvalidFrcsSurveyFile } from './survey/FrcsSurveyFile'\nimport {\n FrcsSurveyFileJson,\n InvalidFrcsSurveyFileJson,\n} from './survey/FrcsSurveyFileJson.js'\nimport { underlineSource } from './underlineSource'\nimport { unwrapInvalid } from './unwrapInvalid.js'\n\nexport function formatIssues({\n parsed,\n source,\n file,\n errorStyle = (s) => s,\n warningStyle = (s) => s,\n}: {\n parsed:\n | FrcsSurveyFile\n | InvalidFrcsSurveyFile\n | FrcsSurveyFileJson\n | InvalidFrcsSurveyFileJson\n source: string\n file: string\n errorStyle?: (s: string) => string\n warningStyle?: (s: string) => string\n}) {\n const issues = parsed.issues || []\n const lines: string[] = []\n for (const issue of issues) {\n const { type, loc, message } = issue\n const style = type === 'error' ? errorStyle : warningStyle\n lines.push(\n `${style(\n `${\n type === 'error' ? errorStyle('✘') : warningStyle('⚠')\n } ${`${type[0].toUpperCase()}${type.substring(1)}:`.padEnd(\n 8\n )} ${message?.padEnd(40)}`\n )} (${file}:${loc?.start?.line}:${loc?.start?.column})`\n )\n if (loc) {\n lines.push(underlineSource(source, loc, { underlineStyle: style }))\n }\n }\n\n const errorCount = issues.reduce(\n (count, i) => (i.type === 'error' ? count + 1 : count),\n 0\n )\n const warningCount = issues.reduce(\n (count, i) => (i.type === 'warning' ? count + 1 : count),\n 0\n )\n const trips = unwrapInvalid(parsed).trips\n const tripCount = trips.length\n const shotCount = trips.reduce(\n (count, trip) => count + unwrapInvalid(trip).shots.length,\n 0\n )\n\n const fmtErrorCount = `✘ ${errorCount}`\n const fmtWarningCount = `⚠ ${warningCount}`\n const fmtTripCount = `${tripCount}`\n const fmtShotCount = `${shotCount}`\n\n const countWidth = Math.max(\n fmtErrorCount.length,\n fmtWarningCount.length,\n fmtTripCount.length,\n fmtShotCount.length\n )\n\n if (errorCount) {\n lines.push(\n errorStyle(\n `${fmtErrorCount.padStart(countWidth)} error${\n errorCount === 1 ? '' : 's'\n }`\n )\n )\n }\n if (warningCount) {\n lines.push(\n warningStyle(\n `${fmtWarningCount.padStart(countWidth)} warning${\n warningCount === 1 ? '' : 's'\n }`\n )\n )\n }\n lines.push(\n `${fmtTripCount.padStart(countWidth)} trip${tripCount === 1 ? '' : 's'}`\n )\n lines.push(\n `${fmtShotCount.padStart(countWidth)} shot${shotCount === 1 ? '' : 's'}`\n )\n return lines.join('\\n')\n}\n"],"mappings":";;;;;;AAKA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEO,SAASE,YAAYA,CAAC;EAC3BC,MAAM;EACNC,MAAM;EACNC,IAAI;EACJC,UAAU,GAAIC,CAAC,IAAKA,CAAC;EACrBC,YAAY,GAAID,CAAC,IAAKA;AAWxB,CAAC,EAAE;EACD,MAAME,MAAM,GAAGN,MAAM,CAACM,MAAM,IAAI,EAAE;EAClC,MAAMC,KAAe,GAAG,EAAE;EAC1B,KAAK,MAAMC,KAAK,IAAIF,MAAM,EAAE;IAC1B,MAAM;MAAEG,IAAI;MAAEC,GAAG;MAAEC;IAAQ,CAAC,GAAGH,KAAK;IACpC,MAAMI,KAAK,GAAGH,IAAI,KAAK,OAAO,GAAGN,UAAU,GAAGE,YAAY;IAC1DE,KAAK,CAACM,IAAI,CACR,GAAGD,KAAK,CACN,GACEH,IAAI,KAAK,OAAO,GAAGN,UAAU,CAAC,GAAG,CAAC,GAAGE,YAAY,CAAC,GAAG,CAAC,IACpD,GAAGI,IAAI,CAAC,CAAC,CAAC,CAACK,WAAW,CAAC,CAAC,GAAGL,IAAI,CAACM,SAAS,CAAC,CAAC,CAAC,GAAG,CAACC,MAAM,CACxD,CACF,CAAC,IAAIL,OAAO,EAAEK,MAAM,CAAC,EAAE,CAAC,EAC1B,CAAC,KAAKd,IAAI,IAAIQ,GAAG,EAAEO,KAAK,EAAEC,IAAI,IAAIR,GAAG,EAAEO,KAAK,EAAEE,MAAM,GACtD,CA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AC,SACnChB,UAAU,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,EAE/B,CACF,CAAC;EACH;EACA,IAAII,YAAY,EAAE;IAChBnB,KAAK,CAACM,IAAI,CACRR,YAAY,CACV,GAAG8B,eAAe,CAACM,QAAQ,CAACH,UAAU,CAAC,WACrCZ,YAAY,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,EAEjC,CACF,CAAC;EACH;EACAnB,KAAK,CAACM,IAAI,CACR,GAAGuB,YAAY,CAACK,QAAQ,CAACH,UAAU,CAAC,QAAQT,SAAS,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,EACxE,CAAC;EACDtB,KAAK,CAACM,IAAI,CACR,GAAGwB,YAAY,CAACI,QAAQ,CAACH,UAAU,CAAC,QAAQP,SAAS,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,EACxE,CAAC;EACD,OAAOxB,KAAK,CAACmC,IAAI,CAAC,IAAI,CAAC;AACzB","ignoreList":[]}
|
package/index.js
CHANGED
|
@@ -6,56 +6,56 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
Object.defineProperty(exports, "FrcsPlotFile", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function
|
|
9
|
+
get: function () {
|
|
10
10
|
return _FrcsPlotFile.FrcsPlotFile;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "FrcsPlotShot", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function
|
|
15
|
+
get: function () {
|
|
16
16
|
return _FrcsPlotShot.FrcsPlotShot;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "FrcsTripSummary", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function
|
|
21
|
+
get: function () {
|
|
22
22
|
return _FrcsTripSummary.FrcsTripSummary;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "FrcsTripSummaryFile", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function
|
|
27
|
+
get: function () {
|
|
28
28
|
return _FrcsTripSummaryFile.FrcsTripSummaryFile;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "formatFrcsShot", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function
|
|
34
|
-
return _formatFrcsShot
|
|
33
|
+
get: function () {
|
|
34
|
+
return _formatFrcsShot.default;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "formatFrcsSurveyFile", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function
|
|
39
|
+
get: function () {
|
|
40
40
|
return _formatFrcsSurveyFile.formatFrcsSurveyFile;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "parseFrcsPlotFile", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function
|
|
46
|
-
return _parseFrcsPlotFile
|
|
45
|
+
get: function () {
|
|
46
|
+
return _parseFrcsPlotFile.default;
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "parseFrcsSurveyFile", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function
|
|
52
|
-
return _parseFrcsSurveyFile
|
|
51
|
+
get: function () {
|
|
52
|
+
return _parseFrcsSurveyFile.default;
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "parseFrcsTripSummaryFile", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function
|
|
58
|
-
return _parseFrcsTripSummaryFile
|
|
57
|
+
get: function () {
|
|
58
|
+
return _parseFrcsTripSummaryFile.default;
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
var _parseFrcsSurveyFile = _interopRequireDefault(require("./survey/parseFrcsSurveyFile.js"));
|
package/node/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const parseFrcsSurveyFile: (file: string, rest_0?: import("../survey/FrcsSurveyFile").ParseFrcsSurveyFileOptions | undefined) => Promise<import("..").FrcsSurveyFile | import("../survey/FrcsSurveyFile").InvalidFrcsSurveyFile>;
|
|
2
2
|
export declare const parseFrcsPlotFile: (file: string) => Promise<import("..").FrcsPlotFile>;
|
|
3
|
-
export declare const parseFrcsTripSummaryFile: (file: string
|
|
3
|
+
export declare const parseFrcsTripSummaryFile: (file: string, rest_0?: {
|
|
4
|
+
indexBy?: "tripNumber" | "occurrence";
|
|
5
|
+
} | undefined) => Promise<import("..").FrcsTripSummaryFile>;
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
package/node/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,mBAAmB,SAHvB,MAAM,wLAG2D,CAAA;AAC1E,eAAO,MAAM,iBAAiB,SAfrB,MAAM,uCAesD,CAAA;AACrE,eAAO,MAAM,wBAAwB,SAhB5B,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,mBAAmB,SAHvB,MAAM,wLAG2D,CAAA;AAC1E,eAAO,MAAM,iBAAiB,SAfrB,MAAM,uCAesD,CAAA;AACrE,eAAO,MAAM,wBAAwB,SAhB5B,MAAM;;2DAkBd,CAAA"}
|
package/node/index.js
CHANGED
|
@@ -10,23 +10,9 @@ var _readline = _interopRequireDefault(require("readline"));
|
|
|
10
10
|
var _parseFrcsSurveyFile2 = _interopRequireDefault(require("../survey/parseFrcsSurveyFile.js"));
|
|
11
11
|
var _parseFrcsPlotFile2 = _interopRequireDefault(require("../parseFrcsPlotFile.js"));
|
|
12
12
|
var _parseFrcsTripSummaryFile2 = _interopRequireDefault(require("../parseFrcsTripSummaryFile.js"));
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return fn.apply(void 0, [file, _readline["default"].createInterface(_fs["default"].createReadStream(file))].concat(rest));
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
var convertChunkBased = function convertChunkBased(fn) {
|
|
22
|
-
return function (file) {
|
|
23
|
-
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
24
|
-
rest[_key2 - 1] = arguments[_key2];
|
|
25
|
-
}
|
|
26
|
-
return fn.apply(void 0, [file, _fs["default"].createReadStream(file, 'utf8')].concat(rest));
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
var parseFrcsSurveyFile = exports.parseFrcsSurveyFile = convertChunkBased(_parseFrcsSurveyFile2["default"]);
|
|
30
|
-
var parseFrcsPlotFile = exports.parseFrcsPlotFile = convertLineBased(_parseFrcsPlotFile2["default"]);
|
|
31
|
-
var parseFrcsTripSummaryFile = exports.parseFrcsTripSummaryFile = convertLineBased(_parseFrcsTripSummaryFile2["default"]);
|
|
13
|
+
const convertLineBased = fn => (file, ...rest) => fn(file, _readline.default.createInterface(_fs.default.createReadStream(file)), ...rest);
|
|
14
|
+
const convertChunkBased = fn => (file, ...rest) => fn(file, _fs.default.createReadStream(file, 'utf8'), ...rest);
|
|
15
|
+
const parseFrcsSurveyFile = exports.parseFrcsSurveyFile = convertChunkBased(_parseFrcsSurveyFile2.default);
|
|
16
|
+
const parseFrcsPlotFile = exports.parseFrcsPlotFile = convertLineBased(_parseFrcsPlotFile2.default);
|
|
17
|
+
const parseFrcsTripSummaryFile = exports.parseFrcsTripSummaryFile = convertLineBased(_parseFrcsTripSummaryFile2.default);
|
|
32
18
|
//# sourceMappingURL=index.js.map
|
package/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_fs","_interopRequireDefault","require","_readline","_parseFrcsSurveyFile2","_parseFrcsPlotFile2","_parseFrcsTripSummaryFile2","convertLineBased","fn","file","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_fs","_interopRequireDefault","require","_readline","_parseFrcsSurveyFile2","_parseFrcsPlotFile2","_parseFrcsTripSummaryFile2","convertLineBased","fn","file","rest","readline","createInterface","fs","createReadStream","convertChunkBased","parseFrcsSurveyFile","exports","_parseFrcsSurveyFile","parseFrcsPlotFile","_parseFrcsPlotFile","parseFrcsTripSummaryFile","_parseFrcsTripSummaryFile"],"sources":["../../src/node/index.ts"],"sourcesContent":["import fs from 'fs'\nimport readline from 'readline'\nimport _parseFrcsSurveyFile from '../survey/parseFrcsSurveyFile'\nimport _parseFrcsPlotFile from '../parseFrcsPlotFile'\nimport _parseFrcsTripSummaryFile from '../parseFrcsTripSummaryFile'\n\nconst convertLineBased =\n <T, Rest extends any[]>(\n fn: (\n file: string,\n lines: AsyncIterable<string>,\n ...rest: Rest\n ) => Promise<T>\n ) =>\n (file: string, ...rest: Rest): Promise<T> =>\n fn(file, readline.createInterface(fs.createReadStream(file)), ...rest)\n\nconst convertChunkBased =\n <T, Rest extends any[]>(\n fn: (\n file: string,\n lines: AsyncIterable<string>,\n ...rest: Rest\n ) => Promise<T>\n ) =>\n (file: string, ...rest: Rest): Promise<T> =>\n fn(file, fs.createReadStream(file, 'utf8'), ...rest)\n\nexport const parseFrcsSurveyFile = convertChunkBased(_parseFrcsSurveyFile)\nexport const parseFrcsPlotFile = convertLineBased(_parseFrcsPlotFile)\nexport const parseFrcsTripSummaryFile = convertLineBased(\n _parseFrcsTripSummaryFile\n)\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,qBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,0BAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,MAAMK,gBAAgB,GAElBC,EAIe,IAEjB,CAACC,IAAY,EAAE,GAAGC,IAAU,KAC1BF,EAAE,CAACC,IAAI,EAAEE,iBAAQ,CAACC,eAAe,CAACC,WAAE,CAACC,gBAAgB,CAACL,IAAI,CAAC,CAAC,EAAE,GAAGC,IAAI,CAAC;AAE1E,MAAMK,iBAAiB,GAEnBP,EAIe,IAEjB,CAACC,IAAY,EAAE,GAAGC,IAAU,KAC1BF,EAAE,CAACC,IAAI,EAAEI,WAAE,CAACC,gBAAgB,CAACL,IAAI,EAAE,MAAM,CAAC,EAAE,GAAGC,IAAI,CAAC;AAEjD,MAAMM,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGD,iBAAiB,CAACG,6BAAoB,CAAC;AACnE,MAAMC,iBAAiB,GAAAF,OAAA,CAAAE,iBAAA,GAAGZ,gBAAgB,CAACa,2BAAkB,CAAC;AAC9D,MAAMC,wBAAwB,GAAAJ,OAAA,CAAAI,wBAAA,GAAGd,gBAAgB,CACtDe,kCACF,CAAC","ignoreList":[]}
|