ropegeo-common 1.2.13 → 1.2.15
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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/types/api/getRopewikiPageView/bounds.d.ts +22 -0
- package/dist/types/api/getRopewikiPageView/bounds.d.ts.map +1 -0
- package/dist/types/api/getRopewikiPageView/bounds.js +50 -0
- package/dist/types/api/getRopewikiPageView/ropewikiPageView.d.ts +5 -1
- package/dist/types/api/getRopewikiPageView/ropewikiPageView.d.ts.map +1 -1
- package/dist/types/api/getRopewikiPageView/ropewikiPageView.js +16 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { RoutesGeojsonResult } from './types/api/getRoutes/routesGeojsonResult';
|
|
|
10
10
|
export { RoutesParams } from './types/api/getRoutes/routesParams';
|
|
11
11
|
export { BetaSectionImage } from './types/betaSections/betaSectionImage';
|
|
12
12
|
export { BetaSection } from './types/betaSections/betaSection';
|
|
13
|
+
export { Bounds } from './types/api/getRopewikiPageView/bounds';
|
|
13
14
|
export { RopewikiPageView } from './types/api/getRopewikiPageView/ropewikiPageView';
|
|
14
15
|
export { RopewikiPageViewResult } from './types/api/getRopewikiPageView/ropewikiPageViewResult';
|
|
15
16
|
export type RopewikiImageView = import('./types/betaSections/betaSectionImage').BetaSectionImage;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE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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"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RoutePreviewResult = exports.RopewikiRegionImagesResult = exports.RopewikiRegionImagesParams = exports.RopewikiRegionImageView = exports.RegionImagesCursor = exports.RopewikiRegionPreviewsResult = exports.RopewikiRegionPreviewsParams = exports.RegionPreviewsCursor = exports.RopewikiRegionViewResult = exports.RopewikiRegionView = exports.SearchResults = exports.SearchParams = exports.SearchCursor = exports.CursorPaginationResultType = exports.CursorPaginationResults = exports.ResultType = exports.Result = exports.CursorPaginationParams = exports.CursorType = exports.Cursor = exports.RopewikiPageViewResult = exports.RopewikiPageView = exports.BetaSection = 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;
|
|
3
|
+
exports.RoutePreviewResult = exports.RopewikiRegionImagesResult = exports.RopewikiRegionImagesParams = exports.RopewikiRegionImageView = exports.RegionImagesCursor = exports.RopewikiRegionPreviewsResult = exports.RopewikiRegionPreviewsParams = exports.RegionPreviewsCursor = exports.RopewikiRegionViewResult = exports.RopewikiRegionView = exports.SearchResults = exports.SearchParams = exports.SearchCursor = exports.CursorPaginationResultType = exports.CursorPaginationResults = exports.ResultType = exports.Result = exports.CursorPaginationParams = exports.CursorType = exports.Cursor = exports.RopewikiPageViewResult = exports.RopewikiPageView = exports.Bounds = exports.BetaSection = 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
4
|
var pageDataSource_1 = require("./types/pageDataSource");
|
|
5
5
|
Object.defineProperty(exports, "PageDataSource", { enumerable: true, get: function () { return pageDataSource_1.PageDataSource; } });
|
|
6
6
|
var difficulty_1 = require("./types/difficulty");
|
|
@@ -32,6 +32,8 @@ var betaSectionImage_1 = require("./types/betaSections/betaSectionImage");
|
|
|
32
32
|
Object.defineProperty(exports, "BetaSectionImage", { enumerable: true, get: function () { return betaSectionImage_1.BetaSectionImage; } });
|
|
33
33
|
var betaSection_1 = require("./types/betaSections/betaSection");
|
|
34
34
|
Object.defineProperty(exports, "BetaSection", { enumerable: true, get: function () { return betaSection_1.BetaSection; } });
|
|
35
|
+
var bounds_1 = require("./types/api/getRopewikiPageView/bounds");
|
|
36
|
+
Object.defineProperty(exports, "Bounds", { enumerable: true, get: function () { return bounds_1.Bounds; } });
|
|
35
37
|
var ropewikiPageView_1 = require("./types/api/getRopewikiPageView/ropewikiPageView");
|
|
36
38
|
Object.defineProperty(exports, "RopewikiPageView", { enumerable: true, get: function () { return ropewikiPageView_1.RopewikiPageView; } });
|
|
37
39
|
var ropewikiPageViewResult_1 = require("./types/api/getRopewikiPageView/ropewikiPageViewResult");
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Geographic bounding box (west, south, east, north) for map tile content.
|
|
3
|
+
*/
|
|
4
|
+
export declare class Bounds {
|
|
5
|
+
north: number;
|
|
6
|
+
south: number;
|
|
7
|
+
east: number;
|
|
8
|
+
west: number;
|
|
9
|
+
constructor(north: number, south: number, east: number, west: number);
|
|
10
|
+
/**
|
|
11
|
+
* Expands this bounds to include the given coordinate (lon, lat).
|
|
12
|
+
* If lat is greater than north, north is updated; if lat is less than south, south is updated;
|
|
13
|
+
* if lon is greater than east, east is updated; if lon is less than west, west is updated.
|
|
14
|
+
*/
|
|
15
|
+
update(lon: number, lat: number): void;
|
|
16
|
+
/**
|
|
17
|
+
* Validates result has Bounds fields (north, south, east, west as numbers) and returns a Bounds instance.
|
|
18
|
+
*/
|
|
19
|
+
static fromResult(result: unknown): Bounds;
|
|
20
|
+
private static assertNumber;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=bounds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounds.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiPageView/bounds.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,MAAM;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;gBAED,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAOpE;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAOtC;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM;IAiB1C,OAAO,CAAC,MAAM,CAAC,YAAY;CAQ9B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Bounds = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Geographic bounding box (west, south, east, north) for map tile content.
|
|
6
|
+
*/
|
|
7
|
+
class Bounds {
|
|
8
|
+
constructor(north, south, east, west) {
|
|
9
|
+
this.north = north;
|
|
10
|
+
this.south = south;
|
|
11
|
+
this.east = east;
|
|
12
|
+
this.west = west;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Expands this bounds to include the given coordinate (lon, lat).
|
|
16
|
+
* If lat is greater than north, north is updated; if lat is less than south, south is updated;
|
|
17
|
+
* if lon is greater than east, east is updated; if lon is less than west, west is updated.
|
|
18
|
+
*/
|
|
19
|
+
update(lon, lat) {
|
|
20
|
+
if (lat > this.north)
|
|
21
|
+
this.north = lat;
|
|
22
|
+
if (lat < this.south)
|
|
23
|
+
this.south = lat;
|
|
24
|
+
if (lon > this.east)
|
|
25
|
+
this.east = lon;
|
|
26
|
+
if (lon < this.west)
|
|
27
|
+
this.west = lon;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validates result has Bounds fields (north, south, east, west as numbers) and returns a Bounds instance.
|
|
31
|
+
*/
|
|
32
|
+
static fromResult(result) {
|
|
33
|
+
if (result == null || typeof result !== 'object') {
|
|
34
|
+
throw new Error('Bounds result must be an object');
|
|
35
|
+
}
|
|
36
|
+
const r = result;
|
|
37
|
+
Bounds.assertNumber(r, 'north');
|
|
38
|
+
Bounds.assertNumber(r, 'south');
|
|
39
|
+
Bounds.assertNumber(r, 'east');
|
|
40
|
+
Bounds.assertNumber(r, 'west');
|
|
41
|
+
return new Bounds(r.north, r.south, r.east, r.west);
|
|
42
|
+
}
|
|
43
|
+
static assertNumber(obj, key) {
|
|
44
|
+
const v = obj[key];
|
|
45
|
+
if (typeof v !== 'number' || Number.isNaN(v)) {
|
|
46
|
+
throw new Error(`Bounds.${key} must be a number, got: ${typeof v}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.Bounds = Bounds;
|
|
@@ -2,6 +2,7 @@ import { Difficulty } from '../../difficulty';
|
|
|
2
2
|
import { PermitStatus } from '../../permitStatus';
|
|
3
3
|
import { BetaSection } from '../../betaSections/betaSection';
|
|
4
4
|
import { BetaSectionImage } from '../../betaSections/betaSectionImage';
|
|
5
|
+
import { Bounds } from './bounds';
|
|
5
6
|
type MinMax = {
|
|
6
7
|
min: number;
|
|
7
8
|
max: number;
|
|
@@ -44,10 +45,12 @@ export declare class RopewikiPageView {
|
|
|
44
45
|
betaSections: BetaSection[];
|
|
45
46
|
/** Map tile URL template with {z}, {x}, {y} placeholders, or null. */
|
|
46
47
|
tilesTemplate: string | null;
|
|
48
|
+
/** Bounding box of the map tile content (north, south, east, west), or null. */
|
|
49
|
+
bounds: Bounds | null;
|
|
47
50
|
constructor(pageId: string, name: string, aka: string[], url: string, quality: number, userVotes: number, regions: {
|
|
48
51
|
name: string;
|
|
49
52
|
id: string;
|
|
50
|
-
}[], difficulty: Difficulty, permit: PermitStatus | null, rappelCount: MinMax | number | null, jumps: number | null, vehicle: string | null, rappelLongest: number | null, shuttleTime: number | null, overallLength: number | null, descentLength: number | null, exitLength: number | null, approachLength: number | null, overallTime: MinMax | number | null, approachTime: MinMax | number | null, descentTime: MinMax | number | null, exitTime: MinMax | number | null, approachElevGain: number | null, descentElevGain: number | null, exitElevGain: number | null, months: string[], latestRevisionDate: Date, bannerImage: BetaSectionImage | null, betaSections: BetaSection[], tilesTemplate: string | null);
|
|
53
|
+
}[], difficulty: Difficulty, permit: PermitStatus | null, rappelCount: MinMax | number | null, jumps: number | null, vehicle: string | null, rappelLongest: number | null, shuttleTime: number | null, overallLength: number | null, descentLength: number | null, exitLength: number | null, approachLength: number | null, overallTime: MinMax | number | null, approachTime: MinMax | number | null, descentTime: MinMax | number | null, exitTime: MinMax | number | null, approachElevGain: number | null, descentElevGain: number | null, exitElevGain: number | null, months: string[], latestRevisionDate: Date, bannerImage: BetaSectionImage | null, betaSections: BetaSection[], tilesTemplate: string | null, bounds: Bounds | null);
|
|
51
54
|
/**
|
|
52
55
|
* Validates result has RopewikiPageView fields and returns a RopewikiPageView instance.
|
|
53
56
|
*/
|
|
@@ -55,6 +58,7 @@ export declare class RopewikiPageView {
|
|
|
55
58
|
private static assertString;
|
|
56
59
|
private static assertNullableString;
|
|
57
60
|
private static assertNullableTilesTemplate;
|
|
61
|
+
private static assertNullableBounds;
|
|
58
62
|
private static assertNumber;
|
|
59
63
|
private static assertNullableNumber;
|
|
60
64
|
private static assertStringArray;
|
|
@@ -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;
|
|
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,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,KAAK,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C;;GAEG;AACH,qBAAa,gBAAgB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,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G;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB;IAqDpD,OAAO,CAAC,MAAM,CAAC,YAAY;IAS3B,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAYnC,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAkB1C,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAcnC,OAAO,CAAC,MAAM,CAAC,YAAY;IAS3B,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAYnC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAmBhC,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,11 +5,12 @@ 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 bounds_1 = require("./bounds");
|
|
8
9
|
/**
|
|
9
10
|
* Response type for GET getRopewikiPageView (full page view).
|
|
10
11
|
*/
|
|
11
12
|
class RopewikiPageView {
|
|
12
|
-
constructor(pageId, name, aka, url, quality, userVotes, regions, difficulty, permit, rappelCount, jumps, vehicle, rappelLongest, shuttleTime, overallLength, descentLength, exitLength, approachLength, overallTime, approachTime, descentTime, exitTime, approachElevGain, descentElevGain, exitElevGain, months, latestRevisionDate, bannerImage, betaSections, tilesTemplate) {
|
|
13
|
+
constructor(pageId, name, aka, url, quality, userVotes, regions, difficulty, permit, rappelCount, jumps, vehicle, rappelLongest, shuttleTime, overallLength, descentLength, exitLength, approachLength, overallTime, approachTime, descentTime, exitTime, approachElevGain, descentElevGain, exitElevGain, months, latestRevisionDate, bannerImage, betaSections, tilesTemplate, bounds) {
|
|
13
14
|
this.pageId = pageId;
|
|
14
15
|
this.name = name;
|
|
15
16
|
this.aka = Array.isArray(aka) ? aka.slice() : [];
|
|
@@ -40,6 +41,7 @@ class RopewikiPageView {
|
|
|
40
41
|
this.bannerImage = bannerImage;
|
|
41
42
|
this.betaSections = Array.isArray(betaSections) ? betaSections : [];
|
|
42
43
|
this.tilesTemplate = tilesTemplate;
|
|
44
|
+
this.bounds = bounds;
|
|
43
45
|
}
|
|
44
46
|
/**
|
|
45
47
|
* Validates result has RopewikiPageView fields and returns a RopewikiPageView instance.
|
|
@@ -79,8 +81,12 @@ class RopewikiPageView {
|
|
|
79
81
|
RopewikiPageView.assertNullableBannerImage(r, 'bannerImage');
|
|
80
82
|
RopewikiPageView.assertBetaSectionsArray(r, 'betaSections');
|
|
81
83
|
RopewikiPageView.assertNullableTilesTemplate(r, 'tilesTemplate');
|
|
84
|
+
RopewikiPageView.assertNullableBounds(r, 'bounds');
|
|
82
85
|
r.latestRevisionDate = new Date(r.latestRevisionDate);
|
|
83
86
|
r.difficulty = new difficulty_1.Difficulty(r.difficulty.technical, r.difficulty.water, r.difficulty.time, r.difficulty.risk);
|
|
87
|
+
if (r.bounds != null) {
|
|
88
|
+
r.bounds = bounds_1.Bounds.fromResult(r.bounds);
|
|
89
|
+
}
|
|
84
90
|
Object.setPrototypeOf(r, RopewikiPageView.prototype);
|
|
85
91
|
return r;
|
|
86
92
|
}
|
|
@@ -107,6 +113,15 @@ class RopewikiPageView {
|
|
|
107
113
|
throw new Error(`RopewikiPageView.${key} must contain {z}, {x}, and {y} placeholders when present, got: ${v}`);
|
|
108
114
|
}
|
|
109
115
|
}
|
|
116
|
+
static assertNullableBounds(obj, key) {
|
|
117
|
+
const v = obj[key];
|
|
118
|
+
if (v === null || v === undefined)
|
|
119
|
+
return;
|
|
120
|
+
if (typeof v !== 'object') {
|
|
121
|
+
throw new Error(`RopewikiPageView.${key} must be Bounds or null, got: ${typeof v}`);
|
|
122
|
+
}
|
|
123
|
+
// Full validation and conversion happen later via Bounds.fromResult
|
|
124
|
+
}
|
|
110
125
|
static assertNumber(obj, key) {
|
|
111
126
|
const v = obj[key];
|
|
112
127
|
if (typeof v !== 'number' || Number.isNaN(v)) {
|