ropegeo-common 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/types/api/getRopewikiPageView/ropewikiPageView.d.ts +6 -0
- package/dist/types/api/getRopewikiPageView/ropewikiPageView.d.ts.map +1 -1
- package/dist/types/api/getRopewikiPageView/ropewikiPageView.js +14 -0
- package/dist/types/api/getRopewikiPageView/ropewikiPageViewResult.d.ts.map +1 -1
- package/dist/types/api/getRopewikiPageView/ropewikiPageViewResult.js +3 -0
- package/dist/types/api/getRopewikiRegionImages/ropewikiRegionImagesResult.d.ts.map +1 -1
- package/dist/types/api/getRopewikiRegionImages/ropewikiRegionImagesResult.js +3 -0
- package/dist/types/api/getRopewikiRegionPreviews/ropewikiRegionPreviewsResult.d.ts.map +1 -1
- package/dist/types/api/getRopewikiRegionPreviews/ropewikiRegionPreviewsResult.js +3 -0
- package/dist/types/api/getRopewikiRegionView/ropewikiRegionViewResult.d.ts.map +1 -1
- package/dist/types/api/getRopewikiRegionView/ropewikiRegionViewResult.js +3 -0
- package/dist/types/api/getRoutePreview/routePreviewResult.d.ts.map +1 -1
- package/dist/types/api/getRoutePreview/routePreviewResult.js +3 -0
- package/dist/types/api/getRoutes/routesGeojsonResult.d.ts.map +1 -1
- package/dist/types/api/getRoutes/routesGeojsonResult.js +3 -0
- package/dist/types/api/listMapDataTileKeys/mapDataTileKeysResults.d.ts.map +1 -1
- package/dist/types/api/listMapDataTileKeys/mapDataTileKeysResults.js +3 -0
- package/dist/types/api/search/searchResults.d.ts.map +1 -1
- package/dist/types/api/search/searchResults.js +3 -0
- package/dist/types/mobile/imageVersions.d.ts +17 -0
- package/dist/types/mobile/imageVersions.d.ts.map +1 -0
- package/dist/types/mobile/imageVersions.js +37 -0
- package/dist/types/mobile/savedPage.d.ts +32 -0
- package/dist/types/mobile/savedPage.d.ts.map +1 -0
- package/dist/types/mobile/savedPage.js +155 -0
- package/dist/types/results/cursorPaginationResults.d.ts +7 -0
- package/dist/types/results/cursorPaginationResults.d.ts.map +1 -1
- package/dist/types/results/cursorPaginationResults.js +13 -13
- package/dist/types/results/paginationResults.d.ts +7 -0
- package/dist/types/results/paginationResults.d.ts.map +1 -1
- package/dist/types/results/paginationResults.js +13 -5
- package/dist/types/results/registerAllResultParsers.d.ts +14 -0
- package/dist/types/results/registerAllResultParsers.d.ts.map +1 -0
- package/dist/types/results/registerAllResultParsers.js +15 -0
- package/dist/types/results/result.d.ts +5 -0
- package/dist/types/results/result.d.ts.map +1 -1
- package/dist/types/results/result.js +13 -17
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import './types/results/registerAllResultParsers';
|
|
1
2
|
export { PageDataSource } from './types/pageDataSource';
|
|
2
3
|
export { Difficulty, DifficultyRisk, DifficultyTechnical, DifficultyTime, DifficultyWater } from './types/difficulty';
|
|
3
4
|
export { PermitStatus } from './types/permitStatus';
|
|
@@ -22,9 +23,9 @@ export type RopewikiImageView = import('./types/betaSections/betaSectionImage').
|
|
|
22
23
|
export type RopewikiBetaSectionView = import('./types/betaSections/betaSection').BetaSection;
|
|
23
24
|
export { Cursor, CursorType } from './types/cursors/cursor';
|
|
24
25
|
export { CursorPaginationParams } from './types/params/cursorPaginationParams';
|
|
25
|
-
export { Result, ResultType } from './types/results/result';
|
|
26
|
-
export { CursorPaginationResults, type ValidatedCursorPaginationResponse, CursorPaginationResultType, } from './types/results/cursorPaginationResults';
|
|
27
|
-
export { PaginationResults, type ValidatedPaginationResponse, PaginationResultType, } from './types/results/paginationResults';
|
|
26
|
+
export { Result, ResultType, registerResultParser } from './types/results/result';
|
|
27
|
+
export { CursorPaginationResults, type ValidatedCursorPaginationResponse, CursorPaginationResultType, registerCursorPaginationParser, } from './types/results/cursorPaginationResults';
|
|
28
|
+
export { PaginationResults, type ValidatedPaginationResponse, PaginationResultType, registerPaginationParser, } from './types/results/paginationResults';
|
|
28
29
|
export { MapDataTileKeysResults } from './types/api/listMapDataTileKeys/mapDataTileKeysResults';
|
|
29
30
|
export { SearchCursor } from './types/cursors/searchCursor';
|
|
30
31
|
export type { SearchCursorType } from './types/cursors/searchCursor';
|
|
@@ -42,4 +43,6 @@ export type { RopewikiRegionImageViewRow } from './types/api/getRopewikiRegionIm
|
|
|
42
43
|
export { RopewikiRegionImagesParams } from './types/api/getRopewikiRegionImages/ropewikiRegionImagesParams';
|
|
43
44
|
export { RopewikiRegionImagesResult } from './types/api/getRopewikiRegionImages/ropewikiRegionImagesResult';
|
|
44
45
|
export { RoutePreviewResult } from './types/api/getRoutePreview/routePreviewResult';
|
|
46
|
+
export { ImageVersions } from './types/mobile/imageVersions';
|
|
47
|
+
export { SavedPage } from './types/mobile/savedPage';
|
|
45
48
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,mBAAm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GED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RopewikiRegionImageView = exports.RegionImagesCursor = exports.RopewikiRegionPreviewsResult = exports.RopewikiRegionPreviewsParams = exports.RegionPreviewsCursor = exports.RopewikiRegionViewResult = exports.RopewikiRegionView = exports.SearchResults = exports.SearchParams = exports.SearchCursor = exports.MapDataTileKeysResults = exports.registerPaginationParser = exports.PaginationResultType = exports.PaginationResults = exports.registerCursorPaginationParser = exports.CursorPaginationResultType = exports.CursorPaginationResults = exports.registerResultParser = exports.ResultType = exports.Result = exports.CursorPaginationParams = exports.CursorType = exports.Cursor = exports.RopewikiPageViewResult = exports.RopewikiPageView = exports.PageMiniMap = exports.RegionMiniMap = exports.MiniMap = exports.MiniMapType = exports.Bounds = exports.BetaSection = exports.DownloadBytes = exports.BetaSectionImage = exports.RoutesParams = exports.RoutesGeojsonResult = exports.RoutesGeojson = exports.RouteType = exports.RouteGeoJsonFeature = exports.Route = exports.RegionPreview = exports.PagePreview = exports.PreviewType = exports.Preview = exports.PermitStatus = exports.DifficultyWater = exports.DifficultyTime = exports.DifficultyTechnical = exports.DifficultyRisk = exports.Difficulty = exports.PageDataSource = void 0;
|
|
4
|
+
exports.SavedPage = exports.ImageVersions = exports.RoutePreviewResult = exports.RopewikiRegionImagesResult = exports.RopewikiRegionImagesParams = void 0;
|
|
5
|
+
require("./types/results/registerAllResultParsers");
|
|
4
6
|
var pageDataSource_1 = require("./types/pageDataSource");
|
|
5
7
|
Object.defineProperty(exports, "PageDataSource", { enumerable: true, get: function () { return pageDataSource_1.PageDataSource; } });
|
|
6
8
|
var difficulty_1 = require("./types/difficulty");
|
|
@@ -56,12 +58,15 @@ Object.defineProperty(exports, "CursorPaginationParams", { enumerable: true, get
|
|
|
56
58
|
var result_1 = require("./types/results/result");
|
|
57
59
|
Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return result_1.Result; } });
|
|
58
60
|
Object.defineProperty(exports, "ResultType", { enumerable: true, get: function () { return result_1.ResultType; } });
|
|
61
|
+
Object.defineProperty(exports, "registerResultParser", { enumerable: true, get: function () { return result_1.registerResultParser; } });
|
|
59
62
|
var cursorPaginationResults_1 = require("./types/results/cursorPaginationResults");
|
|
60
63
|
Object.defineProperty(exports, "CursorPaginationResults", { enumerable: true, get: function () { return cursorPaginationResults_1.CursorPaginationResults; } });
|
|
61
64
|
Object.defineProperty(exports, "CursorPaginationResultType", { enumerable: true, get: function () { return cursorPaginationResults_1.CursorPaginationResultType; } });
|
|
65
|
+
Object.defineProperty(exports, "registerCursorPaginationParser", { enumerable: true, get: function () { return cursorPaginationResults_1.registerCursorPaginationParser; } });
|
|
62
66
|
var paginationResults_1 = require("./types/results/paginationResults");
|
|
63
67
|
Object.defineProperty(exports, "PaginationResults", { enumerable: true, get: function () { return paginationResults_1.PaginationResults; } });
|
|
64
68
|
Object.defineProperty(exports, "PaginationResultType", { enumerable: true, get: function () { return paginationResults_1.PaginationResultType; } });
|
|
69
|
+
Object.defineProperty(exports, "registerPaginationParser", { enumerable: true, get: function () { return paginationResults_1.registerPaginationParser; } });
|
|
65
70
|
var mapDataTileKeysResults_1 = require("./types/api/listMapDataTileKeys/mapDataTileKeysResults");
|
|
66
71
|
Object.defineProperty(exports, "MapDataTileKeysResults", { enumerable: true, get: function () { return mapDataTileKeysResults_1.MapDataTileKeysResults; } });
|
|
67
72
|
var searchCursor_1 = require("./types/cursors/searchCursor");
|
|
@@ -90,3 +95,7 @@ var ropewikiRegionImagesResult_1 = require("./types/api/getRopewikiRegionImages/
|
|
|
90
95
|
Object.defineProperty(exports, "RopewikiRegionImagesResult", { enumerable: true, get: function () { return ropewikiRegionImagesResult_1.RopewikiRegionImagesResult; } });
|
|
91
96
|
var routePreviewResult_1 = require("./types/api/getRoutePreview/routePreviewResult");
|
|
92
97
|
Object.defineProperty(exports, "RoutePreviewResult", { enumerable: true, get: function () { return routePreviewResult_1.RoutePreviewResult; } });
|
|
98
|
+
var imageVersions_1 = require("./types/mobile/imageVersions");
|
|
99
|
+
Object.defineProperty(exports, "ImageVersions", { enumerable: true, get: function () { return imageVersions_1.ImageVersions; } });
|
|
100
|
+
var savedPage_1 = require("./types/mobile/savedPage");
|
|
101
|
+
Object.defineProperty(exports, "SavedPage", { enumerable: true, get: function () { return savedPage_1.SavedPage; } });
|
|
@@ -3,6 +3,7 @@ import { PermitStatus } from '../../permitStatus';
|
|
|
3
3
|
import { BetaSection } from '../../betaSections/betaSection';
|
|
4
4
|
import { BetaSectionImage } from '../../betaSections/betaSectionImage';
|
|
5
5
|
import { MiniMap } from '../../minimap/miniMap';
|
|
6
|
+
import { PagePreview } from '../../previews/pagePreview';
|
|
6
7
|
type MinMax = {
|
|
7
8
|
min: number;
|
|
8
9
|
max: number;
|
|
@@ -52,6 +53,11 @@ export declare class RopewikiPageView {
|
|
|
52
53
|
* Validates result has RopewikiPageView fields and returns a RopewikiPageView instance.
|
|
53
54
|
*/
|
|
54
55
|
static fromResult(result: unknown): RopewikiPageView;
|
|
56
|
+
/**
|
|
57
|
+
* Maps this full page view to a PagePreview for persistence (saved pages).
|
|
58
|
+
* @param apiPageId Ropewiki page uuid from GET /ropewiki/page/{id}.
|
|
59
|
+
*/
|
|
60
|
+
toPagePreview(apiPageId: string): PagePreview;
|
|
55
61
|
private static assertString;
|
|
56
62
|
private static assertNullableString;
|
|
57
63
|
private static assertNullableMiniMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ropewikiPageView.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiPageView/ropewikiPageView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAA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
|
|
@@ -5,7 +5,10 @@ const difficulty_1 = require("../../difficulty");
|
|
|
5
5
|
const permitStatus_1 = require("../../permitStatus");
|
|
6
6
|
const betaSection_1 = require("../../betaSections/betaSection");
|
|
7
7
|
const betaSectionImage_1 = require("../../betaSections/betaSectionImage");
|
|
8
|
+
const miniMapType_1 = require("../../minimap/miniMapType");
|
|
8
9
|
const pageMiniMap_1 = require("../../minimap/pageMiniMap");
|
|
10
|
+
const pageDataSource_1 = require("../../pageDataSource");
|
|
11
|
+
const pagePreview_1 = require("../../previews/pagePreview");
|
|
9
12
|
/**
|
|
10
13
|
* Response type for GET getRopewikiPageView (full page view).
|
|
11
14
|
*/
|
|
@@ -89,6 +92,17 @@ class RopewikiPageView {
|
|
|
89
92
|
Object.setPrototypeOf(r, RopewikiPageView.prototype);
|
|
90
93
|
return r;
|
|
91
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Maps this full page view to a PagePreview for persistence (saved pages).
|
|
97
|
+
* @param apiPageId Ropewiki page uuid from GET /ropewiki/page/{id}.
|
|
98
|
+
*/
|
|
99
|
+
toPagePreview(apiPageId) {
|
|
100
|
+
let mapData = null;
|
|
101
|
+
if (this.miniMap != null && this.miniMap.miniMapType === miniMapType_1.MiniMapType.TilesTemplate) {
|
|
102
|
+
mapData = this.miniMap.layerId;
|
|
103
|
+
}
|
|
104
|
+
return new pagePreview_1.PagePreview(apiPageId, pageDataSource_1.PageDataSource.Ropewiki, this.bannerImage?.bannerUrl ?? null, this.quality, this.userVotes, this.name, this.regions.map((r) => r.name), this.aka, this.difficulty, mapData, this.url, this.permit);
|
|
105
|
+
}
|
|
92
106
|
static assertString(obj, key) {
|
|
93
107
|
const v = obj[key];
|
|
94
108
|
if (typeof v !== 'string') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ropewikiPageViewResult.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiPageView/ropewikiPageViewResult.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ropewikiPageViewResult.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiPageView/ropewikiPageViewResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,EAAc,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,MAAM,CAAC,gBAAgB,CAAC;aACpC,MAAM,EAAE,gBAAgB;gBAAxB,MAAM,EAAE,gBAAgB;IAIpD;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,sBAAsB;CAI7D"}
|
|
@@ -20,3 +20,6 @@ class RopewikiPageViewResult extends result_1.Result {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.RopewikiPageViewResult = RopewikiPageViewResult;
|
|
23
|
+
// Side-effect registration so the base `Result` class does not import this subclass to route
|
|
24
|
+
// `fromResponseBody` → `fromResult` (that would be a circular dependency).
|
|
25
|
+
(0, result_1.registerResultParser)(result_1.ResultType.RopewikiPageView, (v) => RopewikiPageViewResult.fromResult(v));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ropewikiRegionImagesResult.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiRegionImages/ropewikiRegionImagesResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EACH,uBAAuB,EACvB,KAAK,iCAAiC,
|
|
1
|
+
{"version":3,"file":"ropewikiRegionImagesResult.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiRegionImages/ropewikiRegionImagesResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EACH,uBAAuB,EACvB,KAAK,iCAAiC,EAGzC,MAAM,uCAAuC,CAAC;AAE/C;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,uBAAuB,CAAC,uBAAuB,CAAC;gBAExF,OAAO,EAAE,uBAAuB,EAAE,EAClC,UAAU,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI;IAWlD;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CACnB,IAAI,EAAE,iCAAiC,GACxC,0BAA0B;CAQhC"}
|
|
@@ -30,3 +30,6 @@ class RopewikiRegionImagesResult extends cursorPaginationResults_1.CursorPaginat
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.RopewikiRegionImagesResult = RopewikiRegionImagesResult;
|
|
33
|
+
// Side-effect registration so the base `CursorPaginationResults` class does not import this
|
|
34
|
+
// subclass to route `fromResponseBody` (that would be a circular dependency).
|
|
35
|
+
(0, cursorPaginationResults_1.registerCursorPaginationParser)(cursorPaginationResults_1.CursorPaginationResultType.RopewikiRegionImages, (validated) => RopewikiRegionImagesResult.fromResponseBody(validated));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ropewikiRegionPreviewsResult.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiRegionPreviews/ropewikiRegionPreviewsResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EACH,uBAAuB,EACvB,KAAK,iCAAiC,
|
|
1
|
+
{"version":3,"file":"ropewikiRegionPreviewsResult.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiRegionPreviews/ropewikiRegionPreviewsResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EACH,uBAAuB,EACvB,KAAK,iCAAiC,EAGzC,MAAM,uCAAuC,CAAC;AAE/C;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,uBAAuB,CAAC,OAAO,CAAC;gBAE1E,OAAO,EAAE,OAAO,EAAE,EAClB,UAAU,EAAE,oBAAoB,GAAG,MAAM,GAAG,IAAI;IAWpD;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CACnB,IAAI,EAAE,iCAAiC,GACxC,4BAA4B;CAQlC"}
|
|
@@ -30,3 +30,6 @@ class RopewikiRegionPreviewsResult extends cursorPaginationResults_1.CursorPagin
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.RopewikiRegionPreviewsResult = RopewikiRegionPreviewsResult;
|
|
33
|
+
// Side-effect registration so the base `CursorPaginationResults` class does not import this
|
|
34
|
+
// subclass to route `fromResponseBody` (that would be a circular dependency).
|
|
35
|
+
(0, cursorPaginationResults_1.registerCursorPaginationParser)(cursorPaginationResults_1.CursorPaginationResultType.RopewikiRegionPreviews, (validated) => RopewikiRegionPreviewsResult.fromResponseBody(validated));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ropewikiRegionViewResult.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiRegionView/ropewikiRegionViewResult.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ropewikiRegionViewResult.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiRegionView/ropewikiRegionViewResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,EAAc,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,MAAM,CAAC,kBAAkB,CAAC;aACxC,MAAM,EAAE,kBAAkB;gBAA1B,MAAM,EAAE,kBAAkB;IAItD;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,wBAAwB;CAI/D"}
|
|
@@ -20,3 +20,6 @@ class RopewikiRegionViewResult extends result_1.Result {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.RopewikiRegionViewResult = RopewikiRegionViewResult;
|
|
23
|
+
// Side-effect registration so the base `Result` class does not import this subclass to route
|
|
24
|
+
// `fromResponseBody` → `fromResult` (that would be a circular dependency).
|
|
25
|
+
(0, result_1.registerResultParser)(result_1.ResultType.RopewikiRegionView, (v) => RopewikiRegionViewResult.fromResult(v));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routePreviewResult.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRoutePreview/routePreviewResult.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"routePreviewResult.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRoutePreview/routePreviewResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,EAAc,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,MAAM,CAAC,WAAW,EAAE,CAAC;aAC7B,MAAM,EAAE,WAAW,EAAE;gBAArB,MAAM,EAAE,WAAW,EAAE;IAIjD;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,kBAAkB;CASzD"}
|
|
@@ -24,3 +24,6 @@ class RoutePreviewResult extends result_1.Result {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
exports.RoutePreviewResult = RoutePreviewResult;
|
|
27
|
+
// Side-effect registration so the base `Result` class does not import this subclass to route
|
|
28
|
+
// `fromResponseBody` → `fromResult` (that would be a circular dependency).
|
|
29
|
+
(0, result_1.registerResultParser)(result_1.ResultType.RoutePreview, (v) => RoutePreviewResult.fromResult(v));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routesGeojsonResult.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRoutes/routesGeojsonResult.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"routesGeojsonResult.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRoutes/routesGeojsonResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,EAAc,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,MAAM,CAAC,aAAa,CAAC;aAC9B,MAAM,EAAE,aAAa;gBAArB,MAAM,EAAE,aAAa;IAIjD;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,mBAAmB;CAI1D"}
|
|
@@ -20,3 +20,6 @@ class RoutesGeojsonResult extends result_1.Result {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.RoutesGeojsonResult = RoutesGeojsonResult;
|
|
23
|
+
// Side-effect registration so the base `Result` class does not import this subclass to route
|
|
24
|
+
// `fromResponseBody` → `fromResult` (that would be a circular dependency).
|
|
25
|
+
(0, result_1.registerResultParser)(result_1.ResultType.RoutesGeojson, (v) => RoutesGeojsonResult.fromResult(v));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapDataTileKeysResults.d.ts","sourceRoot":"","sources":["../../../../src/types/api/listMapDataTileKeys/mapDataTileKeysResults.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iBAAiB,
|
|
1
|
+
{"version":3,"file":"mapDataTileKeysResults.d.ts","sourceRoot":"","sources":["../../../../src/types/api/listMapDataTileKeys/mapDataTileKeysResults.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iBAAiB,EAGjB,KAAK,2BAA2B,EACnC,MAAM,iCAAiC,CAAC;AAEzC;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,iBAAiB,CAAC,MAAM,CAAC;IACjE,SAAiB,UAAU,EAAE,MAAM,CAAC;gBAExB,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAI9E;;;OAGG;IACH,MAAM,CAAC,qBAAqB,CACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,EAAE,2BAA2B,GACvC,sBAAsB;IAmBzB,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAgBlC"}
|
|
@@ -40,3 +40,6 @@ class MapDataTileKeysResults extends paginationResults_1.PaginationResults {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
exports.MapDataTileKeysResults = MapDataTileKeysResults;
|
|
43
|
+
// Side-effect registration so the base `PaginationResults` class does not import this
|
|
44
|
+
// subclass to route `fromResponseBody` → `fromResponseBodyInner` (that would be a circular dependency).
|
|
45
|
+
(0, paginationResults_1.registerPaginationParser)(paginationResults_1.PaginationResultType.MapDataTileKeys, (body, validated) => MapDataTileKeysResults.fromResponseBodyInner(body, validated));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchResults.d.ts","sourceRoot":"","sources":["../../../../src/types/api/search/searchResults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EACH,uBAAuB,EACvB,KAAK,iCAAiC,
|
|
1
|
+
{"version":3,"file":"searchResults.d.ts","sourceRoot":"","sources":["../../../../src/types/api/search/searchResults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EACH,uBAAuB,EACvB,KAAK,iCAAiC,EAGzC,MAAM,uCAAuC,CAAC;AAE/C,qBAAa,aAAc,SAAQ,uBAAuB,CAAC,OAAO,CAAC;gBACnD,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI;IAQxE;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,iCAAiC,GAAG,aAAa;CAQlF"}
|
|
@@ -25,3 +25,6 @@ class SearchResults extends cursorPaginationResults_1.CursorPaginationResults {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
exports.SearchResults = SearchResults;
|
|
28
|
+
// Side-effect registration so the base `CursorPaginationResults` class does not import this
|
|
29
|
+
// subclass to route `fromResponseBody` (that would be a circular dependency).
|
|
30
|
+
(0, cursorPaginationResults_1.registerCursorPaginationParser)(cursorPaginationResults_1.CursorPaginationResultType.Search, (validated) => SearchResults.fromResponseBody(validated));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local filesystem paths for downloaded image renditions (per Ropewiki image id).
|
|
3
|
+
*/
|
|
4
|
+
export declare class ImageVersions {
|
|
5
|
+
readonly preview: string | null;
|
|
6
|
+
readonly banner: string | null;
|
|
7
|
+
readonly full: string | null;
|
|
8
|
+
constructor(preview: string | null, banner: string | null, full: string | null);
|
|
9
|
+
static fromResult(result: unknown): ImageVersions;
|
|
10
|
+
private static assertStringOrNull;
|
|
11
|
+
toPlain(): {
|
|
12
|
+
preview: string | null;
|
|
13
|
+
banner: string | null;
|
|
14
|
+
full: string | null;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=imageVersions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageVersions.d.ts","sourceRoot":"","sources":["../../../src/types/mobile/imageVersions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,aAAa;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEjB,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAM9E,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,aAAa;IAejD,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAOjC,OAAO,IAAI;QAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;CAOpF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageVersions = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Local filesystem paths for downloaded image renditions (per Ropewiki image id).
|
|
6
|
+
*/
|
|
7
|
+
class ImageVersions {
|
|
8
|
+
constructor(preview, banner, full) {
|
|
9
|
+
this.preview = preview;
|
|
10
|
+
this.banner = banner;
|
|
11
|
+
this.full = full;
|
|
12
|
+
}
|
|
13
|
+
static fromResult(result) {
|
|
14
|
+
if (result == null || typeof result !== 'object') {
|
|
15
|
+
throw new Error('ImageVersions result must be an object');
|
|
16
|
+
}
|
|
17
|
+
const r = result;
|
|
18
|
+
ImageVersions.assertStringOrNull(r, 'preview');
|
|
19
|
+
ImageVersions.assertStringOrNull(r, 'banner');
|
|
20
|
+
ImageVersions.assertStringOrNull(r, 'full');
|
|
21
|
+
return new ImageVersions(r.preview, r.banner, r.full);
|
|
22
|
+
}
|
|
23
|
+
static assertStringOrNull(obj, key) {
|
|
24
|
+
const v = obj[key];
|
|
25
|
+
if (v !== null && typeof v !== 'string') {
|
|
26
|
+
throw new Error(`ImageVersions.${key} must be a string or null, got: ${typeof v}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
toPlain() {
|
|
30
|
+
return {
|
|
31
|
+
preview: this.preview,
|
|
32
|
+
banner: this.banner,
|
|
33
|
+
full: this.full,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.ImageVersions = ImageVersions;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PagePreview } from '../previews/pagePreview';
|
|
2
|
+
import { RouteType } from '../routes/route';
|
|
3
|
+
import { RopewikiPageView } from '../api/getRopewikiPageView/ropewikiPageView';
|
|
4
|
+
import { ImageVersions } from './imageVersions';
|
|
5
|
+
/**
|
|
6
|
+
* A saved Ropewiki page row (preview + route type + metadata).
|
|
7
|
+
* `toString()` returns JSON for persistence.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SavedPage {
|
|
10
|
+
readonly preview: PagePreview;
|
|
11
|
+
readonly routeType: RouteType;
|
|
12
|
+
readonly savedAt: number;
|
|
13
|
+
readonly downloadedPageView: string | null;
|
|
14
|
+
readonly downloadedImages: Record<string, ImageVersions> | null;
|
|
15
|
+
readonly downloadedMapData: string | null;
|
|
16
|
+
constructor(preview: PagePreview, routeType: RouteType, savedAt: number, downloadedPageView?: string | null, downloadedImages?: Record<string, ImageVersions> | null, downloadedMapData?: string | null);
|
|
17
|
+
static fromJsonString(jsonString: string): SavedPage;
|
|
18
|
+
/**
|
|
19
|
+
* Builds a SavedPage from API data when the user saves from a page screen.
|
|
20
|
+
* @param apiPageId RopewikiPage uuid (same as route `/ropewiki/page/{id}`).
|
|
21
|
+
*/
|
|
22
|
+
static fromRopewikiPageView(data: RopewikiPageView, routeType: RouteType, apiPageId: string): SavedPage;
|
|
23
|
+
/**
|
|
24
|
+
* Rewrites banner/beta image URLs to local `file://` URIs using this saved page's downloaded image paths.
|
|
25
|
+
*/
|
|
26
|
+
applyDownloadedImagesToPageView(data: RopewikiPageView): RopewikiPageView;
|
|
27
|
+
toString(): string;
|
|
28
|
+
private static parseDownloadedImages;
|
|
29
|
+
private static toDisplayUri;
|
|
30
|
+
private static patchBetaImage;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=savedPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"savedPage.d.ts","sourceRoot":"","sources":["../../../src/types/mobile/savedPage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAsChD;;;GAGG;AACH,qBAAa,SAAS;IAClB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAE9B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAE9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,IAAI,CAAC;IAEhE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;gBAGtC,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,MAAM,EACf,kBAAkB,GAAE,MAAM,GAAG,IAAW,EACxC,gBAAgB,GAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,IAAW,EAC7D,iBAAiB,GAAE,MAAM,GAAG,IAAW;IAU3C,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS;IAwCpD;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CACvB,IAAI,EAAE,gBAAgB,EACtB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,MAAM,GAClB,SAAS;IAQZ;;OAEG;IACH,+BAA+B,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB;IA6CzE,QAAQ,IAAI,MAAM;IAiBlB,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAgBpC,OAAO,CAAC,MAAM,CAAC,YAAY;IAO3B,OAAO,CAAC,MAAM,CAAC,cAAc;CAgBhC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SavedPage = void 0;
|
|
4
|
+
const betaSectionImage_1 = require("../betaSections/betaSectionImage");
|
|
5
|
+
const pagePreview_1 = require("../previews/pagePreview");
|
|
6
|
+
const route_1 = require("../routes/route");
|
|
7
|
+
const ropewikiPageView_1 = require("../api/getRopewikiPageView/ropewikiPageView");
|
|
8
|
+
const imageVersions_1 = require("./imageVersions");
|
|
9
|
+
const STORAGE_KEYS = ['preview', 'routeType', 'savedAt'];
|
|
10
|
+
function assertRouteType(value) {
|
|
11
|
+
if (typeof value !== 'string' || !Object.values(route_1.RouteType).includes(value)) {
|
|
12
|
+
throw new Error(`SavedPage.routeType must be RouteType, got: ${JSON.stringify(value)}`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function assertFiniteNumber(value, name) {
|
|
16
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
17
|
+
throw new Error(`SavedPage.${name} must be a finite number`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function pagePreviewToPlain(p) {
|
|
21
|
+
return {
|
|
22
|
+
id: p.id,
|
|
23
|
+
source: p.source,
|
|
24
|
+
imageUrl: p.imageUrl,
|
|
25
|
+
rating: p.rating,
|
|
26
|
+
ratingCount: p.ratingCount,
|
|
27
|
+
title: p.title,
|
|
28
|
+
regions: p.regions,
|
|
29
|
+
aka: p.aka,
|
|
30
|
+
difficulty: {
|
|
31
|
+
technical: p.difficulty.technical,
|
|
32
|
+
water: p.difficulty.water,
|
|
33
|
+
time: p.difficulty.time,
|
|
34
|
+
risk: p.difficulty.risk,
|
|
35
|
+
},
|
|
36
|
+
mapData: p.mapData,
|
|
37
|
+
externalLink: p.externalLink,
|
|
38
|
+
permit: p.permit,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A saved Ropewiki page row (preview + route type + metadata).
|
|
43
|
+
* `toString()` returns JSON for persistence.
|
|
44
|
+
*/
|
|
45
|
+
class SavedPage {
|
|
46
|
+
constructor(preview, routeType, savedAt, downloadedPageView = null, downloadedImages = null, downloadedMapData = null) {
|
|
47
|
+
this.preview = preview;
|
|
48
|
+
this.routeType = routeType;
|
|
49
|
+
this.savedAt = savedAt;
|
|
50
|
+
this.downloadedPageView = downloadedPageView;
|
|
51
|
+
this.downloadedImages = downloadedImages;
|
|
52
|
+
this.downloadedMapData = downloadedMapData;
|
|
53
|
+
}
|
|
54
|
+
static fromJsonString(jsonString) {
|
|
55
|
+
let parsed;
|
|
56
|
+
try {
|
|
57
|
+
parsed = JSON.parse(jsonString);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
throw new Error(`SavedPage.fromJsonString: invalid JSON: ${e instanceof Error ? e.message : String(e)}`);
|
|
61
|
+
}
|
|
62
|
+
if (parsed == null || typeof parsed !== 'object') {
|
|
63
|
+
throw new Error('SavedPage.fromJsonString: top-level value must be an object');
|
|
64
|
+
}
|
|
65
|
+
const o = parsed;
|
|
66
|
+
for (const key of STORAGE_KEYS) {
|
|
67
|
+
if (!(key in o)) {
|
|
68
|
+
throw new Error(`SavedPage.fromJsonString: missing key "${key}"`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
assertRouteType(o.routeType);
|
|
72
|
+
assertFiniteNumber(o.savedAt, 'savedAt');
|
|
73
|
+
const preview = pagePreview_1.PagePreview.fromResult(o.preview);
|
|
74
|
+
const downloadedPageView = 'downloadedPageView' in o && o.downloadedPageView != null
|
|
75
|
+
? String(o.downloadedPageView)
|
|
76
|
+
: null;
|
|
77
|
+
const downloadedImages = SavedPage.parseDownloadedImages(o.downloadedImages);
|
|
78
|
+
const downloadedMapData = 'downloadedMapData' in o && o.downloadedMapData != null
|
|
79
|
+
? String(o.downloadedMapData)
|
|
80
|
+
: null;
|
|
81
|
+
return new SavedPage(preview, o.routeType, o.savedAt, downloadedPageView, downloadedImages, downloadedMapData);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Builds a SavedPage from API data when the user saves from a page screen.
|
|
85
|
+
* @param apiPageId RopewikiPage uuid (same as route `/ropewiki/page/{id}`).
|
|
86
|
+
*/
|
|
87
|
+
static fromRopewikiPageView(data, routeType, apiPageId) {
|
|
88
|
+
return new SavedPage(data.toPagePreview(apiPageId), routeType, Date.now());
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Rewrites banner/beta image URLs to local `file://` URIs using this saved page's downloaded image paths.
|
|
92
|
+
*/
|
|
93
|
+
applyDownloadedImagesToPageView(data) {
|
|
94
|
+
if (this.downloadedImages == null)
|
|
95
|
+
return data;
|
|
96
|
+
const bannerImage = data.bannerImage != null
|
|
97
|
+
? SavedPage.patchBetaImage(data.bannerImage, this.downloadedImages[data.bannerImage.id])
|
|
98
|
+
: null;
|
|
99
|
+
const betaSections = data.betaSections.map((sec) => ({
|
|
100
|
+
...sec,
|
|
101
|
+
images: sec.images.map((im) => SavedPage.patchBetaImage(im, this.downloadedImages?.[im.id])),
|
|
102
|
+
}));
|
|
103
|
+
return new ropewikiPageView_1.RopewikiPageView(data.name, data.aka, data.url, data.quality, data.userVotes, data.regions, data.difficulty, data.permit, data.rappelCount, data.jumps, data.vehicle, data.rappelLongest, data.shuttleTime, data.overallLength, data.descentLength, data.exitLength, data.approachLength, data.overallTime, data.approachTime, data.descentTime, data.exitTime, data.approachElevGain, data.descentElevGain, data.exitElevGain, data.months, data.latestRevisionDate, bannerImage, betaSections, data.miniMap);
|
|
104
|
+
}
|
|
105
|
+
toString() {
|
|
106
|
+
const imagesPlain = this.downloadedImages == null
|
|
107
|
+
? null
|
|
108
|
+
: Object.fromEntries(Object.entries(this.downloadedImages).map(([id, iv]) => [id, iv.toPlain()]));
|
|
109
|
+
return JSON.stringify({
|
|
110
|
+
preview: pagePreviewToPlain(this.preview),
|
|
111
|
+
routeType: this.routeType,
|
|
112
|
+
savedAt: this.savedAt,
|
|
113
|
+
downloadedPageView: this.downloadedPageView,
|
|
114
|
+
downloadedImages: imagesPlain,
|
|
115
|
+
downloadedMapData: this.downloadedMapData,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
static parseDownloadedImages(raw) {
|
|
119
|
+
if (raw == null)
|
|
120
|
+
return null;
|
|
121
|
+
if (typeof raw !== 'object') {
|
|
122
|
+
throw new Error('SavedPage.downloadedImages must be an object or null');
|
|
123
|
+
}
|
|
124
|
+
const out = {};
|
|
125
|
+
for (const [k, v] of Object.entries(raw)) {
|
|
126
|
+
if (typeof v === 'string') {
|
|
127
|
+
out[k] = new imageVersions_1.ImageVersions(null, v, null);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
out[k] = imageVersions_1.ImageVersions.fromResult(v);
|
|
131
|
+
}
|
|
132
|
+
return out;
|
|
133
|
+
}
|
|
134
|
+
static toDisplayUri(localPath) {
|
|
135
|
+
if (localPath.startsWith('file://')) {
|
|
136
|
+
return localPath;
|
|
137
|
+
}
|
|
138
|
+
return localPath.startsWith('/') ? `file://${localPath}` : `file:///${localPath}`;
|
|
139
|
+
}
|
|
140
|
+
static patchBetaImage(img, iv) {
|
|
141
|
+
if (iv == null)
|
|
142
|
+
return img;
|
|
143
|
+
return betaSectionImage_1.BetaSectionImage.fromResult({
|
|
144
|
+
order: img.order,
|
|
145
|
+
id: img.id,
|
|
146
|
+
bannerUrl: iv.banner != null ? SavedPage.toDisplayUri(iv.banner) : img.bannerUrl,
|
|
147
|
+
fullUrl: iv.full != null ? SavedPage.toDisplayUri(iv.full) : img.fullUrl,
|
|
148
|
+
linkUrl: img.linkUrl,
|
|
149
|
+
caption: img.caption,
|
|
150
|
+
latestRevisionDate: img.latestRevisionDate.toISOString(),
|
|
151
|
+
downloadBytes: img.downloadBytes,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.SavedPage = SavedPage;
|
|
@@ -15,6 +15,12 @@ export type ValidatedCursorPaginationResponse = {
|
|
|
15
15
|
results: unknown[];
|
|
16
16
|
nextCursor: string | null;
|
|
17
17
|
};
|
|
18
|
+
type CursorPaginationParserFn = (validated: ValidatedCursorPaginationResponse) => CursorPaginationResults;
|
|
19
|
+
/**
|
|
20
|
+
* Registers the parser for {@link CursorPaginationResults.fromResponseBody} for a given type.
|
|
21
|
+
* Call once per type from the corresponding result module at load time.
|
|
22
|
+
*/
|
|
23
|
+
export declare function registerCursorPaginationParser(type: CursorPaginationResultType, parse: CursorPaginationParserFn): void;
|
|
18
24
|
/**
|
|
19
25
|
* Base type for cursor-paginated API results (results array + nextCursor + resultType).
|
|
20
26
|
* fromResponseBody validates body (resultType, results, nextCursor) then delegates to
|
|
@@ -31,4 +37,5 @@ export declare abstract class CursorPaginationResults<R = unknown> {
|
|
|
31
37
|
*/
|
|
32
38
|
static fromResponseBody(body: unknown): CursorPaginationResults;
|
|
33
39
|
}
|
|
40
|
+
export {};
|
|
34
41
|
//# sourceMappingURL=cursorPaginationResults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursorPaginationResults.d.ts","sourceRoot":"","sources":["../../../src/types/results/cursorPaginationResults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,0BAA0B;IAClC,MAAM,WAAW;IACjB,oBAAoB,yBAAyB;IAC7C,sBAAsB,2BAA2B;CACpD;AAED;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC5C,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,8BAAsB,uBAAuB,CAAC,CAAC,GAAG,OAAO;aAEjC,OAAO,EAAE,CAAC,EAAE;aACZ,UAAU,EAAE,MAAM,GAAG,IAAI;aACzB,UAAU,EAAE,0BAA0B;gBAFtC,OAAO,EAAE,CAAC,EAAE,EACZ,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,UAAU,EAAE,0BAA0B;IAG1D;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,uBAAuB;
|
|
1
|
+
{"version":3,"file":"cursorPaginationResults.d.ts","sourceRoot":"","sources":["../../../src/types/results/cursorPaginationResults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,0BAA0B;IAClC,MAAM,WAAW;IACjB,oBAAoB,yBAAyB;IAC7C,sBAAsB,2BAA2B;CACpD;AAED;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC5C,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,KAAK,wBAAwB,GAAG,CAC5B,SAAS,EAAE,iCAAiC,KAC3C,uBAAuB,CAAC;AAO7B;;;GAGG;AACH,wBAAgB,8BAA8B,CAC1C,IAAI,EAAE,0BAA0B,EAChC,KAAK,EAAE,wBAAwB,GAChC,IAAI,CAEN;AAED;;;;GAIG;AACH,8BAAsB,uBAAuB,CAAC,CAAC,GAAG,OAAO;aAEjC,OAAO,EAAE,CAAC,EAAE;aACZ,UAAU,EAAE,MAAM,GAAG,IAAI;aACzB,UAAU,EAAE,0BAA0B;gBAFtC,OAAO,EAAE,CAAC,EAAE,EACZ,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,UAAU,EAAE,0BAA0B;IAG1D;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,uBAAuB;CAyClE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CursorPaginationResults = exports.CursorPaginationResultType = void 0;
|
|
4
|
+
exports.registerCursorPaginationParser = registerCursorPaginationParser;
|
|
4
5
|
/**
|
|
5
6
|
* Discriminator for cursor-paginated result types. Used in response body so
|
|
6
7
|
* CursorPaginationResults.fromResponseBody can route to the correct parser.
|
|
@@ -11,6 +12,14 @@ var CursorPaginationResultType;
|
|
|
11
12
|
CursorPaginationResultType["RopewikiRegionImages"] = "ropewikiRegionImages";
|
|
12
13
|
CursorPaginationResultType["RopewikiRegionPreviews"] = "ropewikiRegionPreviews";
|
|
13
14
|
})(CursorPaginationResultType || (exports.CursorPaginationResultType = CursorPaginationResultType = {}));
|
|
15
|
+
const cursorPaginationParsers = new Map();
|
|
16
|
+
/**
|
|
17
|
+
* Registers the parser for {@link CursorPaginationResults.fromResponseBody} for a given type.
|
|
18
|
+
* Call once per type from the corresponding result module at load time.
|
|
19
|
+
*/
|
|
20
|
+
function registerCursorPaginationParser(type, parse) {
|
|
21
|
+
cursorPaginationParsers.set(type, parse);
|
|
22
|
+
}
|
|
14
23
|
/**
|
|
15
24
|
* Base type for cursor-paginated API results (results array + nextCursor + resultType).
|
|
16
25
|
* fromResponseBody validates body (resultType, results, nextCursor) then delegates to
|
|
@@ -57,20 +66,11 @@ class CursorPaginationResults {
|
|
|
57
66
|
results: resultsRaw,
|
|
58
67
|
nextCursor,
|
|
59
68
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return SearchResults.fromResponseBody(validated);
|
|
64
|
-
}
|
|
65
|
-
case CursorPaginationResultType.RopewikiRegionPreviews: {
|
|
66
|
-
const { RopewikiRegionPreviewsResult } = require('../api/getRopewikiRegionPreviews/ropewikiRegionPreviewsResult');
|
|
67
|
-
return RopewikiRegionPreviewsResult.fromResponseBody(validated);
|
|
68
|
-
}
|
|
69
|
-
case CursorPaginationResultType.RopewikiRegionImages: {
|
|
70
|
-
const { RopewikiRegionImagesResult } = require('../api/getRopewikiRegionImages/ropewikiRegionImagesResult');
|
|
71
|
-
return RopewikiRegionImagesResult.fromResponseBody(validated);
|
|
72
|
-
}
|
|
69
|
+
const parser = cursorPaginationParsers.get(resultType);
|
|
70
|
+
if (parser === undefined) {
|
|
71
|
+
throw new Error(`No cursor pagination parser registered for resultType ${JSON.stringify(resultType)}`);
|
|
73
72
|
}
|
|
73
|
+
return parser(validated);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
exports.CursorPaginationResults = CursorPaginationResults;
|
|
@@ -14,6 +14,12 @@ export type ValidatedPaginationResponse = {
|
|
|
14
14
|
total: number;
|
|
15
15
|
page: number;
|
|
16
16
|
};
|
|
17
|
+
type PaginationParserFn = (body: Record<string, unknown>, validated: ValidatedPaginationResponse) => PaginationResults;
|
|
18
|
+
/**
|
|
19
|
+
* Registers the parser for {@link PaginationResults.fromResponseBody} for a given type.
|
|
20
|
+
* Call once per type from the corresponding result module at load time.
|
|
21
|
+
*/
|
|
22
|
+
export declare function registerPaginationParser(type: PaginationResultType, parse: PaginationParserFn): void;
|
|
17
23
|
/**
|
|
18
24
|
* Base type for page-paginated API results (results array + total + page + resultType).
|
|
19
25
|
* fromResponseBody validates body then delegates to the corresponding Result class.
|
|
@@ -34,4 +40,5 @@ export declare abstract class PaginationResults<R = unknown> {
|
|
|
34
40
|
*/
|
|
35
41
|
static fromResponseBody(body: unknown): PaginationResults;
|
|
36
42
|
}
|
|
43
|
+
export {};
|
|
37
44
|
//# sourceMappingURL=paginationResults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginationResults.d.ts","sourceRoot":"","sources":["../../../src/types/results/paginationResults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,oBAAoB;IAC5B,eAAe,oBAAoB;CACtC;AAED;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACtC,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,8BAAsB,iBAAiB,CAAC,CAAC,GAAG,OAAO;aAE3B,OAAO,EAAE,CAAC,EAAE;aACZ,KAAK,EAAE,MAAM;aACb,IAAI,EAAE,MAAM;aACZ,UAAU,EAAE,oBAAoB;IAChD,iHAAiH;aACjG,UAAU,CAAC,EAAE,MAAM;gBALnB,OAAO,EAAE,CAAC,EAAE,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,oBAAoB;IAChD,iHAAiH;IACjG,UAAU,CAAC,EAAE,MAAM,YAAA;IAGvC;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB;
|
|
1
|
+
{"version":3,"file":"paginationResults.d.ts","sourceRoot":"","sources":["../../../src/types/results/paginationResults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,oBAAoB;IAC5B,eAAe,oBAAoB;CACtC;AAED;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACtC,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,kBAAkB,GAAG,CACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,EAAE,2BAA2B,KACrC,iBAAiB,CAAC;AAIvB;;;GAGG;AACH,wBAAgB,wBAAwB,CACpC,IAAI,EAAE,oBAAoB,EAC1B,KAAK,EAAE,kBAAkB,GAC1B,IAAI,CAEN;AAED;;;GAGG;AACH,8BAAsB,iBAAiB,CAAC,CAAC,GAAG,OAAO;aAE3B,OAAO,EAAE,CAAC,EAAE;aACZ,KAAK,EAAE,MAAM;aACb,IAAI,EAAE,MAAM;aACZ,UAAU,EAAE,oBAAoB;IAChD,iHAAiH;aACjG,UAAU,CAAC,EAAE,MAAM;gBALnB,OAAO,EAAE,CAAC,EAAE,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,oBAAoB;IAChD,iHAAiH;IACjG,UAAU,CAAC,EAAE,MAAM,YAAA;IAGvC;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB;CAuD5D"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PaginationResults = exports.PaginationResultType = void 0;
|
|
4
|
+
exports.registerPaginationParser = registerPaginationParser;
|
|
4
5
|
/**
|
|
5
6
|
* Discriminator for page-based paginated result types. Used in response body so
|
|
6
7
|
* PaginationResults.fromResponseBody can route to the correct parser.
|
|
@@ -9,6 +10,14 @@ var PaginationResultType;
|
|
|
9
10
|
(function (PaginationResultType) {
|
|
10
11
|
PaginationResultType["MapDataTileKeys"] = "mapDataTileKeys";
|
|
11
12
|
})(PaginationResultType || (exports.PaginationResultType = PaginationResultType = {}));
|
|
13
|
+
const paginationParsers = new Map();
|
|
14
|
+
/**
|
|
15
|
+
* Registers the parser for {@link PaginationResults.fromResponseBody} for a given type.
|
|
16
|
+
* Call once per type from the corresponding result module at load time.
|
|
17
|
+
*/
|
|
18
|
+
function registerPaginationParser(type, parse) {
|
|
19
|
+
paginationParsers.set(type, parse);
|
|
20
|
+
}
|
|
12
21
|
/**
|
|
13
22
|
* Base type for page-paginated API results (results array + total + page + resultType).
|
|
14
23
|
* fromResponseBody validates body then delegates to the corresponding Result class.
|
|
@@ -72,12 +81,11 @@ class PaginationResults {
|
|
|
72
81
|
total,
|
|
73
82
|
page,
|
|
74
83
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return MapDataTileKeysResults.fromResponseBodyInner(b, validated);
|
|
79
|
-
}
|
|
84
|
+
const parser = paginationParsers.get(resultType);
|
|
85
|
+
if (parser === undefined) {
|
|
86
|
+
throw new Error(`No pagination parser registered for resultType ${JSON.stringify(resultType)}`);
|
|
80
87
|
}
|
|
88
|
+
return parser(b, validated);
|
|
81
89
|
}
|
|
82
90
|
}
|
|
83
91
|
exports.PaginationResults = PaginationResults;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Side-effect imports so each API result module registers its parser with the base
|
|
3
|
+
* `fromResponseBody` routers. Import this entry first from the package barrel so
|
|
4
|
+
* registration is guaranteed even when a bundler tree-shakes unused re-exports.
|
|
5
|
+
*/
|
|
6
|
+
import '../api/getRopewikiPageView/ropewikiPageViewResult';
|
|
7
|
+
import '../api/getRopewikiRegionView/ropewikiRegionViewResult';
|
|
8
|
+
import '../api/getRoutes/routesGeojsonResult';
|
|
9
|
+
import '../api/getRoutePreview/routePreviewResult';
|
|
10
|
+
import '../api/search/searchResults';
|
|
11
|
+
import '../api/getRopewikiRegionPreviews/ropewikiRegionPreviewsResult';
|
|
12
|
+
import '../api/getRopewikiRegionImages/ropewikiRegionImagesResult';
|
|
13
|
+
import '../api/listMapDataTileKeys/mapDataTileKeysResults';
|
|
14
|
+
//# sourceMappingURL=registerAllResultParsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerAllResultParsers.d.ts","sourceRoot":"","sources":["../../../src/types/results/registerAllResultParsers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,mDAAmD,CAAC;AAC3D,OAAO,uDAAuD,CAAC;AAC/D,OAAO,sCAAsC,CAAC;AAC9C,OAAO,2CAA2C,CAAC;AACnD,OAAO,6BAA6B,CAAC;AACrC,OAAO,+DAA+D,CAAC;AACvE,OAAO,2DAA2D,CAAC;AACnE,OAAO,mDAAmD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Side-effect imports so each API result module registers its parser with the base
|
|
5
|
+
* `fromResponseBody` routers. Import this entry first from the package barrel so
|
|
6
|
+
* registration is guaranteed even when a bundler tree-shakes unused re-exports.
|
|
7
|
+
*/
|
|
8
|
+
require("../api/getRopewikiPageView/ropewikiPageViewResult");
|
|
9
|
+
require("../api/getRopewikiRegionView/ropewikiRegionViewResult");
|
|
10
|
+
require("../api/getRoutes/routesGeojsonResult");
|
|
11
|
+
require("../api/getRoutePreview/routePreviewResult");
|
|
12
|
+
require("../api/search/searchResults");
|
|
13
|
+
require("../api/getRopewikiRegionPreviews/ropewikiRegionPreviewsResult");
|
|
14
|
+
require("../api/getRopewikiRegionImages/ropewikiRegionImagesResult");
|
|
15
|
+
require("../api/listMapDataTileKeys/mapDataTileKeysResults");
|
|
@@ -8,6 +8,11 @@ export declare enum ResultType {
|
|
|
8
8
|
RoutesGeojson = "routesGeojson",
|
|
9
9
|
RoutePreview = "routePreview"
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Registers the parser for {@link Result.fromResponseBody} for a given {@link ResultType}.
|
|
13
|
+
* Call once per type from the corresponding result module at load time.
|
|
14
|
+
*/
|
|
15
|
+
export declare function registerResultParser(type: ResultType, parse: (resultValue: unknown) => Result): void;
|
|
11
16
|
/**
|
|
12
17
|
* Base type for single-result API responses (result + resultType).
|
|
13
18
|
* Each endpoint has a specific Result subclass with a typed result property.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../../src/types/results/result.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,UAAU;IAClB,gBAAgB,qBAAqB;IACrC,kBAAkB,uBAAuB;IACzC,aAAa,kBAAkB;IAC/B,YAAY,iBAAiB;CAChC;AAED;;;;;GAKG;AACH,8BAAsB,MAAM,CAAC,CAAC,GAAG,OAAO;aAEhB,MAAM,EAAE,CAAC;aACT,UAAU,EAAE,UAAU;gBADtB,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,UAAU;IAG1C;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../../src/types/results/result.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,UAAU;IAClB,gBAAgB,qBAAqB;IACrC,kBAAkB,uBAAuB;IACzC,aAAa,kBAAkB;IAC/B,YAAY,iBAAiB;CAChC;AAID;;;GAGG;AACH,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,MAAM,GACxC,IAAI,CAEN;AAED;;;;;GAKG;AACH,8BAAsB,MAAM,CAAC,CAAC,GAAG,OAAO;aAEhB,MAAM,EAAE,CAAC;aACT,UAAU,EAAE,UAAU;gBADtB,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,UAAU;IAG1C;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;CA2BjD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Result = exports.ResultType = void 0;
|
|
4
|
+
exports.registerResultParser = registerResultParser;
|
|
4
5
|
/**
|
|
5
6
|
* Discriminator for single-result API response types (e.g. getRopewikiPageView, getRoutes).
|
|
6
7
|
* Used in response body so consumers can identify the result shape.
|
|
@@ -12,6 +13,14 @@ var ResultType;
|
|
|
12
13
|
ResultType["RoutesGeojson"] = "routesGeojson";
|
|
13
14
|
ResultType["RoutePreview"] = "routePreview";
|
|
14
15
|
})(ResultType || (exports.ResultType = ResultType = {}));
|
|
16
|
+
const resultParsers = new Map();
|
|
17
|
+
/**
|
|
18
|
+
* Registers the parser for {@link Result.fromResponseBody} for a given {@link ResultType}.
|
|
19
|
+
* Call once per type from the corresponding result module at load time.
|
|
20
|
+
*/
|
|
21
|
+
function registerResultParser(type, parse) {
|
|
22
|
+
resultParsers.set(type, parse);
|
|
23
|
+
}
|
|
15
24
|
/**
|
|
16
25
|
* Base type for single-result API responses (result + resultType).
|
|
17
26
|
* Each endpoint has a specific Result subclass with a typed result property.
|
|
@@ -44,24 +53,11 @@ class Result {
|
|
|
44
53
|
throw new Error('Response body must have result');
|
|
45
54
|
}
|
|
46
55
|
const resultValue = b.result;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return RopewikiPageViewResult.fromResult(resultValue);
|
|
51
|
-
}
|
|
52
|
-
case ResultType.RopewikiRegionView: {
|
|
53
|
-
const { RopewikiRegionViewResult } = require('../api/getRopewikiRegionView/ropewikiRegionViewResult');
|
|
54
|
-
return RopewikiRegionViewResult.fromResult(resultValue);
|
|
55
|
-
}
|
|
56
|
-
case ResultType.RoutesGeojson: {
|
|
57
|
-
const { RoutesGeojsonResult } = require('../api/getRoutes/routesGeojsonResult');
|
|
58
|
-
return RoutesGeojsonResult.fromResult(resultValue);
|
|
59
|
-
}
|
|
60
|
-
case ResultType.RoutePreview: {
|
|
61
|
-
const { RoutePreviewResult } = require('../api/getRoutePreview/routePreviewResult');
|
|
62
|
-
return RoutePreviewResult.fromResult(resultValue);
|
|
63
|
-
}
|
|
56
|
+
const parser = resultParsers.get(resultType);
|
|
57
|
+
if (parser === undefined) {
|
|
58
|
+
throw new Error(`No result parser registered for resultType ${JSON.stringify(resultType)}`);
|
|
64
59
|
}
|
|
60
|
+
return parser(resultValue);
|
|
65
61
|
}
|
|
66
62
|
}
|
|
67
63
|
exports.Result = Result;
|