ropegeo-common 1.18.3 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +21 -2
  2. package/dist/download/dependencies/downloadDependencyKeys.d.ts +1 -0
  3. package/dist/download/dependencies/downloadDependencyKeys.d.ts.map +1 -1
  4. package/dist/download/dependencies/downloadDependencyKeys.js +1 -0
  5. package/dist/download/dependencies/fetchDownloadFolderTaskDependency.d.ts +14 -0
  6. package/dist/download/dependencies/fetchDownloadFolderTaskDependency.d.ts.map +1 -0
  7. package/dist/download/dependencies/fetchDownloadFolderTaskDependency.js +31 -0
  8. package/dist/download/helpers/downloadDependencyRegistry.d.ts.map +1 -1
  9. package/dist/download/helpers/downloadDependencyRegistry.js +2 -0
  10. package/dist/download/helpers/downloadPhaseTitles.d.ts.map +1 -1
  11. package/dist/download/helpers/downloadPhaseTitles.js +4 -0
  12. package/dist/download/helpers/downloadTaskRegistry.d.ts.map +1 -1
  13. package/dist/download/helpers/downloadTaskRegistry.js +2 -0
  14. package/dist/download/helpers/planDownloadPhases.d.ts +7 -0
  15. package/dist/download/helpers/planDownloadPhases.d.ts.map +1 -1
  16. package/dist/download/helpers/planDownloadPhases.js +40 -1
  17. package/dist/download/index.d.ts +3 -1
  18. package/dist/download/index.d.ts.map +1 -1
  19. package/dist/download/index.js +9 -1
  20. package/dist/download/tasks/fetchDownloadFolderTask.d.ts +14 -0
  21. package/dist/download/tasks/fetchDownloadFolderTask.d.ts.map +1 -0
  22. package/dist/download/tasks/fetchDownloadFolderTask.js +112 -0
  23. package/dist/download/tasks/fetchRopeGeoTileFilesTask.d.ts.map +1 -1
  24. package/dist/download/tasks/fetchRopeGeoTileFilesTask.js +3 -2
  25. package/dist/download/types.d.ts +5 -0
  26. package/dist/download/types.d.ts.map +1 -1
  27. package/dist/helpers/hydrateOfflinePageWirePaths.d.ts +3 -0
  28. package/dist/helpers/hydrateOfflinePageWirePaths.d.ts.map +1 -0
  29. package/dist/helpers/hydrateOfflinePageWirePaths.js +47 -0
  30. package/dist/helpers/index.d.ts +2 -0
  31. package/dist/helpers/index.d.ts.map +1 -1
  32. package/dist/helpers/index.js +10 -1
  33. package/dist/helpers/offlinePageBundlePaths.d.ts +12 -0
  34. package/dist/helpers/offlinePageBundlePaths.d.ts.map +1 -0
  35. package/dist/helpers/offlinePageBundlePaths.js +34 -0
  36. package/dist/models/pageViews/offlineRopewikiPageView.d.ts +1 -1
  37. package/dist/models/pageViews/offlineRopewikiPageView.d.ts.map +1 -1
  38. package/dist/models/pageViews/offlineRopewikiPageView.js +5 -1
  39. package/dist/models/pageViews/onlineRopewikiPageView.d.ts +2 -1
  40. package/dist/models/pageViews/onlineRopewikiPageView.d.ts.map +1 -1
  41. package/dist/models/pageViews/onlineRopewikiPageView.js +16 -2
  42. package/dist/models/previews/onlinePagePreview.d.ts +2 -1
  43. package/dist/models/previews/onlinePagePreview.d.ts.map +1 -1
  44. package/dist/models/previews/onlinePagePreview.js +30 -1
  45. package/package.json +1 -1
package/README.md CHANGED
@@ -12,7 +12,7 @@ npm install ropegeo-common
12
12
 
13
13
  - **Models** — `import { … } from 'ropegeo-common/models'` (or `import type { … }` for symbols that are type-only in TypeScript). The package root `ropegeo-common` re-exports everything from `./models` for convenience. The subpath `ropegeo-common/classes` is kept as an alias of `./models` for older imports until dependents switch over.
14
14
  - **Helpers** — `import { … } from 'ropegeo-common/helpers'` (and `import type { … }` for helper types such as `GetS3ObjectResult`). The full barrel includes Node-only modules (S3 folder upload uses `fs`); **React Native / Metro** should use **`ropegeo-common/helpers/network`** (sources under `src/helpers/network/`, barrel `index.ts`) for the request-timeout / abort helpers only (`NETWORK_REQUEST_*`, `installNetworkRequestPolicyTimers`, `mergeParentSignalWithDeadline`, `resolveRequestTimeoutMs`, `isAbortError`, `isNetworkRequestTimeoutError`, and related types).
15
- - **Download** — `import { … } from 'ropegeo-common/download'` for job orchestration (`DownloadJobQueue`, `DownloadJob`, tasks, dependencies). Not re-exported from `ropegeo-common/models`. Mobile implements `DownloadPlatformHarness` in its own `lib/download/` folder.
15
+ - **Download** — `import { … } from 'ropegeo-common/download'` for job orchestration (`DownloadJobQueue`, `DownloadJob`, tasks, dependencies). Not re-exported from `ropegeo-common/models`. Mobile implements `DownloadPlatformHarness` in its own `lib/download/` folder (including `paths.pageJson` for the offline page JSON filename/location).
16
16
 
17
17
  Helper tables use columns **Name**, **Description**, **Import**. Model tables add **Base class** after **Name** (`N/A` for enums, TypeScript-only type aliases, constants, registration functions, and classes without an exported superclass; otherwise the direct superclass).
18
18
 
@@ -69,6 +69,19 @@ Helper tables use columns **Name**, **Description**, **Import**. Model tables ad
69
69
  | --- | --- | --- |
70
70
  | `createCloudFrontInvalidation` | Creates a CloudFront cache invalidation for the given distribution paths. | `import { createCloudFrontInvalidation } from 'ropegeo-common/helpers'` |
71
71
 
72
+ ### Offline page bundle paths (`src/helpers/offlinePageBundlePaths.ts`)
73
+
74
+ Shared relative paths for server-built ZIP bundles and client on-disk storage. Backend zipper and mobile extract both use the same layout under the page root. The page JSON filename comes from `DownloadPlatformHarness.paths.pageJson`; path hydration after ZIP extract is handled by `OfflineRopewikiPageView.fromResult(wire, pageRoot)`.
75
+
76
+ | Name | Description | Import |
77
+ | --- | --- | --- |
78
+ | `imageFileRelativePath` | Relative path for a downloaded image slot. | `import { imageFileRelativePath } from 'ropegeo-common/helpers'` |
79
+ | `tileFileRelativePath` | Relative path for a vector tile (`.pbf`). | `import { tileFileRelativePath } from 'ropegeo-common/helpers'` |
80
+ | `offlineTilesTemplateRelative` | Mapbox-style tile URL template with `{z}/{x}/{y}` placeholders. | `import { offlineTilesTemplateRelative } from 'ropegeo-common/helpers'` |
81
+ | `regionRoutesGeojsonRelativePath` | Relative path for centered-region routes GeoJSON. | `import { regionRoutesGeojsonRelativePath } from 'ropegeo-common/helpers'` |
82
+ | `joinPageRootUri` | Joins page root URI with a relative bundle path. | `import { joinPageRootUri } from 'ropegeo-common/helpers'` |
83
+ | `hydrateOfflinePageWirePaths` | Rewrites relative paths in offline page wire JSON to absolute URIs (used by `OfflineRopewikiPageView.fromResult`). | `import { hydrateOfflinePageWirePaths } from 'ropegeo-common/helpers'` |
84
+
72
85
  ---
73
86
 
74
87
  ### Core enums (`src/models/` root files)
