ropegeo-common 1.3.1 → 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 CHANGED
@@ -43,4 +43,6 @@ export type { RopewikiRegionImageViewRow } from './types/api/getRopewikiRegionIm
43
43
  export { RopewikiRegionImagesParams } from './types/api/getRopewikiRegionImages/ropewikiRegionImagesParams';
44
44
  export { RopewikiRegionImagesResult } from './types/api/getRopewikiRegionImages/ropewikiRegionImagesResult';
45
45
  export { RoutePreviewResult } from './types/api/getRoutePreview/routePreviewResult';
46
+ export { ImageVersions } from './types/mobile/imageVersions';
47
+ export { SavedPage } from './types/mobile/savedPage';
46
48
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,0CAA0C,CAAC;AAElD,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,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,C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AM,wDAAwD,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,YAAY,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,4DAA4D,CAAC;AACtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oEAAoE,CAAC;AAClH,OAAO,EAAE,4BAA4B,EAAE,MAAM,oEAAoE,CAAC;AAClH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6DAA6D,CAAC;AACtG,YAAY,EAAE,0BAA0B,EAAE,MAAM,6DAA6D,CAAC;AAC9G,OAAO,EAAE,0BAA0B,EAAE,MAAM,gEAAgE,CAAC;AAC5G,OAAO,EAAE,0BAA0B,EAAE,MAAM,gEAAgE,CAAC;AAC5G,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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.RoutePreviewResult = exports.RopewikiRegionImagesResult = exports.RopewikiRegionImagesParams = void 0;
4
+ exports.SavedPage = exports.ImageVersions = exports.RoutePreviewResult = exports.RopewikiRegionImagesResult = exports.RopewikiRegionImagesParams = void 0;
5
5
  require("./types/results/registerAllResultParsers");
6
6
  var pageDataSource_1 = require("./types/pageDataSource");
7
7
  Object.defineProperty(exports, "PageDataSource", { enumerable: true, get: function () { return pageDataSource_1.PageDataSource; } });
@@ -95,3 +95,7 @@ var ropewikiRegionImagesResult_1 = require("./types/api/getRopewikiRegionImages/
95
95
  Object.defineProperty(exports, "RopewikiRegionImagesResult", { enumerable: true, get: function () { return ropewikiRegionImagesResult_1.RopewikiRegionImagesResult; } });
96
96
  var routePreviewResult_1 = require("./types/api/getRoutePreview/routePreviewResult");
97
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,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,KAAK,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C;;GAEG;AACH,qBAAa,gBAAgB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,E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BhC,OAAO,CAAC,MAAM,CAAC,kBAAkB;IA+BjC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAyB/B,OAAO,CAAC,MAAM,CAAC,YAAY;IAgB3B,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA2BhC,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAOnC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAkBtC,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAexC,OAAO,CAAC,MAAM,CAAC,uBAAuB;CAczC"}
@@ -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') {
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ropegeo-common",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Shared types and utilities for RopeGeo and WebScraper",
5
5
  "license": "ISC",
6
6
  "repository": {