ropegeo-common 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/types/api/getRoutePreview/pagePreview.d.ts +103 -0
- package/dist/types/api/getRoutePreview/pagePreview.d.ts.map +1 -0
- package/dist/types/api/getRoutePreview/pagePreview.js +122 -0
- package/dist/types/pageDataSource.d.ts +4 -0
- package/dist/types/pageDataSource.d.ts.map +1 -0
- package/dist/types/pageDataSource.js +7 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# ropegeo-common
|
|
2
|
+
|
|
3
|
+
Shared types and utilities for [RopeGeo](https://github.com/yurst3/RopeGeo) and [WebScraper](https://github.com/yurst3/WebScraper). Published to npm as [`ropegeo-common`](https://www.npmjs.com/package/ropegeo-common) so both projects can depend on a single set of types instead of duplicating code.
|
|
4
|
+
|
|
5
|
+
## What’s in this package
|
|
6
|
+
|
|
7
|
+
- **Page preview types** – `PagePreview`, `Difficulty`, and related enums used by the route preview API (e.g. GET /route/{routeId}/preview).
|
|
8
|
+
- **Page data source** – `PageDataSource` enum (e.g. Ropewiki) used when linking routes to pages.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install ropegeo-common
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import {
|
|
18
|
+
PagePreview,
|
|
19
|
+
PageDataSource,
|
|
20
|
+
Difficulty,
|
|
21
|
+
DifficultyTechnical,
|
|
22
|
+
DifficultyWater,
|
|
23
|
+
DifficultyTime,
|
|
24
|
+
DifficultyRisk,
|
|
25
|
+
} from 'ropegeo-common';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Related repos
|
|
29
|
+
|
|
30
|
+
- **[RopeGeo](https://github.com/yurst3/RopeGeo)** – Expo app for canyoneering maps and route data.
|
|
31
|
+
- **[WebScraper](https://github.com/yurst3/WebScraper)** – Lambdas and jobs that scrape canyoneering sites (e.g. Ropewiki), parse data, and store it for the API.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { PageDataSource } from './types/pageDataSource';
|
|
2
|
+
export { Difficulty, DifficultyRisk, DifficultyTechnical, DifficultyTime, DifficultyWater, GetRopewikiPagePreviewRow, PagePreview, } from './types/api/getRoutePreview/pagePreview';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,EACH,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,yBAAyB,EACzB,WAAW,GACd,MAAM,yCAAyC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PagePreview = exports.DifficultyWater = exports.DifficultyTime = exports.DifficultyTechnical = exports.DifficultyRisk = exports.Difficulty = exports.PageDataSource = void 0;
|
|
4
|
+
var pageDataSource_1 = require("./types/pageDataSource");
|
|
5
|
+
Object.defineProperty(exports, "PageDataSource", { enumerable: true, get: function () { return pageDataSource_1.PageDataSource; } });
|
|
6
|
+
var pagePreview_1 = require("./types/api/getRoutePreview/pagePreview");
|
|
7
|
+
Object.defineProperty(exports, "Difficulty", { enumerable: true, get: function () { return pagePreview_1.Difficulty; } });
|
|
8
|
+
Object.defineProperty(exports, "DifficultyRisk", { enumerable: true, get: function () { return pagePreview_1.DifficultyRisk; } });
|
|
9
|
+
Object.defineProperty(exports, "DifficultyTechnical", { enumerable: true, get: function () { return pagePreview_1.DifficultyTechnical; } });
|
|
10
|
+
Object.defineProperty(exports, "DifficultyTime", { enumerable: true, get: function () { return pagePreview_1.DifficultyTime; } });
|
|
11
|
+
Object.defineProperty(exports, "DifficultyWater", { enumerable: true, get: function () { return pagePreview_1.DifficultyWater; } });
|
|
12
|
+
Object.defineProperty(exports, "PagePreview", { enumerable: true, get: function () { return pagePreview_1.PagePreview; } });
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { PageDataSource } from '../../pageDataSource';
|
|
2
|
+
/**
|
|
3
|
+
* Row shape returned by the getRopewikiPagePreview query.
|
|
4
|
+
* Used when building a PagePreview from Ropewiki data via PagePreview.fromDbRow.
|
|
5
|
+
*/
|
|
6
|
+
export interface GetRopewikiPagePreviewRow {
|
|
7
|
+
pageId: string;
|
|
8
|
+
title: string;
|
|
9
|
+
quality: number | null;
|
|
10
|
+
userVotes: number | null;
|
|
11
|
+
technicalRating: string | null;
|
|
12
|
+
timeRating: string | null;
|
|
13
|
+
waterRating: string | null;
|
|
14
|
+
riskRating: string | null;
|
|
15
|
+
regionId: string;
|
|
16
|
+
regionName: string;
|
|
17
|
+
bannerFileUrl: string | null;
|
|
18
|
+
url: string | null;
|
|
19
|
+
}
|
|
20
|
+
/** Technical difficulty: 1–4 */
|
|
21
|
+
export declare enum DifficultyTechnical {
|
|
22
|
+
One = "1",
|
|
23
|
+
Two = "2",
|
|
24
|
+
Three = "3",
|
|
25
|
+
Four = "4"
|
|
26
|
+
}
|
|
27
|
+
/** Water difficulty: A, B, C, or C1–C4 */
|
|
28
|
+
export declare enum DifficultyWater {
|
|
29
|
+
A = "A",
|
|
30
|
+
B = "B",
|
|
31
|
+
C = "C",
|
|
32
|
+
C1 = "C1",
|
|
33
|
+
C2 = "C2",
|
|
34
|
+
C3 = "C3",
|
|
35
|
+
C4 = "C4"
|
|
36
|
+
}
|
|
37
|
+
/** Time difficulty: I–VI (Roman numerals) */
|
|
38
|
+
export declare enum DifficultyTime {
|
|
39
|
+
I = "I",
|
|
40
|
+
II = "II",
|
|
41
|
+
III = "III",
|
|
42
|
+
IV = "IV",
|
|
43
|
+
V = "V",
|
|
44
|
+
VI = "VI"
|
|
45
|
+
}
|
|
46
|
+
/** Risk rating: G, PG, PG13, R, X, XX */
|
|
47
|
+
export declare enum DifficultyRisk {
|
|
48
|
+
G = "G",
|
|
49
|
+
PG = "PG",
|
|
50
|
+
PG13 = "PG13",
|
|
51
|
+
R = "R",
|
|
52
|
+
X = "X",
|
|
53
|
+
XX = "XX"
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Difficulty ratings for a page (e.g. Ropewiki technical, water, time, risk).
|
|
57
|
+
* Each property is nullable; the object is always present on PagePreview.
|
|
58
|
+
* Throws if a non-empty rating string is not one of the allowed enum values.
|
|
59
|
+
*/
|
|
60
|
+
export declare class Difficulty {
|
|
61
|
+
technical: DifficultyTechnical | null;
|
|
62
|
+
water: DifficultyWater | null;
|
|
63
|
+
time: DifficultyTime | null;
|
|
64
|
+
risk: DifficultyRisk | null;
|
|
65
|
+
constructor(technicalRating: string | null | undefined, waterRating: string | null | undefined, timeRating: string | null | undefined, riskRating: string | null | undefined);
|
|
66
|
+
private static parseDifficultyField;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Preview of a page linked to a route (e.g. Ropewiki page).
|
|
70
|
+
* Used by GET /route/{routeId}/preview.
|
|
71
|
+
*/
|
|
72
|
+
export declare class PagePreview {
|
|
73
|
+
/** Page identifier (e.g. RopewikiPage id) */
|
|
74
|
+
id: string;
|
|
75
|
+
/** Source of the page (e.g. ropewiki) */
|
|
76
|
+
source: PageDataSource;
|
|
77
|
+
/** Banner image URL (e.g. first non–beta-section image for Ropewiki) */
|
|
78
|
+
imageUrl: string | null;
|
|
79
|
+
/** Numeric rating (e.g. quality for Ropewiki) */
|
|
80
|
+
rating: number | null;
|
|
81
|
+
/** Number of votes (e.g. userVotes for Ropewiki) */
|
|
82
|
+
ratingCount: number | null;
|
|
83
|
+
/** Display title */
|
|
84
|
+
title: string;
|
|
85
|
+
/** Region names (not ids) */
|
|
86
|
+
regions: string[];
|
|
87
|
+
/** Difficulty ratings (technical, water, time, risk); always present. risk is set to effective risk when built via fromDbRow. */
|
|
88
|
+
difficulty: Difficulty;
|
|
89
|
+
/** Map data id for the page route, or null if none */
|
|
90
|
+
mapData: string | null;
|
|
91
|
+
/** External link to the page (e.g. Ropewiki page URL) */
|
|
92
|
+
externalLink: string | null;
|
|
93
|
+
constructor(id: string, source: PageDataSource, imageUrl: string | null, rating: number | null, ratingCount: number | null, title: string, regions: string[], difficulty: Difficulty, mapData: string | null, externalLink: string | null);
|
|
94
|
+
/**
|
|
95
|
+
* Builds a PagePreview from a getRopewikiPagePreview query row.
|
|
96
|
+
* Sets difficulty.risk to the effective risk (derived from technical when risk is not set).
|
|
97
|
+
*/
|
|
98
|
+
static fromDbRow(row: GetRopewikiPagePreviewRow, mapData: string | null, regions?: string[]): PagePreview;
|
|
99
|
+
private static readonly RISK_ORDER;
|
|
100
|
+
private static getDefaultRisk;
|
|
101
|
+
private static getEffectiveRisk;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=pagePreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagePreview.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRoutePreview/pagePreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAA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ports.Difficulty = exports.DifficultyRisk = exports.DifficultyTime = exports.DifficultyWater = exports.DifficultyTechnical = void 0;
|
|
4
|
+
const pageDataSource_1 = require("../../pageDataSource");
|
|
5
|
+
/** Technical difficulty: 1–4 */
|
|
6
|
+
var DifficultyTechnical;
|
|
7
|
+
(function (DifficultyTechnical) {
|
|
8
|
+
DifficultyTechnical["One"] = "1";
|
|
9
|
+
DifficultyTechnical["Two"] = "2";
|
|
10
|
+
DifficultyTechnical["Three"] = "3";
|
|
11
|
+
DifficultyTechnical["Four"] = "4";
|
|
12
|
+
})(DifficultyTechnical || (exports.DifficultyTechnical = DifficultyTechnical = {}));
|
|
13
|
+
/** Water difficulty: A, B, C, or C1–C4 */
|
|
14
|
+
var DifficultyWater;
|
|
15
|
+
(function (DifficultyWater) {
|
|
16
|
+
DifficultyWater["A"] = "A";
|
|
17
|
+
DifficultyWater["B"] = "B";
|
|
18
|
+
DifficultyWater["C"] = "C";
|
|
19
|
+
DifficultyWater["C1"] = "C1";
|
|
20
|
+
DifficultyWater["C2"] = "C2";
|
|
21
|
+
DifficultyWater["C3"] = "C3";
|
|
22
|
+
DifficultyWater["C4"] = "C4";
|
|
23
|
+
})(DifficultyWater || (exports.DifficultyWater = DifficultyWater = {}));
|
|
24
|
+
/** Time difficulty: I–VI (Roman numerals) */
|
|
25
|
+
var DifficultyTime;
|
|
26
|
+
(function (DifficultyTime) {
|
|
27
|
+
DifficultyTime["I"] = "I";
|
|
28
|
+
DifficultyTime["II"] = "II";
|
|
29
|
+
DifficultyTime["III"] = "III";
|
|
30
|
+
DifficultyTime["IV"] = "IV";
|
|
31
|
+
DifficultyTime["V"] = "V";
|
|
32
|
+
DifficultyTime["VI"] = "VI";
|
|
33
|
+
})(DifficultyTime || (exports.DifficultyTime = DifficultyTime = {}));
|
|
34
|
+
/** Risk rating: G, PG, PG13, R, X, XX */
|
|
35
|
+
var DifficultyRisk;
|
|
36
|
+
(function (DifficultyRisk) {
|
|
37
|
+
DifficultyRisk["G"] = "G";
|
|
38
|
+
DifficultyRisk["PG"] = "PG";
|
|
39
|
+
DifficultyRisk["PG13"] = "PG13";
|
|
40
|
+
DifficultyRisk["R"] = "R";
|
|
41
|
+
DifficultyRisk["X"] = "X";
|
|
42
|
+
DifficultyRisk["XX"] = "XX";
|
|
43
|
+
})(DifficultyRisk || (exports.DifficultyRisk = DifficultyRisk = {}));
|
|
44
|
+
/**
|
|
45
|
+
* Difficulty ratings for a page (e.g. Ropewiki technical, water, time, risk).
|
|
46
|
+
* Each property is nullable; the object is always present on PagePreview.
|
|
47
|
+
* Throws if a non-empty rating string is not one of the allowed enum values.
|
|
48
|
+
*/
|
|
49
|
+
class Difficulty {
|
|
50
|
+
constructor(technicalRating, waterRating, timeRating, riskRating) {
|
|
51
|
+
this.technical = Difficulty.parseDifficultyField(technicalRating, Object.values(DifficultyTechnical), 'technical');
|
|
52
|
+
this.water = Difficulty.parseDifficultyField(waterRating, Object.values(DifficultyWater), 'water');
|
|
53
|
+
this.time = Difficulty.parseDifficultyField(timeRating, Object.values(DifficultyTime), 'time');
|
|
54
|
+
this.risk = Difficulty.parseDifficultyField(riskRating, Object.values(DifficultyRisk), 'risk');
|
|
55
|
+
}
|
|
56
|
+
static parseDifficultyField(value, allowed, fieldName) {
|
|
57
|
+
if (value == null || value === '')
|
|
58
|
+
return null;
|
|
59
|
+
const trimmed = value.trim();
|
|
60
|
+
if (!allowed.includes(trimmed)) {
|
|
61
|
+
throw new Error(`Invalid difficulty ${fieldName}: "${value}" is not one of [${allowed.join(', ')}]`);
|
|
62
|
+
}
|
|
63
|
+
return trimmed;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.Difficulty = Difficulty;
|
|
67
|
+
/**
|
|
68
|
+
* Preview of a page linked to a route (e.g. Ropewiki page).
|
|
69
|
+
* Used by GET /route/{routeId}/preview.
|
|
70
|
+
*/
|
|
71
|
+
class PagePreview {
|
|
72
|
+
constructor(id, source, imageUrl, rating, ratingCount, title, regions, difficulty, mapData, externalLink) {
|
|
73
|
+
this.id = id;
|
|
74
|
+
this.source = source;
|
|
75
|
+
this.imageUrl = imageUrl;
|
|
76
|
+
this.rating = rating;
|
|
77
|
+
this.ratingCount = ratingCount;
|
|
78
|
+
this.title = title;
|
|
79
|
+
this.regions = regions;
|
|
80
|
+
this.difficulty = difficulty;
|
|
81
|
+
this.mapData = mapData;
|
|
82
|
+
this.externalLink = externalLink;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Builds a PagePreview from a getRopewikiPagePreview query row.
|
|
86
|
+
* Sets difficulty.risk to the effective risk (derived from technical when risk is not set).
|
|
87
|
+
*/
|
|
88
|
+
static fromDbRow(row, mapData, regions) {
|
|
89
|
+
const difficulty = new Difficulty(row.technicalRating, row.waterRating, row.timeRating, row.riskRating);
|
|
90
|
+
difficulty.risk = PagePreview.getEffectiveRisk(difficulty);
|
|
91
|
+
return new PagePreview(row.pageId, pageDataSource_1.PageDataSource.Ropewiki, row.bannerFileUrl ?? null, row.quality != null ? Number(row.quality) : null, row.userVotes ?? null, row.title, regions ?? [row.regionName], difficulty, mapData, row.url ?? null);
|
|
92
|
+
}
|
|
93
|
+
static getDefaultRisk(difficulty) {
|
|
94
|
+
if (difficulty.technical === DifficultyTechnical.One)
|
|
95
|
+
return DifficultyRisk.G;
|
|
96
|
+
if (difficulty.technical === DifficultyTechnical.Two)
|
|
97
|
+
return DifficultyRisk.PG;
|
|
98
|
+
if (difficulty.technical === DifficultyTechnical.Three || difficulty.technical === DifficultyTechnical.Four) {
|
|
99
|
+
return DifficultyRisk.PG13;
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
static getEffectiveRisk(difficulty) {
|
|
104
|
+
const defaultRisk = PagePreview.getDefaultRisk(difficulty);
|
|
105
|
+
if (difficulty.risk != null) {
|
|
106
|
+
return defaultRisk != null &&
|
|
107
|
+
PagePreview.RISK_ORDER[difficulty.risk] < PagePreview.RISK_ORDER[defaultRisk]
|
|
108
|
+
? defaultRisk
|
|
109
|
+
: difficulty.risk;
|
|
110
|
+
}
|
|
111
|
+
return defaultRisk;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.PagePreview = PagePreview;
|
|
115
|
+
PagePreview.RISK_ORDER = {
|
|
116
|
+
[DifficultyRisk.G]: 0,
|
|
117
|
+
[DifficultyRisk.PG]: 1,
|
|
118
|
+
[DifficultyRisk.PG13]: 2,
|
|
119
|
+
[DifficultyRisk.R]: 3,
|
|
120
|
+
[DifficultyRisk.X]: 4,
|
|
121
|
+
[DifficultyRisk.XX]: 5,
|
|
122
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageDataSource.d.ts","sourceRoot":"","sources":["../../src/types/pageDataSource.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACtB,QAAQ,aAAa;CACxB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageDataSource = void 0;
|
|
4
|
+
var PageDataSource;
|
|
5
|
+
(function (PageDataSource) {
|
|
6
|
+
PageDataSource["Ropewiki"] = "ropewiki";
|
|
7
|
+
})(PageDataSource || (exports.PageDataSource = PageDataSource = {}));
|