@@ -287,10 +300,16 @@ Import from **`ropegeo-common/download`**. Platform I/O (Expo FileSystem, Mapbox
287
300
  | `DownloadJobQueueStoredState` | Persisted queue envelope (`queueOrder`, `jobs`). | `import type { DownloadJobQueueStoredState } from 'ropegeo-common/download'` |
288
301
  | `DownloadJobStoredState` | Persisted single in-flight job. | `import type { DownloadJobStoredState } from 'ropegeo-common/download'` |
289
302
  | `DownloadDependencyKeys` | String keys for task dependency map entries. | `import { DownloadDependencyKeys } from 'ropegeo-common/download'` |
290
- | `planDownloadPhases` | Builds content phases for a full `OnlineRopewikiPageView` (explore path). | `import { planDownloadPhases } from 'ropegeo-common/download'` |
303
+ | `planDownloadPhases` | Routes to bundle or legacy phase plans based on `downloadFolder` on the page view/preview. | `import { planDownloadPhases } from 'ropegeo-common/download'` |
304
+ | `planBundleDownloadPhases` | Bundle path: `FetchDownloadFolder` (+ parallel Mapbox when page minimap bounds are known). | `import { planBundleDownloadPhases } from 'ropegeo-common/download'` |
305
+ | `planLegacyDownloadPhases` | Legacy multi-request path (images, tiles, region routes, save). | `import { planLegacyDownloadPhases } from 'ropegeo-common/download'` |
306
+ | `hasBundleDownloadFolder` | Returns true when a preview/view has a non-empty `downloadFolder` URL. | `import { hasBundleDownloadFolder } from 'ropegeo-common/download'` |
307
+ | `bundleDownloadFolderDependency` | Builds `FetchDownloadFolderTaskDependency` from an online view. | `import { bundleDownloadFolderDependency } from 'ropegeo-common/download'` |
291
308
  | `seedConsumerDependencies` | Seeds dependency objects for tasks in a phase plan. | `import { seedConsumerDependencies } from 'ropegeo-common/download'` |
292
309
  | `DeleteStoredPageTask` | Phase 1: delete existing offline bundle for the page. | `import { DeleteStoredPageTask } from 'ropegeo-common/download'` |
293
310
  | `FetchPageJsonTask` | Preview path: fetch page JSON and append content phases. | `import { FetchPageJsonTask } from 'ropegeo-common/download'` |
311
+ | `FetchDownloadFolderTask` | Bundle path: download ZIP, extract, hydrate `page-response.json`, set route previews. | `import { FetchDownloadFolderTask } from 'ropegeo-common/download'` |
312
+ | `FetchDownloadFolderTaskDependency` | Dependency: `downloadFolderUrl`, `parallelMapbox`. | `import { FetchDownloadFolderTaskDependency } from 'ropegeo-common/download'` |
294
313
  | `FetchImageFilesTask` | Download beta/banner image files. | `import { FetchImageFilesTask } from 'ropegeo-common/download'` |
295
314
  | `FetchMapboxPackTask` | Download Mapbox offline pack for page minimap bounds. | `import { FetchMapboxPackTask } from 'ropegeo-common/download'` |
296
315
  | `FetchRopeGeoTileListTask` | Parallel paginated tile key list fetches. | `import { FetchRopeGeoTileListTask } from 'ropegeo-common/download'` |
@@ -1,5 +1,6 @@
1
1
  export declare const DownloadDependencyKeys: {
2
2
  readonly FetchPageJson: "fetchPageJson";
3
+ readonly FetchDownloadFolder: "fetchDownloadFolder";
3
4
  readonly FetchImageFiles: "fetchImageFiles";
4
5
  readonly FetchMapboxPack: "fetchMapboxPack";
5
6
  readonly FetchRopeGeoTileList: "fetchRopeGeoTileList";
@@ -1 +1 @@
1
- {"version":3,"file":"downloadDependencyKeys.d.ts","sourceRoot":"","sources":["../../../src/download/dependencies/downloadDependencyKeys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB;;;;;;;;;;CAUzB,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAC7B,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC"}
1
+ {"version":3,"file":"downloadDependencyKeys.d.ts","sourceRoot":"","sources":["../../../src/download/dependencies/downloadDependencyKeys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB;;;;;;;;;;;CAWzB,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAC7B,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DownloadDependencyKeys = void 0;
4
4
  exports.DownloadDependencyKeys = {
5
5
  FetchPageJson: 'fetchPageJson',
6
+ FetchDownloadFolder: 'fetchDownloadFolder',
6
7
  FetchImageFiles: 'fetchImageFiles',
7
8
  FetchMapboxPack: 'fetchMapboxPack',
8
9
  FetchRopeGeoTileList: 'fetchRopeGeoTileList',
@@ -0,0 +1,14 @@
1
+ import type { DownloadTaskDependency } from '../types';
2
+ export declare class FetchDownloadFolderTaskDependency implements DownloadTaskDependency {
3
+ readonly dependencyKind: "fetchDownloadFolder";
4
+ readonly downloadFolderUrl: string;
5
+ /** When true, Mapbox runs in parallel with this task (explore path with page minimap). */
6
+ readonly parallelMapbox: boolean;
7
+ constructor(args: {
8
+ downloadFolderUrl: string;
9
+ parallelMapbox?: boolean;
10
+ });
11
+ toStoredState(): unknown;
12
+ static fromStoredState(raw: unknown): FetchDownloadFolderTaskDependency;
13
+ }
14
+ //# sourceMappingURL=fetchDownloadFolderTaskDependency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchDownloadFolderTaskDependency.d.ts","sourceRoot":"","sources":["../../../src/download/dependencies/fetchDownloadFolderTaskDependency.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,qBAAa,iCAAkC,YAAW,sBAAsB;IAC5E,QAAQ,CAAC,cAAc,EAAG,qBAAqB,CAAU;IACzD,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,0FAA0F;IAC1F,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;gBAErB,IAAI,EAAE;QACd,iBAAiB,EAAE,MAAM,CAAC;QAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;KAC5B;IAKD,aAAa,IAAI,OAAO;IAQxB,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,iCAAiC;CAa1E"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FetchDownloadFolderTaskDependency = void 0;
4
+ class FetchDownloadFolderTaskDependency {
5
+ constructor(args) {
6
+ this.dependencyKind = 'fetchDownloadFolder';
7
+ this.downloadFolderUrl = args.downloadFolderUrl;
8
+ this.parallelMapbox = args.parallelMapbox ?? false;
9
+ }
10
+ toStoredState() {
11
+ return {
12
+ dependencyKind: this.dependencyKind,
13
+ downloadFolderUrl: this.downloadFolderUrl,
14
+ parallelMapbox: this.parallelMapbox,
15
+ };
16
+ }
17
+ static fromStoredState(raw) {
18
+ if (raw == null || typeof raw !== 'object') {
19
+ throw new Error('FetchDownloadFolderTaskDependency must be an object');
20
+ }
21
+ const value = raw;
22
+ if (typeof value.downloadFolderUrl !== 'string' || value.downloadFolderUrl.length === 0) {
23
+ throw new Error('FetchDownloadFolderTaskDependency.downloadFolderUrl must be a non-empty string');
24
+ }
25
+ return new FetchDownloadFolderTaskDependency({
26
+ downloadFolderUrl: value.downloadFolderUrl,
27
+ parallelMapbox: value.parallelMapbox === true,
28
+ });
29
+ }
30
+ }
31
+ exports.FetchDownloadFolderTaskDependency = FetchDownloadFolderTaskDependency;
@@ -1 +1 @@
1
- {"version":3,"file":"downloadDependencyRegistry.d.ts","sourceRoot":"","sources":["../../../src/download/helpers/downloadDependencyRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAyBvD,wBAAgB,oCAAoC,CAAC,GAAG,EAAE,OAAO,GAAG,sBAAsB,CAczF"}
1
+ {"version":3,"file":"downloadDependencyRegistry.d.ts","sourceRoot":"","sources":["../../../src/download/helpers/downloadDependencyRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AA2BvD,wBAAgB,oCAAoC,CAAC,GAAG,EAAE,OAAO,GAAG,sBAAsB,CAczF"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.hydrateTaskDependencyFromStoredState = hydrateTaskDependencyFromStoredState;
4
4
  const fetchImageFilesTaskDependency_1 = require("../dependencies/fetchImageFilesTaskDependency");
5
5
  const fetchMapboxPackTaskDependency_1 = require("../dependencies/fetchMapboxPackTaskDependency");
6
+ const fetchDownloadFolderTaskDependency_1 = require("../dependencies/fetchDownloadFolderTaskDependency");
6
7
  const fetchPageJsonTaskDependency_1 = require("../dependencies/fetchPageJsonTaskDependency");
7
8
  const fetchRegionRouteListTaskDependency_1 = require("../dependencies/fetchRegionRouteListTaskDependency");
8
9
  const fetchRopeGeoTileFilesTaskDependency_1 = require("../dependencies/fetchRopeGeoTileFilesTaskDependency");
@@ -12,6 +13,7 @@ const saveOfflinePageMiniMapTaskDependency_1 = require("../dependencies/saveOffl
12
13
  const saveOfflinePageViewTaskDependency_1 = require("../dependencies/saveOfflinePageViewTaskDependency");
13
14
  const dependencyParsers = {
14
15
  fetchPageJson: fetchPageJsonTaskDependency_1.FetchPageJsonTaskDependency.fromStoredState,
16
+ fetchDownloadFolder: fetchDownloadFolderTaskDependency_1.FetchDownloadFolderTaskDependency.fromStoredState,
15
17
  fetchImageFiles: fetchImageFilesTaskDependency_1.FetchImageFilesTaskDependency.fromStoredState,
16
18
  fetchMapboxPack: fetchMapboxPackTaskDependency_1.FetchMapboxPackTaskDependency.fromStoredState,
17
19
  fetchRopeGeoTileList: fetchRopeGeoTileListTaskDependency_1.FetchRopeGeoTileListTaskDependency.fromStoredState,
@@ -1 +1 @@
1
- {"version":3,"file":"downloadPhaseTitles.d.ts","sourceRoot":"","sources":["../../../src/download/helpers/downloadPhaseTitles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,MAAM,CAwB3D;AAED,wBAAgB,0BAA0B,IAAI,aAAa,CAM1D"}
1
+ {"version":3,"file":"downloadPhaseTitles.d.ts","sourceRoot":"","sources":["../../../src/download/helpers/downloadPhaseTitles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AASjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,MAAM,CA2B3D;AAED,wBAAgB,0BAA0B,IAAI,aAAa,CAM1D"}
@@ -6,6 +6,7 @@ const downloadPhase_1 = require("../downloadPhase");
6
6
  const deleteStoredPageTask_1 = require("../tasks/deleteStoredPageTask");
7
7
  const fetchImageFilesTask_1 = require("../tasks/fetchImageFilesTask");
8
8
  const fetchMapboxPackTask_1 = require("../tasks/fetchMapboxPackTask");
9
+ const fetchDownloadFolderTask_1 = require("../tasks/fetchDownloadFolderTask");
9
10
  const fetchPageJsonTask_1 = require("../tasks/fetchPageJsonTask");
10
11
  const fetchRegionRouteListTask_1 = require("../tasks/fetchRegionRouteListTask");
11
12
  const fetchRopeGeoTileFilesTask_1 = require("../tasks/fetchRopeGeoTileFilesTask");
@@ -17,6 +18,9 @@ function titleForPhase(tasks) {
17
18
  if (tasks.length === 1 && tasks[0] instanceof fetchPageJsonTask_1.FetchPageJsonTask) {
18
19
  return 'Downloading page';
19
20
  }
21
+ if (tasks.some((task) => task instanceof fetchDownloadFolderTask_1.FetchDownloadFolderTask)) {
22
+ return 'Downloading page bundle';
23
+ }
20
24
  if (tasks.some((task) => task instanceof fetchRopeGeoTileFilesTask_1.FetchRopeGeoTileFilesTask)) {
21
25
  return 'Downloading map data';
22
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"downloadTaskRegistry.d.ts","sourceRoot":"","sources":["../../../src/download/helpers/downloadTaskRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAwBlE,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAmB7E"}
1
+ {"version":3,"file":"downloadTaskRegistry.d.ts","sourceRoot":"","sources":["../../../src/download/helpers/downloadTaskRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AA0BlE,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAmB7E"}
@@ -5,6 +5,7 @@ const errors_1 = require("../errors");
5
5
  const deleteStoredPageTask_1 = require("../tasks/deleteStoredPageTask");
6
6
  const fetchImageFilesTask_1 = require("../tasks/fetchImageFilesTask");
7
7
  const fetchMapboxPackTask_1 = require("../tasks/fetchMapboxPackTask");
8
+ const fetchDownloadFolderTask_1 = require("../tasks/fetchDownloadFolderTask");
8
9
  const fetchPageJsonTask_1 = require("../tasks/fetchPageJsonTask");
9
10
  const fetchRegionRouteListTask_1 = require("../tasks/fetchRegionRouteListTask");
10
11
  const fetchRopeGeoTileFilesTask_1 = require("../tasks/fetchRopeGeoTileFilesTask");
@@ -13,6 +14,7 @@ const saveOfflinePageTask_1 = require("../tasks/saveOfflinePageTask");
13
14
  const taskParsers = {
14
15
  deleteStoredPage: deleteStoredPageTask_1.DeleteStoredPageTask.fromStoredState,
15
16
  fetchPageJson: fetchPageJsonTask_1.FetchPageJsonTask.fromStoredState,
17
+ fetchDownloadFolder: fetchDownloadFolderTask_1.FetchDownloadFolderTask.fromStoredState,
16
18
  fetchImageFiles: fetchImageFilesTask_1.FetchImageFilesTask.fromStoredState,
17
19
  fetchMapboxPack: fetchMapboxPackTask_1.FetchMapboxPackTask.fromStoredState,
18
20
  fetchRopeGeoTileList: fetchRopeGeoTileListTask_1.FetchRopeGeoTileListTask.fromStoredState,
@@ -1,4 +1,11 @@
1
1
  import { OnlineRopewikiPageView } from '../../models/pageViews/onlineRopewikiPageView';
2
+ import { FetchDownloadFolderTaskDependency } from '../dependencies/fetchDownloadFolderTaskDependency';
2
3
  import { DownloadPhase } from '../downloadPhase';
4
+ export declare function hasBundleDownloadFolder(view: {
5
+ downloadFolder?: string | null;
6
+ }): boolean;
7
+ export declare function planBundleDownloadPhases(view: OnlineRopewikiPageView): DownloadPhase[];
8
+ export declare function planLegacyDownloadPhases(view: OnlineRopewikiPageView): DownloadPhase[];
3
9
  export declare function planDownloadPhases(view: OnlineRopewikiPageView): DownloadPhase[];
10
+ export declare function bundleDownloadFolderDependency(view: OnlineRopewikiPageView): FetchDownloadFolderTaskDependency;
4
11
  //# sourceMappingURL=planDownloadPhases.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"planDownloadPhases.d.ts","sourceRoot":"","sources":["../../../src/download/helpers/planDownloadPhases.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAGvF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AASjD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,aAAa,EAAE,CAmEhF"}
1
+ {"version":3,"file":"planDownloadPhases.d.ts","sourceRoot":"","sources":["../../../src/download/helpers/planDownloadPhases.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,iCAAiC,EAAE,MAAM,mDAAmD,CAAC;AAEtG,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAUjD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC1C,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,GAAG,OAAO,CAEV;AAWD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,sBAAsB,GAAG,aAAa,EAAE,CAWtF;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,sBAAsB,GAAG,aAAa,EAAE,CAmEtF;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,aAAa,EAAE,CAKhF;AAED,wBAAgB,8BAA8B,CAC1C,IAAI,EAAE,sBAAsB,GAC7B,iCAAiC,CAKnC"}
@@ -1,17 +1,44 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasBundleDownloadFolder = hasBundleDownloadFolder;
4
+ exports.planBundleDownloadPhases = planBundleDownloadPhases;
5
+ exports.planLegacyDownloadPhases = planLegacyDownloadPhases;
3
6
  exports.planDownloadPhases = planDownloadPhases;
7
+ exports.bundleDownloadFolderDependency = bundleDownloadFolderDependency;
4
8
  const miniMapType_1 = require("../../models/minimap/abstract/miniMapType");
5
9
  const downloadDependencyKeys_1 = require("../dependencies/downloadDependencyKeys");
10
+ const fetchDownloadFolderTaskDependency_1 = require("../dependencies/fetchDownloadFolderTaskDependency");
6
11
  const downloadPhaseTitles_1 = require("./downloadPhaseTitles");
7
12
  const downloadPhase_1 = require("../downloadPhase");
13
+ const fetchDownloadFolderTask_1 = require("../tasks/fetchDownloadFolderTask");
8
14
  const fetchImageFilesTask_1 = require("../tasks/fetchImageFilesTask");
9
15
  const fetchMapboxPackTask_1 = require("../tasks/fetchMapboxPackTask");
10
16
  const fetchRegionRouteListTask_1 = require("../tasks/fetchRegionRouteListTask");
11
17
  const fetchRopeGeoTileFilesTask_1 = require("../tasks/fetchRopeGeoTileFilesTask");
12
18
  const fetchRopeGeoTileListTask_1 = require("../tasks/fetchRopeGeoTileListTask");
13
19
  const saveOfflinePageTask_1 = require("../tasks/saveOfflinePageTask");
14
- function planDownloadPhases(view) {
20
+ function hasBundleDownloadFolder(view) {
21
+ return view.downloadFolder != null && view.downloadFolder.length > 0;
22
+ }
23
+ function needsParallelMapboxForBundle(view) {
24
+ const miniMap = view.miniMap;
25
+ return (miniMap != null &&
26
+ miniMap.fetchType === 'online' &&
27
+ miniMap.miniMapType === miniMapType_1.MiniMapType.Page);
28
+ }
29
+ function planBundleDownloadPhases(view) {
30
+ const tasks = [new fetchDownloadFolderTask_1.FetchDownloadFolderTask()];
31
+ if (needsParallelMapboxForBundle(view)) {
32
+ tasks.push(new fetchMapboxPackTask_1.FetchMapboxPackTask());
33
+ }
34
+ return [
35
+ new downloadPhase_1.DownloadPhase({
36
+ title: (0, downloadPhaseTitles_1.titleForPhase)(tasks),
37
+ tasks,
38
+ }),
39
+ ];
40
+ }
41
+ function planLegacyDownloadPhases(view) {
15
42
  const phases = [];
16
43
  const firstPhaseTasks = [];
17
44
  const imagesDependency = view.getFetchImagesTaskDependency();
@@ -67,3 +94,15 @@ function planDownloadPhases(view) {
67
94
  }));
68
95
  return phases;
69
96
  }
97
+ function planDownloadPhases(view) {
98
+ if (hasBundleDownloadFolder(view)) {
99
+ return planBundleDownloadPhases(view);
100
+ }
101
+ return planLegacyDownloadPhases(view);
102
+ }
103
+ function bundleDownloadFolderDependency(view) {
104
+ return new fetchDownloadFolderTaskDependency_1.FetchDownloadFolderTaskDependency({
105
+ downloadFolderUrl: view.downloadFolder,
106
+ parallelMapbox: needsParallelMapboxForBundle(view),
107
+ });
108
+ }
@@ -26,6 +26,8 @@ export { FetchImageFilesTask } from './tasks/fetchImageFilesTask';
26
26
  export { FetchMapboxPackTask } from './tasks/fetchMapboxPackTask';
27
27
  export { FetchRopeGeoTileFilesTask } from './tasks/fetchRopeGeoTileFilesTask';
28
28
  export { FetchRegionRouteListTask } from './tasks/fetchRegionRouteListTask';
29
+ export { FetchDownloadFolderTask } from './tasks/fetchDownloadFolderTask';
29
30
  export { SaveOfflinePageTask } from './tasks/saveOfflinePageTask';
30
- export { planDownloadPhases } from './helpers/planDownloadPhases';
31
+ export { planDownloadPhases, planLegacyDownloadPhases, planBundleDownloadPhases, hasBundleDownloadFolder, bundleDownloadFolderDependency } from './helpers/planDownloadPhases';
32
+ export { FetchDownloadFolderTaskDependency } from './dependencies/fetchDownloadFolderTaskDependency';
31
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/download/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,2BAA2B,EAC3B,sBAAsB,EACtB,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,oCAAoC,EAAE,MAAM,sCAAsC,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAE,kCAAkC,EAAE,MAAM,mDAAmD,CAAC;AACvG,OAAO,EAAE,mCAAmC,EAAE,MAAM,oDAAoD,CAAC;AACzG,OAAO,EAAE,kCAAkC,EAAE,MAAM,mDAAmD,CAAC;AACvG,OAAO,EAAE,iCAAiC,EAAE,MAAM,kDAAkD,CAAC;AACrG,OAAO,EAAE,mCAAmC,EAAE,MAAM,oDAAoD,CAAC;AACzG,OAAO,EAAE,oCAAoC,EAAE,MAAM,qDAAqD,CAAC;AAC3G,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAC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AAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC/K,OAAO,EAAE,iCAAiC,EAAE,MAAM,kDAAkD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.planDownloadPhases = exports.SaveOfflinePageTask = exports.FetchRegionRouteListTask = exports.FetchRopeGeoTileFilesTask = exports.FetchMapboxPackTask = exports.FetchImageFilesTask = exports.FetchRopeGeoTileListTask = exports.FetchPageJsonTask = exports.DeleteStoredPageTask = exports.DownloadTask = exports.enqueuePendingFileTransfer = exports.reconcilePendingFileTransfer = exports.isDownloadCancelledError = exports.InvalidDownloadJobStoredStateError = exports.DownloadCancelledError = exports.DOWNLOAD_CANCELLED_MESSAGE = exports.REGION_PAGES_PER_CHUNK = exports.TILE_FILE_BATCH_SIZE = exports.IMAGE_FILE_BATCH_SIZE = exports.LIST_HTTP_BATCH_SIZE = exports.TILE_LIST_PAGE_LIMIT = exports.buildDeleteStoredPagePhase = exports.titleForPhase = exports.DownloadJobQueue = exports.DownloadPhase = exports.DownloadJob = exports.SaveOfflinePageMiniMapTaskDependency = exports.SaveOfflinePageImagesTaskDependency = exports.SaveOfflinePageViewTaskDependency = exports.FetchRegionRouteListTaskDependency = exports.FetchRopeGeoTileFilesTaskDependency = exports.FetchRopeGeoTileListTaskDependency = exports.FetchMapboxPackTaskDependency = exports.FetchImageFilesTaskDependency = exports.FetchPageJsonTaskDependency = exports.DownloadDependencyKeys = exports.seedConsumerDependencies = exports.hydrateTaskDependencyFromStoredState = void 0;
3
+ exports.FetchDownloadFolderTaskDependency = exports.bundleDownloadFolderDependency = exports.hasBundleDownloadFolder = exports.planBundleDownloadPhases = exports.planLegacyDownloadPhases = exports.planDownloadPhases = exports.SaveOfflinePageTask = exports.FetchDownloadFolderTask = exports.FetchRegionRouteListTask = exports.FetchRopeGeoTileFilesTask = exports.FetchMapboxPackTask = exports.FetchImageFilesTask = exports.FetchRopeGeoTileListTask = exports.FetchPageJsonTask = exports.DeleteStoredPageTask = exports.DownloadTask = exports.enqueuePendingFileTransfer = exports.reconcilePendingFileTransfer = exports.isDownloadCancelledError = exports.InvalidDownloadJobStoredStateError = exports.DownloadCancelledError = exports.DOWNLOAD_CANCELLED_MESSAGE = exports.REGION_PAGES_PER_CHUNK = exports.TILE_FILE_BATCH_SIZE = exports.IMAGE_FILE_BATCH_SIZE = exports.LIST_HTTP_BATCH_SIZE = exports.TILE_LIST_PAGE_LIMIT = exports.buildDeleteStoredPagePhase = exports.titleForPhase = exports.DownloadJobQueue = exports.DownloadPhase = exports.DownloadJob = exports.SaveOfflinePageMiniMapTaskDependency = exports.SaveOfflinePageImagesTaskDependency = exports.SaveOfflinePageViewTaskDependency = exports.FetchRegionRouteListTaskDependency = exports.FetchRopeGeoTileFilesTaskDependency = exports.FetchRopeGeoTileListTaskDependency = exports.FetchMapboxPackTaskDependency = exports.FetchImageFilesTaskDependency = exports.FetchPageJsonTaskDependency = exports.DownloadDependencyKeys = exports.seedConsumerDependencies = exports.hydrateTaskDependencyFromStoredState = void 0;
4
4
  var downloadDependencyRegistry_1 = require("./helpers/downloadDependencyRegistry");
5
5
  Object.defineProperty(exports, "hydrateTaskDependencyFromStoredState", { enumerable: true, get: function () { return downloadDependencyRegistry_1.hydrateTaskDependencyFromStoredState; } });
6
6
  var seedConsumerDependencies_1 = require("./helpers/seedConsumerDependencies");
@@ -64,7 +64,15 @@ var fetchRopeGeoTileFilesTask_1 = require("./tasks/fetchRopeGeoTileFilesTask");
64
64
  Object.defineProperty(exports, "FetchRopeGeoTileFilesTask", { enumerable: true, get: function () { return fetchRopeGeoTileFilesTask_1.FetchRopeGeoTileFilesTask; } });
65
65
  var fetchRegionRouteListTask_1 = require("./tasks/fetchRegionRouteListTask");
66
66
  Object.defineProperty(exports, "FetchRegionRouteListTask", { enumerable: true, get: function () { return fetchRegionRouteListTask_1.FetchRegionRouteListTask; } });
67
+ var fetchDownloadFolderTask_1 = require("./tasks/fetchDownloadFolderTask");
68
+ Object.defineProperty(exports, "FetchDownloadFolderTask", { enumerable: true, get: function () { return fetchDownloadFolderTask_1.FetchDownloadFolderTask; } });
67
69
  var saveOfflinePageTask_1 = require("./tasks/saveOfflinePageTask");
68
70
  Object.defineProperty(exports, "SaveOfflinePageTask", { enumerable: true, get: function () { return saveOfflinePageTask_1.SaveOfflinePageTask; } });
69
71
  var planDownloadPhases_1 = require("./helpers/planDownloadPhases");
70
72
  Object.defineProperty(exports, "planDownloadPhases", { enumerable: true, get: function () { return planDownloadPhases_1.planDownloadPhases; } });
73
+ Object.defineProperty(exports, "planLegacyDownloadPhases", { enumerable: true, get: function () { return planDownloadPhases_1.planLegacyDownloadPhases; } });
74
+ Object.defineProperty(exports, "planBundleDownloadPhases", { enumerable: true, get: function () { return planDownloadPhases_1.planBundleDownloadPhases; } });
75
+ Object.defineProperty(exports, "hasBundleDownloadFolder", { enumerable: true, get: function () { return planDownloadPhases_1.hasBundleDownloadFolder; } });
76
+ Object.defineProperty(exports, "bundleDownloadFolderDependency", { enumerable: true, get: function () { return planDownloadPhases_1.bundleDownloadFolderDependency; } });
77
+ var fetchDownloadFolderTaskDependency_1 = require("./dependencies/fetchDownloadFolderTaskDependency");
78
+ Object.defineProperty(exports, "FetchDownloadFolderTaskDependency", { enumerable: true, get: function () { return fetchDownloadFolderTaskDependency_1.FetchDownloadFolderTaskDependency; } });
@@ -0,0 +1,14 @@
1
+ import type { DownloadJobContext, DownloadPlatformHarness, DownloadTaskStoredState, TaskTickResult } from '../types';
2
+ import { DownloadTask } from './abstractDownloadTask';
3
+ export declare class FetchDownloadFolderTask extends DownloadTask {
4
+ readonly taskKind = "fetchDownloadFolder";
5
+ readonly dependencyKeys: readonly ["fetchDownloadFolder"];
6
+ total: number;
7
+ constructor(completed?: number, total?: number);
8
+ runTick(ctx: DownloadJobContext, platformHarness: DownloadPlatformHarness, _signal: AbortSignal): Promise<TaskTickResult>;
9
+ private downloadExtractAndHydrate;
10
+ private maybeAppendMapboxPhaseAfterExtract;
11
+ toStoredState(): DownloadTaskStoredState;
12
+ static fromStoredState(raw: unknown): FetchDownloadFolderTask;
13
+ }
14
+ //# sourceMappingURL=fetchDownloadFolderTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchDownloadFolderTask.d.ts","sourceRoot":"","sources":["../../../src/download/tasks/fetchDownloadFolderTask.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,qBAAa,uBAAwB,SAAQ,YAAY;IACrD,QAAQ,CAAC,QAAQ,yBAAyB;IAC1C,QAAQ,CAAC,cAAc,mCAAyD;IAChF,KAAK,EAAE,MAAM,CAAC;gBAEF,SAAS,SAAI,EAAE,KAAK,SAAI;IAK9B,OAAO,CACT,GAAG,EAAE,kBAAkB,EACvB,eAAe,EAAE,uBAAuB,EACxC,OAAO,EAAE,WAAW,GACrB,OAAO,CAAC,cAAc,CAAC;YAmBZ,yBAAyB;YAuBzB,kCAAkC;IAoChD,aAAa,IAAI,uBAAuB;IAQxC,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,uBAAuB;CAIhE"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.FetchDownloadFolderTask = void 0;
37
+ const miniMapType_1 = require("../../models/minimap/abstract/miniMapType");
38
+ const offlineRopewikiPageView_1 = require("../../models/pageViews/offlineRopewikiPageView");
39
+ const downloadDependencyKeys_1 = require("../dependencies/downloadDependencyKeys");
40
+ const abstractDownloadTask_1 = require("./abstractDownloadTask");
41
+ class FetchDownloadFolderTask extends abstractDownloadTask_1.DownloadTask {
42
+ constructor(completed = 0, total = 1) {
43
+ super(completed);
44
+ this.taskKind = 'fetchDownloadFolder';
45
+ this.dependencyKeys = [downloadDependencyKeys_1.DownloadDependencyKeys.FetchDownloadFolder];
46
+ this.total = total;
47
+ }
48
+ async runTick(ctx, platformHarness, _signal) {
49
+ this.requireAllDependencies(ctx);
50
+ if (this.completed >= this.total) {
51
+ return { done: true };
52
+ }
53
+ const dep = this.requireDependency(ctx, downloadDependencyKeys_1.DownloadDependencyKeys.FetchDownloadFolder);
54
+ await this.downloadExtractAndHydrate(ctx, platformHarness, dep);
55
+ if (!dep.parallelMapbox) {
56
+ await this.maybeAppendMapboxPhaseAfterExtract(ctx, platformHarness);
57
+ }
58
+ this.completed = this.total;
59
+ return { done: true };
60
+ }
61
+ async downloadExtractAndHydrate(ctx, platformHarness, dep) {
62
+ const pageRoot = platformHarness.paths.pageRoot(ctx.pageId);
63
+ const zipPath = platformHarness.paths.zipTemp(ctx.pageId);
64
+ await platformHarness.downloadFile({
65
+ url: dep.downloadFolderUrl,
66
+ destPath: zipPath,
67
+ background: true,
68
+ });
69
+ await platformHarness.extractZipArchive({ zipPath, destRoot: pageRoot });
70
+ const jsonPath = platformHarness.paths.pageJson(ctx.pageId);
71
+ const rawJson = await platformHarness.readTextFile(jsonPath);
72
+ const offlineView = offlineRopewikiPageView_1.OfflineRopewikiPageView.fromResult(JSON.parse(rawJson), pageRoot);
73
+ await platformHarness.writeTextFile(jsonPath, JSON.stringify(offlineView));
74
+ await platformHarness.setRoutePreviewsForPage(ctx.pageId, [offlineView.toPagePreview()]);
75
+ }
76
+ async maybeAppendMapboxPhaseAfterExtract(ctx, platformHarness) {
77
+ const jsonPath = platformHarness.paths.pageJson(ctx.pageId);
78
+ const jsonText = await platformHarness.readTextFile(jsonPath);
79
+ const offlineView = offlineRopewikiPageView_1.OfflineRopewikiPageView.fromResult(JSON.parse(jsonText));
80
+ const miniMap = offlineView.miniMap;
81
+ if (miniMap == null || miniMap.miniMapType !== miniMapType_1.MiniMapType.Page) {
82
+ return;
83
+ }
84
+ const pageMiniMap = miniMap;
85
+ const [{ DownloadPhase }, { FetchMapboxPackTask }, { FetchMapboxPackTaskDependency }, { titleForPhase },] = await Promise.all([
86
+ Promise.resolve().then(() => __importStar(require('../downloadPhase'))),
87
+ Promise.resolve().then(() => __importStar(require('./fetchMapboxPackTask'))),
88
+ Promise.resolve().then(() => __importStar(require('../dependencies/fetchMapboxPackTaskDependency'))),
89
+ Promise.resolve().then(() => __importStar(require('../helpers/downloadPhaseTitles'))),
90
+ ]);
91
+ const mapboxTask = new FetchMapboxPackTask();
92
+ ctx.appendPhases([
93
+ new DownloadPhase({
94
+ title: titleForPhase([mapboxTask]),
95
+ tasks: [mapboxTask],
96
+ }),
97
+ ]);
98
+ ctx.setDependency(downloadDependencyKeys_1.DownloadDependencyKeys.FetchMapboxPack, new FetchMapboxPackTaskDependency(pageMiniMap.bounds));
99
+ }
100
+ toStoredState() {
101
+ return {
102
+ taskKind: this.taskKind,
103
+ completed: this.completed,
104
+ total: this.total,
105
+ };
106
+ }
107
+ static fromStoredState(raw) {
108
+ const value = raw;
109
+ return new FetchDownloadFolderTask(value.completed, value.total);
110
+ }
111
+ }
112
+ exports.FetchDownloadFolderTask = FetchDownloadFolderTask;
@@ -1 +1 @@
1
- {"version":3,"file":"fetchRopeGeoTileFilesTask.d.ts","sourceRoot":"","sources":["../../../src/download/tasks/fetchRopeGeoTileFilesTask.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAgBtD,qBAAa,yBAA0B,SAAQ,YAAY;IACvD,QAAQ,CAAC,QAAQ,2BAA2B;IAC5C,QAAQ,CAAC,cAAc,qCAA2D;IAClF,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,MAAM,CAAS;gBAEX,KAAK,EAAE,MAAM,EAAE,SAAS,SAAI,EAAE,MAAM,SAAI;IAM9C,OAAO,CACT,GAAG,EAAE,kBAAkB,EACvB,eAAe,EAAE,uBAAuB,EACxC,MAAM,EAAE,WAAW,GACpB,OAAO,CAAC,cAAc,CAAC;YAyCZ,qBAAqB;IAqBnC,aAAa,IAAI,uBAAuB;IASxC,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,yBAAyB;CAQlE"}
1
+ {"version":3,"file":"fetchRopeGeoTileFilesTask.d.ts","sourceRoot":"","sources":["../../../src/download/tasks/fetchRopeGeoTileFilesTask.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAgBtD,qBAAa,yBAA0B,SAAQ,YAAY;IACvD,QAAQ,CAAC,QAAQ,2BAA2B;IAC5C,QAAQ,CAAC,cAAc,qCAA2D;IAClF,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,MAAM,CAAS;gBAEX,KAAK,EAAE,MAAM,EAAE,SAAS,SAAI,EAAE,MAAM,SAAI;IAM9C,OAAO,CACT,GAAG,EAAE,kBAAkB,EACvB,eAAe,EAAE,uBAAuB,EACxC,MAAM,EAAE,WAAW,GACpB,OAAO,CAAC,cAAc,CAAC;YAyCZ,qBAAqB;IAqBnC,aAAa,IAAI,uBAAuB;IASxC,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,yBAAyB;CAQlE"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FetchRopeGeoTileFilesTask = void 0;
4
4
  const miniMapType_1 = require("../../models/minimap/abstract/miniMapType");
5
5
  const onlinePageMiniMap_1 = require("../../models/minimap/concrete/onlinePageMiniMap");
6
+ const offlinePageBundlePaths_1 = require("../../helpers/offlinePageBundlePaths");
6
7
  const downloadDependencyKeys_1 = require("../dependencies/downloadDependencyKeys");
7
8
  const saveOfflinePageMiniMapTaskDependency_1 = require("../dependencies/saveOfflinePageMiniMapTaskDependency");
8
9
  const downloadConstants_1 = require("../helpers/downloadConstants");
@@ -43,7 +44,7 @@ class FetchRopeGeoTileFilesTask extends abstractDownloadTask_1.DownloadTask {
43
44
  if (signal.aborted) {
44
45
  return;
45
46
  }
46
- const relativePath = relativePathFromTileUrl(tileUrl);
47
+ const relativePath = `mapdata/tiles/${relativePathFromTileUrl(tileUrl)}`;
47
48
  const destPath = platformHarness.paths.tileDest(ctx.pageId, relativePath);
48
49
  await platformHarness.ensureParentDir(destPath);
49
50
  await platformHarness.downloadFile({
@@ -67,7 +68,7 @@ class FetchRopeGeoTileFilesTask extends abstractDownloadTask_1.DownloadTask {
67
68
  throw new Error('FetchRopeGeoTileFilesTask expects a page minimap wire payload');
68
69
  }
69
70
  const onlineMiniMap = onlinePageMiniMap_1.OnlinePageMiniMap.fromResult(wire);
70
- const offlineTemplate = platformHarness.paths.tileDest(ctx.pageId, `${dep.mapDataId}/{z}/{x}/{y}.pbf`);
71
+ const offlineTemplate = platformHarness.paths.tileDest(ctx.pageId, (0, offlinePageBundlePaths_1.offlineTilesTemplateRelative)(dep.mapDataId));
71
72
  const offlineMiniMap = onlineMiniMap.toOffline(offlineTemplate);
72
73
  ctx.setDependency(downloadDependencyKeys_1.DownloadDependencyKeys.SaveOfflinePageMiniMap, new saveOfflinePageMiniMapTaskDependency_1.SaveOfflinePageMiniMapTaskDependency(offlineMiniMap.toPlain()));
73
74
  }
@@ -66,10 +66,15 @@ export type DownloadPlatformHarness = {
66
66
  ensureParentDir(filePath: string): Promise<void>;
67
67
  deletePageBundle(pageId: string): Promise<void>;
68
68
  gunzipTileIfNeeded(path: string): Promise<void>;
69
+ extractZipArchive(args: {
70
+ zipPath: string;
71
+ destRoot: string;
72
+ }): Promise<void>;
69
73
  paths: {
70
74
  pageRoot(pageId: string): string;
71
75
  pageJson(pageId: string): string;
72
76
  pageJsonTemp(pageId: string): string;
77
+ zipTemp(pageId: string): string;
73
78
  imageDest(pageId: string, imageId: string, slot: string, ext: string): string;
74
79
  tileDest(pageId: string, relativePath: string): string;
75
80
  regionGeojson(pageId: string, regionId: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/download/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,sBAAsB;IACnC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,aAAa,IAAI,OAAO,CAAC;CAC5B;AAED,MAAM,MAAM,kBAAkB,GACxB,QAAQ,GACR,SAAS,GACT,SAAS,GACT,OAAO,GACP,WAAW,CAAC;AAElB,MAAM,MAAM,qBAAqB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,kBAAkB,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,iBAAiB,CAAC;IA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,GAAG,IAAI,CAAC,CAAC;IAC5D,YAAY,CAAC,gBAAgB,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,uBAAuB,CACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,kBAAkB,EAAE,GAC/B,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAE/C,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACN,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;AAEnF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;CACjB,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Rewrites relative bundle paths in offline page wire JSON to absolute URIs under `pageRootUri`. */
2
+ export declare function hydrateOfflinePageWirePaths(pageRootUri: string, node: Record<string, unknown>): void;
3
+ //# sourceMappingURL=hydrateOfflinePageWirePaths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydrateOfflinePageWirePaths.d.ts","sourceRoot":"","sources":["../../src/helpers/hydrateOfflinePageWirePaths.ts"],"names":[],"mappings":"AA6BA,qGAAqG;AACrG,wBAAgB,2BAA2B,CACvC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,IAAI,CAiBN"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hydrateOfflinePageWirePaths = hydrateOfflinePageWirePaths;
4
+ const offlinePageBundlePaths_1 = require("./offlinePageBundlePaths");
5
+ const PATH_LIKE_KEYS = new Set([
6
+ 'downloadedBannerPath',
7
+ 'downloadedFullPath',
8
+ 'offlineTilesTemplate',
9
+ 'downloadedGeojson',
10
+ ]);
11
+ function isRelativeBundlePath(value) {
12
+ if (value.length === 0) {
13
+ return false;
14
+ }
15
+ if (value.startsWith('file://')) {
16
+ return false;
17
+ }
18
+ if (value.startsWith('http://') || value.startsWith('https://')) {
19
+ return false;
20
+ }
21
+ return !value.includes('://');
22
+ }
23
+ function hydratePathValue(pageRootUri, value) {
24
+ if (typeof value !== 'string' || !isRelativeBundlePath(value)) {
25
+ return value;
26
+ }
27
+ return (0, offlinePageBundlePaths_1.joinPageRootUri)(pageRootUri, value);
28
+ }
29
+ /** Rewrites relative bundle paths in offline page wire JSON to absolute URIs under `pageRootUri`. */
30
+ function hydrateOfflinePageWirePaths(pageRootUri, node) {
31
+ for (const [key, value] of Object.entries(node)) {
32
+ if (PATH_LIKE_KEYS.has(key)) {
33
+ node[key] = hydratePathValue(pageRootUri, value);
34
+ continue;
35
+ }
36
+ if (value != null && typeof value === 'object' && !Array.isArray(value)) {
37
+ hydrateOfflinePageWirePaths(pageRootUri, value);
38
+ }
39
+ if (Array.isArray(value)) {
40
+ for (const item of value) {
41
+ if (item != null && typeof item === 'object') {
42
+ hydrateOfflinePageWirePaths(pageRootUri, item);
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
@@ -15,4 +15,6 @@ export { default as sendSQSMessage } from './sqs/sendSQSMessage';
15
15
  export { default as deleteSQSMessage } from './sqs/deleteSQSMessage';
16
16
  export { default as changeSQSMessageVisibilityTimeout } from './sqs/changeSQSMessageVisibilityTimeout';
17
17
  export { createCloudFrontInvalidation } from './cloudfront/createCloudFrontInvalidation';
18
+ export { imageFileRelativePath, mapDataTilesDirectoryRelative, tileFileRelativePath, offlineTilesTemplateRelative, regionRoutesGeojsonRelativePath, joinPageRootUri, } from './offlinePageBundlePaths';
19
+ export { hydrateOfflinePageWirePaths } from './hydrateOfflinePageWirePaths';
18
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACH,iCAAiC,EACjC,iCAAiC,EACjC,YAAY,EACZ,4BAA4B,EAC5B,6BAA6B,EAC7B,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,kCAAkC,GAC1C,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD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,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAEvG,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAEzF,OAAO,EACH,qBAAqB,EACrB,6BAA6B,EAC7B,oBAAoB,EACpB,4BAA4B,EAC5B,+BAA+B,EAC/B,eAAe,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC"}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createCloudFrontInvalidation = exports.changeSQSMessageVisibilityTimeout = exports.deleteSQSMessage = exports.sendSQSMessage = exports.resetSQSClientForTests = exports.getSQSClient = exports.replaceS3Folder = exports.putS3Folder = exports.listS3Folder = exports.deleteS3Object = exports.putS3Object = exports.getS3Object = exports.listS3Objects = exports.resetS3ClientForTests = exports.getS3Client = exports.resolveRequestTimeoutMs = exports.mergeParentSignalWithDeadline = exports.isNetworkRequestTimeoutError = exports.isAbortError = exports.installNetworkRequestPolicyTimers = exports.NETWORK_REQUEST_TIMED_OUT_MESSAGE = exports.timeoutAfter = exports.ProgressLogger = exports.httpRequest = void 0;
6
+ exports.hydrateOfflinePageWirePaths = exports.joinPageRootUri = exports.regionRoutesGeojsonRelativePath = exports.offlineTilesTemplateRelative = exports.tileFileRelativePath = exports.mapDataTilesDirectoryRelative = exports.imageFileRelativePath = exports.createCloudFrontInvalidation = exports.changeSQSMessageVisibilityTimeout = exports.deleteSQSMessage = exports.sendSQSMessage = exports.resetSQSClientForTests = exports.getSQSClient = exports.replaceS3Folder = exports.putS3Folder = exports.listS3Folder = exports.deleteS3Object = exports.putS3Object = exports.getS3Object = exports.listS3Objects = exports.resetS3ClientForTests = exports.getS3Client = exports.resolveRequestTimeoutMs = exports.mergeParentSignalWithDeadline = exports.isNetworkRequestTimeoutError = exports.isAbortError = exports.installNetworkRequestPolicyTimers = exports.NETWORK_REQUEST_TIMED_OUT_MESSAGE = exports.timeoutAfter = exports.ProgressLogger = exports.httpRequest = void 0;
7
7
  var httpRequest_1 = require("./httpRequest");
8
8
  Object.defineProperty(exports, "httpRequest", { enumerable: true, get: function () { return httpRequest_1.httpRequest; } });
9
9
  var progressLogger_1 = require("./progressLogger");
@@ -45,3 +45,12 @@ var changeSQSMessageVisibilityTimeout_1 = require("./sqs/changeSQSMessageVisibil
45
45
  Object.defineProperty(exports, "changeSQSMessageVisibilityTimeout", { enumerable: true, get: function () { return __importDefault(changeSQSMessageVisibilityTimeout_1).default; } });
46
46
  var createCloudFrontInvalidation_1 = require("./cloudfront/createCloudFrontInvalidation");
47
47
  Object.defineProperty(exports, "createCloudFrontInvalidation", { enumerable: true, get: function () { return createCloudFrontInvalidation_1.createCloudFrontInvalidation; } });
48
+ var offlinePageBundlePaths_1 = require("./offlinePageBundlePaths");
49
+ Object.defineProperty(exports, "imageFileRelativePath", { enumerable: true, get: function () { return offlinePageBundlePaths_1.imageFileRelativePath; } });
50
+ Object.defineProperty(exports, "mapDataTilesDirectoryRelative", { enumerable: true, get: function () { return offlinePageBundlePaths_1.mapDataTilesDirectoryRelative; } });
51
+ Object.defineProperty(exports, "tileFileRelativePath", { enumerable: true, get: function () { return offlinePageBundlePaths_1.tileFileRelativePath; } });
52
+ Object.defineProperty(exports, "offlineTilesTemplateRelative", { enumerable: true, get: function () { return offlinePageBundlePaths_1.offlineTilesTemplateRelative; } });
53
+ Object.defineProperty(exports, "regionRoutesGeojsonRelativePath", { enumerable: true, get: function () { return offlinePageBundlePaths_1.regionRoutesGeojsonRelativePath; } });
54
+ Object.defineProperty(exports, "joinPageRootUri", { enumerable: true, get: function () { return offlinePageBundlePaths_1.joinPageRootUri; } });
55
+ var hydrateOfflinePageWirePaths_1 = require("./hydrateOfflinePageWirePaths");
56
+ Object.defineProperty(exports, "hydrateOfflinePageWirePaths", { enumerable: true, get: function () { return hydrateOfflinePageWirePaths_1.hydrateOfflinePageWirePaths; } });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Canonical relative paths inside an offline page bundle (ZIP or on-disk folder).
3
+ * Backend zipper and client legacy download both use these paths under the page root.
4
+ */
5
+ export declare function imageFileRelativePath(imageId: string, slot: string, ext: string): string;
6
+ export declare function mapDataTilesDirectoryRelative(mapDataId: string): string;
7
+ export declare function tileFileRelativePath(mapDataId: string, z: number, x: number, y: number): string;
8
+ /** Template for Mapbox local tile URLs (`{z}`, `{x}`, `{y}` placeholders). */
9
+ export declare function offlineTilesTemplateRelative(mapDataId: string): string;
10
+ export declare function regionRoutesGeojsonRelativePath(regionId: string): string;
11
+ export declare function joinPageRootUri(pageRootUri: string, relativePath: string): string;
12
+ //# sourceMappingURL=offlinePageBundlePaths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"offlinePageBundlePaths.d.ts","sourceRoot":"","sources":["../../src/helpers/offlinePageBundlePaths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,qBAAqB,CACjC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACZ,MAAM,CAGR;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,wBAAgB,oBAAoB,CAChC,SAAS,EAAE,MAAM,EACjB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACV,MAAM,CAER;AAED,8EAA8E;AAC9E,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAIjF"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * Canonical relative paths inside an offline page bundle (ZIP or on-disk folder).
4
+ * Backend zipper and client legacy download both use these paths under the page root.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.imageFileRelativePath = imageFileRelativePath;
8
+ exports.mapDataTilesDirectoryRelative = mapDataTilesDirectoryRelative;
9
+ exports.tileFileRelativePath = tileFileRelativePath;
10
+ exports.offlineTilesTemplateRelative = offlineTilesTemplateRelative;
11
+ exports.regionRoutesGeojsonRelativePath = regionRoutesGeojsonRelativePath;
12
+ exports.joinPageRootUri = joinPageRootUri;
13
+ function imageFileRelativePath(imageId, slot, ext) {
14
+ const normalizedExt = ext.startsWith('.') ? ext : `.${ext}`;
15
+ return `images/${imageId}-${slot}${normalizedExt}`;
16
+ }
17
+ function mapDataTilesDirectoryRelative(mapDataId) {
18
+ return `mapdata/tiles/${mapDataId}`;
19
+ }
20
+ function tileFileRelativePath(mapDataId, z, x, y) {
21
+ return `${mapDataTilesDirectoryRelative(mapDataId)}/${z}/${x}/${y}.pbf`;
22
+ }
23
+ /** Template for Mapbox local tile URLs (`{z}`, `{x}`, `{y}` placeholders). */
24
+ function offlineTilesTemplateRelative(mapDataId) {
25
+ return `${mapDataTilesDirectoryRelative(mapDataId)}/{z}/{x}/{y}.pbf`;
26
+ }
27
+ function regionRoutesGeojsonRelativePath(regionId) {
28
+ return `regions/${regionId}/routes.geojson`;
29
+ }
30
+ function joinPageRootUri(pageRootUri, relativePath) {
31
+ const root = pageRootUri.endsWith('/') ? pageRootUri : `${pageRootUri}/`;
32
+ const rel = relativePath.startsWith('/') ? relativePath.slice(1) : relativePath;
33
+ return `${root}${rel}`;
34
+ }
@@ -35,6 +35,6 @@ export declare class OfflineRopewikiPageView extends RopewikiPageView implements
35
35
  lon: number;
36
36
  } | null);
37
37
  toPagePreview(): OfflinePagePreview;
38
- static fromResult(result: unknown): OfflineRopewikiPageView;
38
+ static fromResult(result: unknown, pageRoot?: string | null): OfflineRopewikiPageView;
39
39
  }
40
40
  //# sourceMappingURL=offlineRopewikiPageView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"offlineRopewikiPageView.d.ts","sourceRoot":"","sources":["../../../src/models/pageViews/offlineRopewikiPageView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAkC,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,qBAAa,uBAAwB,SAAQ,gBAAiB,YAAW,eAAe;IACpF,QAAQ,CAAC,SAAS,EAAG,SAAS,CAAU;IACxC,WAAW,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAC5C,YAAY,EAAE,kBAAkB,EAAE,CAAC;IACnC,OAAO,EAAE,kBAAkB,GAAG,4BAA4B,GAAG,IAAI,CAAC;gBAG9D,EAAE,EAAE,MAAM,EACV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M,CAAA;KAAE,GAAG,MAAM,GAAG,IAAI,EACtD,gBAAgB,EAAE,MAAM,GAAG,IAAI,EAC/B,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,MAAM,EAAE,MAAM,EAAE,EAChB,kBAAkB,EAAE,IAAI,EACxB,WAAW,EAAE,uBAAuB,GAAG,IAAI,EAC3C,YAAY,EAAE,kBAAkB,EAAE,EAClC,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,OAAO,EAAE,kBAAkB,GAAG,4BAA4B,GAAG,IAAI,EACjE,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAuCpD,aAAa,IAAI,kBAAkB;IAqBnC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,uBAAuB;CA0CxF"}
@@ -9,6 +9,7 @@ const offlinePageMiniMap_1 = require("../minimap/concrete/offlinePageMiniMap");
9
9
  const offlinePagePreview_1 = require("../previews/offlinePagePreview");
10
10
  const pageDataSource_1 = require("../pageDataSource");
11
11
  const ropewikiPageView_1 = require("./ropewikiPageView");
12
+ const hydrateOfflinePageWirePaths_1 = require("../../helpers/hydrateOfflinePageWirePaths");
12
13
  class OfflineRopewikiPageView extends ropewikiPageView_1.RopewikiPageView {
13
14
  constructor(id, routeType, name, aka, url, quality, userVotes, regions, difficultyRating, permit, rappelCount, jumps, vehicle, rappelLongest, shuttleTime, overallLength, descentLength, exitLength, approachLength, overallTime, approachTime, descentTime, exitTime, approachElevGain, descentElevGain, exitElevGain, months, latestRevisionDate, bannerImage, betaSections, mapDataId, miniMap, coordinates) {
14
15
  super(id, routeType, name, aka, url, quality, userVotes, regions, difficultyRating, permit, rappelCount, jumps, vehicle, rappelLongest, shuttleTime, overallLength, descentLength, exitLength, approachLength, overallTime, approachTime, descentTime, exitTime, approachElevGain, descentElevGain, exitElevGain, months, latestRevisionDate, mapDataId, coordinates);
@@ -23,12 +24,15 @@ class OfflineRopewikiPageView extends ropewikiPageView_1.RopewikiPageView {
23
24
  : null;
24
25
  return new offlinePagePreview_1.OfflinePagePreview(this.id, pageDataSource_1.PageDataSource.Ropewiki, this.bannerImage?.downloadedBannerPath ?? null, this.quality, this.userVotes, this.name, this.regions.map((region) => region.name), this.aka, this.difficultyRating, mapData, this.url, this.permit);
25
26
  }
26
- static fromResult(result) {
27
+ static fromResult(result, pageRoot) {
27
28
  if (result == null || typeof result !== 'object') {
28
29
  throw new Error('OfflineRopewikiPageView result must be an object');
29
30
  }
30
31
  const r = result;
31
32
  ropewikiPageView_1.RopewikiPageView.validateCommonFields(r, 'offline', 'OfflineRopewikiPageView');
33
+ if (pageRoot != null && pageRoot.length > 0) {
34
+ (0, hydrateOfflinePageWirePaths_1.hydrateOfflinePageWirePaths)(pageRoot, r);
35
+ }
32
36
  r.bannerImage =
33
37
  r.bannerImage == null
34
38
  ? null
@@ -21,6 +21,7 @@ export declare class OnlineRopewikiPageView extends RopewikiPageView implements
21
21
  bannerImage: OnlineBetaSectionImage | null;
22
22
  betaSections: OnlineBetaSection[];
23
23
  miniMap: OnlinePageMiniMap | OnlineCenteredRegionMiniMap | null;
24
+ downloadFolder: string | null;
24
25
  constructor(id: string, routeType: RouteType, name: string, aka: string[], url: string, quality: number, userVotes: number, regions: {
25
26
  name: string;
26
27
  id: string;
@@ -42,7 +43,7 @@ export declare class OnlineRopewikiPageView extends RopewikiPageView implements
42
43
  } | number | null, approachElevGain: number | null, descentElevGain: number | null, exitElevGain: number | null, months: string[], latestRevisionDate: Date, bannerImage: OnlineBetaSectionImage | null, betaSections: OnlineBetaSection[], mapDataId: string | null, miniMap: OnlinePageMiniMap | OnlineCenteredRegionMiniMap | null, coordinates: {
43
44
  lat: number;
44
45
  lon: number;
45
- } | null);
46
+ } | null, downloadFolder?: string | null);
46
47
  getFetchImagesTaskDependency(): FetchImageFilesTaskDependency;
47
48
  toDownloadJob(config: DownloadJobConfig): DownloadJob;
48
49
  toPlain(): Record<string, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"onlineRopewikiPageView.d.ts","sourceRoot":"","sources":["../../../src/models/pageViews/onlineRopewikiPageView.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAgB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAkC,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,2DAA2D,CAAC;AAG1G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,qBAAa,sBAAuB,SAAQ,gBAAiB,YAAW,cAAc;IAClF,QAAQ,CAA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AC9B,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,MAAM,EAAE,MAAM,EAAE,EAChB,kBAAkB,EAAE,IAAI,EACxB,WAAW,EAAE,sBAAsB,GAAG,IAAI,EAC1C,YAAY,EAAE,iBAAiB,EAAE,EACjC,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,OAAO,EAAE,iBAAiB,GAAG,2BAA2B,GAAG,IAAI,EAC/D,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,EAChD,cAAc,GAAE,MAAM,GAAG,IAAW;IAwCxC,4BAA4B,IAAI,6BAA6B;IA8B7D,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW;IAoBrD,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQlC,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,aAAa,EAAE;IAIxE,SAAS,CACL,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EACtD,iBAAiB,CAAC,EAAE,kBAAkB,GAAG,4BAA4B,GAAG,IAAI,GAC7E,uBAAuB;IAwE1B,aAAa,IAAI,iBAAiB;IAsBlC,WAAW,IAAI,SAAS;IAIxB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,sBAAsB;CAiD7D"}
@@ -17,14 +17,16 @@ const downloadPhaseTitles_1 = require("../../download/helpers/downloadPhaseTitle
17
17
  const downloadJob_1 = require("../../download/downloadJob");
18
18
  const fetchImageFilesTaskDependency_1 = require("../../download/dependencies/fetchImageFilesTaskDependency");
19
19
  const planDownloadPhases_1 = require("../../download/helpers/planDownloadPhases");
20
+ const downloadDependencyKeys_1 = require("../../download/dependencies/downloadDependencyKeys");
20
21
  const seedConsumerDependencies_1 = require("../../download/helpers/seedConsumerDependencies");
21
22
  class OnlineRopewikiPageView extends ropewikiPageView_1.RopewikiPageView {
22
- constructor(id, routeType, name, aka, url, quality, userVotes, regions, difficultyRating, permit, rappelCount, jumps, vehicle, rappelLongest, shuttleTime, overallLength, descentLength, exitLength, approachLength, overallTime, approachTime, descentTime, exitTime, approachElevGain, descentElevGain, exitElevGain, months, latestRevisionDate, bannerImage, betaSections, mapDataId, miniMap, coordinates) {
23
+ constructor(id, routeType, name, aka, url, quality, userVotes, regions, difficultyRating, permit, rappelCount, jumps, vehicle, rappelLongest, shuttleTime, overallLength, descentLength, exitLength, approachLength, overallTime, approachTime, descentTime, exitTime, approachElevGain, descentElevGain, exitElevGain, months, latestRevisionDate, bannerImage, betaSections, mapDataId, miniMap, coordinates, downloadFolder = null) {
23
24
  super(id, routeType, name, aka, url, quality, userVotes, regions, difficultyRating, permit, rappelCount, jumps, vehicle, rappelLongest, shuttleTime, overallLength, descentLength, exitLength, approachLength, overallTime, approachTime, descentTime, exitTime, approachElevGain, descentElevGain, exitElevGain, months, latestRevisionDate, mapDataId, coordinates);
24
25
  this.fetchType = 'online';
25
26
  this.bannerImage = bannerImage;
26
27
  this.betaSections = betaSections;
27
28
  this.miniMap = miniMap;
29
+ this.downloadFolder = downloadFolder;
28
30
  }
29
31
  getFetchImagesTaskDependency() {
30
32
  const slots = [];
@@ -58,6 +60,10 @@ class OnlineRopewikiPageView extends ropewikiPageView_1.RopewikiPageView {
58
60
  const contentPhases = OnlineRopewikiPageView.planDownloadPhases(this);
59
61
  const allPhases = [(0, downloadPhaseTitles_1.buildDeleteStoredPagePhase)(), ...contentPhases];
60
62
  const dependencies = (0, seedConsumerDependencies_1.seedConsumerDependencies)(this, allPhases.flatMap((phase) => phase.tasks));
63
+ if ((0, planDownloadPhases_1.hasBundleDownloadFolder)(this)) {
64
+ dependencies[downloadDependencyKeys_1.DownloadDependencyKeys.FetchDownloadFolder] =
65
+ (0, planDownloadPhases_1.bundleDownloadFolderDependency)(this);
66
+ }
61
67
  return new downloadJob_1.DownloadJob({
62
68
  pageId: this.id,
63
69
  pageViewType: this.pageViewType,
@@ -96,7 +102,7 @@ class OnlineRopewikiPageView extends ropewikiPageView_1.RopewikiPageView {
96
102
  const mapData = this.miniMap != null && this.miniMap.miniMapType === miniMapType_1.MiniMapType.Page
97
103
  ? this.mapDataId
98
104
  : null;
99
- return new onlinePagePreview_1.OnlinePagePreview(this.id, pageDataSource_1.PageDataSource.Ropewiki, this.bannerImage?.bannerUrl ?? null, this.quality, this.userVotes, this.name, this.regions.map((region) => region.name), this.aka, this.difficultyRating, mapData, this.url, this.permit);
105
+ return new onlinePagePreview_1.OnlinePagePreview(this.id, pageDataSource_1.PageDataSource.Ropewiki, this.bannerImage?.bannerUrl ?? null, this.quality, this.userVotes, this.name, this.regions.map((region) => region.name), this.aka, this.difficultyRating, mapData, this.url, this.permit, this.downloadFolder);
100
106
  }
101
107
  toSavedPage() {
102
108
  return new savedPage_1.SavedPage(this.toPagePreview(), Date.now(), null);
@@ -133,6 +139,14 @@ class OnlineRopewikiPageView extends ropewikiPageView_1.RopewikiPageView {
133
139
  else {
134
140
  throw new Error(`OnlineRopewikiPageView.miniMap must be object or null, got: ${typeof r.miniMap}`);
135
141
  }
142
+ if (r.downloadFolder !== undefined && r.downloadFolder !== null) {
143
+ if (typeof r.downloadFolder !== 'string') {
144
+ throw new Error(`OnlineRopewikiPageView.downloadFolder must be string or null, got: ${typeof r.downloadFolder}`);
145
+ }
146
+ }
147
+ else {
148
+ r.downloadFolder = null;
149
+ }
136
150
  Object.setPrototypeOf(r, OnlineRopewikiPageView.prototype);
137
151
  return r;
138
152
  }
@@ -5,7 +5,8 @@ import type { DownloadJobConfig } from '../../download/types';
5
5
  export declare class OnlinePagePreview extends PagePreview {
6
6
  readonly fetchType: "online";
7
7
  imageUrl: string | null;
8
- constructor(id: string, source: import('../pageDataSource').PageDataSource, imageUrl: string | null, rating: number | null, ratingCount: number | null, title: string, regions: string[], aka: string[], difficultyRating: import('../difficulty/difficultyRating').DifficultyRating, mapData: string | null, externalLink: string | null, permit: import('../permitStatus').PermitStatus | null);
8
+ downloadFolder: string | null;
9
+ constructor(id: string, source: import('../pageDataSource').PageDataSource, imageUrl: string | null, rating: number | null, ratingCount: number | null, title: string, regions: string[], aka: string[], difficultyRating: import('../difficulty/difficultyRating').DifficultyRating, mapData: string | null, externalLink: string | null, permit: import('../permitStatus').PermitStatus | null, downloadFolder?: string | null);
9
10
  toOffline(downloadedImagePath: string | null): OfflinePagePreview;
10
11
  toDownloadJob(config: DownloadJobConfig): DownloadJob;
11
12
  static fromResult(result: unknown): OnlinePagePreview;
@@ -1 +1 @@
1
- {"version":3,"file":"onlinePagePreview.d.ts","sourceRoot":"","sources":["../../../src/models/previews/onlinePagePreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAA6B,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAS9D,qBAAa,iBAAkB,SAAQ,WAAW;IAC9C,QAAQ,CAAC,SAAS,EAAG,QAAQ,CAAU;IACvC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;gBAGpB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,OAAO,mBAAmB,EAAE,cAAc,EAClD,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EAAE,EACjB,GAAG,EAAE,MAAM,EAAE,EACb,gBAAgB,EAAE,OAAO,gCAAgC,EAAE,gBAAgB,EAC3E,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,MAAM,EAAE,OAAO,iBAAiB,EAAE,YAAY,GAAG,IAAI;IAkBzD,SAAS,CAAC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,GAAG,WAAW;IA6CrD,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,iBAAiB;CAexD"}
@@ -8,14 +8,18 @@ const downloadPhase_1 = require("../../download/downloadPhase");
8
8
  const downloadPhaseTitles_1 = require("../../download/helpers/downloadPhaseTitles");
9
9
  const downloadDependencyKeys_1 = require("../../download/dependencies/downloadDependencyKeys");
10
10
  const fetchPageJsonTaskDependency_1 = require("../../download/dependencies/fetchPageJsonTaskDependency");
11
+ const fetchDownloadFolderTaskDependency_1 = require("../../download/dependencies/fetchDownloadFolderTaskDependency");
12
+ const fetchDownloadFolderTask_1 = require("../../download/tasks/fetchDownloadFolderTask");
11
13
  const fetchPageJsonTask_1 = require("../../download/tasks/fetchPageJsonTask");
14
+ const planDownloadPhases_1 = require("../../download/helpers/planDownloadPhases");
12
15
  const pageDataSource_1 = require("../pageDataSource");
13
16
  const pageViewType_1 = require("../pageViews/pageViewType");
14
17
  class OnlinePagePreview extends pagePreview_1.PagePreview {
15
- constructor(id, source, imageUrl, rating, ratingCount, title, regions, aka, difficultyRating, mapData, externalLink, permit) {
18
+ constructor(id, source, imageUrl, rating, ratingCount, title, regions, aka, difficultyRating, mapData, externalLink, permit, downloadFolder = null) {
16
19
  super(id, source, rating, ratingCount, title, regions, aka, difficultyRating, mapData, externalLink, permit);
17
20
  this.fetchType = 'online';
18
21
  this.imageUrl = imageUrl;
22
+ this.downloadFolder = downloadFolder;
19
23
  }
20
24
  toOffline(downloadedImagePath) {
21
25
  return new offlinePagePreview_1.OfflinePagePreview(this.id, this.source, downloadedImagePath, this.rating, this.ratingCount, this.title, this.regions, this.aka, this.difficultyRating, this.mapData, this.externalLink, this.permit);
@@ -27,6 +31,25 @@ class OnlinePagePreview extends pagePreview_1.PagePreview {
27
31
  if (pageViewType == null) {
28
32
  throw new Error(`Unsupported page preview source "${String(this.source)}"`);
29
33
  }
34
+ if ((0, planDownloadPhases_1.hasBundleDownloadFolder)(this)) {
35
+ const folderTask = new fetchDownloadFolderTask_1.FetchDownloadFolderTask();
36
+ const bundlePhase = new downloadPhase_1.DownloadPhase({
37
+ title: (0, downloadPhaseTitles_1.titleForPhase)([folderTask]),
38
+ tasks: [folderTask],
39
+ });
40
+ return new downloadJob_1.DownloadJob({
41
+ pageId: this.id,
42
+ pageViewType,
43
+ config,
44
+ phases: [(0, downloadPhaseTitles_1.buildDeleteStoredPagePhase)(), bundlePhase],
45
+ taskDependencies: {
46
+ [downloadDependencyKeys_1.DownloadDependencyKeys.FetchDownloadFolder]: new fetchDownloadFolderTaskDependency_1.FetchDownloadFolderTaskDependency({
47
+ downloadFolderUrl: this.downloadFolder,
48
+ parallelMapbox: false,
49
+ }),
50
+ },
51
+ });
52
+ }
30
53
  const fetchPageTask = new fetchPageJsonTask_1.FetchPageJsonTask();
31
54
  const fetchPagePhase = new downloadPhase_1.DownloadPhase({
32
55
  title: (0, downloadPhaseTitles_1.titleForPhase)([fetchPageTask]),
@@ -49,6 +72,12 @@ class OnlinePagePreview extends pagePreview_1.PagePreview {
49
72
  const r = result;
50
73
  pagePreview_1.PagePreview.validateCommonFields(r, 'online', 'OnlinePagePreview');
51
74
  pagePreview_1.PagePreview.assertNullableString(r, 'imageUrl');
75
+ if (r.downloadFolder !== undefined && r.downloadFolder !== null) {
76
+ pagePreview_1.PagePreview.assertNullableString(r, 'downloadFolder');
77
+ }
78
+ else {
79
+ r.downloadFolder = null;
80
+ }
52
81
  Object.setPrototypeOf(r, OnlinePagePreview.prototype);
53
82
  return r;
54
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ropegeo-common",
3
- "version": "1.18.3",
3
+ "version": "1.19.0",
4
4
  "description": "Shared domain models and helpers for RopeGeo and WebScraper",
5
5
  "license": "ISC",
6
6
  "repository": {