ropegeo-common 1.0.5 → 1.0.7

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 CHANGED
@@ -6,6 +6,7 @@ Shared types and utilities for [RopeGeo](https://github.com/yurst3/RopeGeo) and
6
6
 
7
7
  - **Page preview types** – `PagePreview`, `Difficulty`, and related enums used by the route preview API (e.g. GET /route/{routeId}/preview). `PagePreview` includes optional `permit` (`PermitStatus` enum: Yes, No, Restricted, Closed, or null).
8
8
  - **Page data source** – `PageDataSource` enum (e.g. Ropewiki) used when linking routes to pages.
9
+ - **Ropewiki page view types** – `RopewikiPageView`, `RopewikiBetaSectionView`, and `RopewikiImageView` for the getRopewikiPageView API (full Ropewiki page with beta sections and images).
9
10
  - **Routes (GET /routes)** – `Route`, `RouteType`, `RouteGeoJsonFeature`, and `RoutesGeojson` for the routes GeoJSON Feature Collection API. `RoutesGeojson.fromRoutes(routes)` builds the response shape from an array of `Route`.
10
11
 
11
12
  ## Usage
@@ -27,6 +28,9 @@ import {
27
28
  Route,
28
29
  RouteType,
29
30
  RoutesGeojson,
31
+ type RopewikiPageView,
32
+ type RopewikiBetaSectionView,
33
+ type RopewikiImageView,
30
34
  } from 'ropegeo-common';
31
35
  ```
32
36
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  export { PageDataSource } from './types/pageDataSource';
2
- export { Difficulty, DifficultyRisk, DifficultyTechnical, DifficultyTime, DifficultyWater, GetRopewikiPagePreviewRow, PagePreview, PermitStatus, } from './types/api/getRoutePreview/pagePreview';
2
+ export { Difficulty, DifficultyRisk, DifficultyTechnical, DifficultyTime, DifficultyWater } from './types/difficulty';
3
+ export { PermitStatus } from './types/permitStatus';
4
+ export { GetRopewikiPagePreviewRow, PagePreview } from './types/api/getRoutePreview/pagePreview';
3
5
  export { Route, RouteGeoJsonFeature, RouteType } from './types/route';
4
6
  export { RoutesGeojson } from './types/api/getRoutes/routeGeojson';
7
+ export type { RopewikiImageView } from './types/api/getRopewikiPageView/ropewikiImageView';
8
+ export type { RopewikiBetaSectionView } from './types/api/getRopewikiPageView/ropewikiBetaSectionView';
9
+ export type { RopewikiPageView } from './types/api/getRopewikiPageView/ropewikiPageView';
5
10
  //# sourceMappingURL=index.d.ts.map
@@ -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,EACH,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,yBAAyB,EACzB,WAAW,EACX,YAAY,GACf,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC"}
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,yBAAyB,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACjG,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,YAAY,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AACvG,YAAY,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC"}
package/dist/index.js CHANGED
@@ -1,16 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RoutesGeojson = exports.RouteType = exports.Route = exports.PermitStatus = exports.PagePreview = exports.DifficultyWater = exports.DifficultyTime = exports.DifficultyTechnical = exports.DifficultyRisk = exports.Difficulty = exports.PageDataSource = void 0;
3
+ exports.RoutesGeojson = exports.RouteType = exports.Route = exports.PagePreview = 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
+ var difficulty_1 = require("./types/difficulty");
7
+ Object.defineProperty(exports, "Difficulty", { enumerable: true, get: function () { return difficulty_1.Difficulty; } });
8
+ Object.defineProperty(exports, "DifficultyRisk", { enumerable: true, get: function () { return difficulty_1.DifficultyRisk; } });
9
+ Object.defineProperty(exports, "DifficultyTechnical", { enumerable: true, get: function () { return difficulty_1.DifficultyTechnical; } });
10
+ Object.defineProperty(exports, "DifficultyTime", { enumerable: true, get: function () { return difficulty_1.DifficultyTime; } });
11
+ Object.defineProperty(exports, "DifficultyWater", { enumerable: true, get: function () { return difficulty_1.DifficultyWater; } });
12
+ var permitStatus_1 = require("./types/permitStatus");
13
+ Object.defineProperty(exports, "PermitStatus", { enumerable: true, get: function () { return permitStatus_1.PermitStatus; } });
6
14
  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
15
  Object.defineProperty(exports, "PagePreview", { enumerable: true, get: function () { return pagePreview_1.PagePreview; } });
13
- Object.defineProperty(exports, "PermitStatus", { enumerable: true, get: function () { return pagePreview_1.PermitStatus; } });
14
16
  var route_1 = require("./types/route");
15
17
  Object.defineProperty(exports, "Route", { enumerable: true, get: function () { return route_1.Route; } });
16
18
  Object.defineProperty(exports, "RouteType", { enumerable: true, get: function () { return route_1.RouteType; } });
@@ -0,0 +1,12 @@
1
+ import type { RopewikiImageView } from './ropewikiImageView';
2
+ /**
3
+ * Beta section view for getRopewikiPageView.
4
+ */
5
+ export interface RopewikiBetaSectionView {
6
+ order: number;
7
+ title: string;
8
+ text: string;
9
+ images: RopewikiImageView[];
10
+ latestRevisionDate: Date;
11
+ }
12
+ //# sourceMappingURL=ropewikiBetaSectionView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ropewikiBetaSectionView.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiPageView/ropewikiBetaSectionView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,kBAAkB,EAAE,IAAI,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Image view for getRopewikiPageView (banner or beta-section image).
3
+ */
4
+ export interface RopewikiImageView {
5
+ order: number;
6
+ url: string;
7
+ linkUrl: string;
8
+ caption: string;
9
+ latestRevisionDate: Date;
10
+ }
11
+ //# sourceMappingURL=ropewikiImageView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ropewikiImageView.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiPageView/ropewikiImageView.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,IAAI,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,32 @@
1
+ import type { Difficulty } from '../../difficulty';
2
+ import type { PermitStatus } from '../../permitStatus';
3
+ import type { RopewikiBetaSectionView } from './ropewikiBetaSectionView';
4
+ import type { RopewikiImageView } from './ropewikiImageView';
5
+ /**
6
+ * Response type for GET getRopewikiPageView (full page view).
7
+ */
8
+ export interface RopewikiPageView {
9
+ pageId: string;
10
+ name: string;
11
+ aka: string[];
12
+ url: string;
13
+ quality: number;
14
+ userVotes: number;
15
+ difficulty: Difficulty;
16
+ permit: PermitStatus | null;
17
+ rappelCount: {
18
+ min: number;
19
+ max: number;
20
+ } | null;
21
+ vehicle: string;
22
+ rappelLongest: number;
23
+ shuttle: number;
24
+ minTime: number;
25
+ maxTime: number;
26
+ hike: number;
27
+ months: string[];
28
+ latestRevisionDate: Date;
29
+ bannerImage: RopewikiImageView | null;
30
+ betaSections: RopewikiBetaSectionView[];
31
+ }
32
+ //# sourceMappingURL=ropewikiPageView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ropewikiPageView.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiPageView/ropewikiPageView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,kBAAkB,EAAE,IAAI,CAAC;IACzB,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACtC,YAAY,EAAE,uBAAuB,EAAE,CAAC;CAC3C"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,5 @@
1
+ import { Difficulty } from '../../difficulty';
2
+ import { PermitStatus } from '../../permitStatus';
1
3
  import { PageDataSource } from '../../pageDataSource';
2
4
  /**
3
5
  * Row shape returned by the getRopewikiPagePreview query.
@@ -18,61 +20,6 @@ export interface GetRopewikiPagePreviewRow {
18
20
  url: string | null;
19
21
  permits: string | null;
20
22
  }
21
- /** Permit status: Yes, No, Restricted, Closed, or null. */
22
- export declare enum PermitStatus {
23
- Yes = "Yes",
24
- No = "No",
25
- Restricted = "Restricted",
26
- Closed = "Closed"
27
- }
28
- /** Technical difficulty: 1–4 */
29
- export declare enum DifficultyTechnical {
30
- One = "1",
31
- Two = "2",
32
- Three = "3",
33
- Four = "4"
34
- }
35
- /** Water difficulty: A, B, C, or C1–C4 */
36
- export declare enum DifficultyWater {
37
- A = "A",
38
- B = "B",
39
- C = "C",
40
- C1 = "C1",
41
- C2 = "C2",
42
- C3 = "C3",
43
- C4 = "C4"
44
- }
45
- /** Time difficulty: I–VI (Roman numerals) */
46
- export declare enum DifficultyTime {
47
- I = "I",
48
- II = "II",
49
- III = "III",
50
- IV = "IV",
51
- V = "V",
52
- VI = "VI"
53
- }
54
- /** Risk rating: G, PG, PG13, R, X, XX */
55
- export declare enum DifficultyRisk {
56
- G = "G",
57
- PG = "PG",
58
- PG13 = "PG13",
59
- R = "R",
60
- X = "X",
61
- XX = "XX"
62
- }
63
- /**
64
- * Difficulty ratings for a page (e.g. Ropewiki technical, water, time, risk).
65
- * Each property is nullable; the object is always present on PagePreview.
66
- * Throws if a non-empty rating string is not one of the allowed enum values.
67
- */
68
- export declare class Difficulty {
69
- technical: DifficultyTechnical | null;
70
- water: DifficultyWater | null;
71
- time: DifficultyTime | null;
72
- risk: DifficultyRisk | null;
73
- constructor(technicalRating: string | null | undefined, waterRating: string | null | undefined, timeRating: string | null | undefined, riskRating: string | null | undefined);
74
- private static parseDifficultyField;
75
- }
76
23
  /**
77
24
  * Preview of a page linked to a route (e.g. Ropewiki page).
78
25
  * Used by GET /route/{routeId}/preview.
@@ -1 +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,GAA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2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PagePreview = exports.Difficulty = exports.DifficultyRisk = exports.DifficultyTime = exports.DifficultyWater = exports.DifficultyTechnical = exports.PermitStatus = void 0;
3
+ exports.PagePreview = void 0;
4
+ const difficulty_1 = require("../../difficulty");
5
+ const permitStatus_1 = require("../../permitStatus");
4
6
  const pageDataSource_1 = require("../../pageDataSource");
5
- /** Permit status: Yes, No, Restricted, Closed, or null. */
6
- var PermitStatus;
7
- (function (PermitStatus) {
8
- PermitStatus["Yes"] = "Yes";
9
- PermitStatus["No"] = "No";
10
- PermitStatus["Restricted"] = "Restricted";
11
- PermitStatus["Closed"] = "Closed";
12
- })(PermitStatus || (exports.PermitStatus = PermitStatus = {}));
13
- /** Technical difficulty: 1–4 */
14
- var DifficultyTechnical;
15
- (function (DifficultyTechnical) {
16
- DifficultyTechnical["One"] = "1";
17
- DifficultyTechnical["Two"] = "2";
18
- DifficultyTechnical["Three"] = "3";
19
- DifficultyTechnical["Four"] = "4";
20
- })(DifficultyTechnical || (exports.DifficultyTechnical = DifficultyTechnical = {}));
21
- /** Water difficulty: A, B, C, or C1–C4 */
22
- var DifficultyWater;
23
- (function (DifficultyWater) {
24
- DifficultyWater["A"] = "A";
25
- DifficultyWater["B"] = "B";
26
- DifficultyWater["C"] = "C";
27
- DifficultyWater["C1"] = "C1";
28
- DifficultyWater["C2"] = "C2";
29
- DifficultyWater["C3"] = "C3";
30
- DifficultyWater["C4"] = "C4";
31
- })(DifficultyWater || (exports.DifficultyWater = DifficultyWater = {}));
32
- /** Time difficulty: I–VI (Roman numerals) */
33
- var DifficultyTime;
34
- (function (DifficultyTime) {
35
- DifficultyTime["I"] = "I";
36
- DifficultyTime["II"] = "II";
37
- DifficultyTime["III"] = "III";
38
- DifficultyTime["IV"] = "IV";
39
- DifficultyTime["V"] = "V";
40
- DifficultyTime["VI"] = "VI";
41
- })(DifficultyTime || (exports.DifficultyTime = DifficultyTime = {}));
42
- /** Risk rating: G, PG, PG13, R, X, XX */
43
- var DifficultyRisk;
44
- (function (DifficultyRisk) {
45
- DifficultyRisk["G"] = "G";
46
- DifficultyRisk["PG"] = "PG";
47
- DifficultyRisk["PG13"] = "PG13";
48
- DifficultyRisk["R"] = "R";
49
- DifficultyRisk["X"] = "X";
50
- DifficultyRisk["XX"] = "XX";
51
- })(DifficultyRisk || (exports.DifficultyRisk = DifficultyRisk = {}));
52
- /**
53
- * Difficulty ratings for a page (e.g. Ropewiki technical, water, time, risk).
54
- * Each property is nullable; the object is always present on PagePreview.
55
- * Throws if a non-empty rating string is not one of the allowed enum values.
56
- */
57
- class Difficulty {
58
- constructor(technicalRating, waterRating, timeRating, riskRating) {
59
- this.technical = Difficulty.parseDifficultyField(technicalRating, Object.values(DifficultyTechnical), 'technical');
60
- this.water = Difficulty.parseDifficultyField(waterRating, Object.values(DifficultyWater), 'water');
61
- this.time = Difficulty.parseDifficultyField(timeRating, Object.values(DifficultyTime), 'time');
62
- this.risk = Difficulty.parseDifficultyField(riskRating, Object.values(DifficultyRisk), 'risk');
63
- }
64
- static parseDifficultyField(value, allowed, fieldName) {
65
- if (value == null || value === '')
66
- return null;
67
- const trimmed = value.trim();
68
- if (!allowed.includes(trimmed)) {
69
- throw new Error(`Invalid difficulty ${fieldName}: "${value}" is not one of [${allowed.join(', ')}]`);
70
- }
71
- return trimmed;
72
- }
73
- }
74
- exports.Difficulty = Difficulty;
75
7
  /**
76
8
  * Preview of a page linked to a route (e.g. Ropewiki page).
77
9
  * Used by GET /route/{routeId}/preview.
@@ -95,7 +27,7 @@ class PagePreview {
95
27
  * Sets difficulty.risk to the effective risk (derived from technical when risk is not set).
96
28
  */
97
29
  static fromDbRow(row, mapData, regions) {
98
- const difficulty = new Difficulty(row.technicalRating, row.waterRating, row.timeRating, row.riskRating);
30
+ const difficulty = new difficulty_1.Difficulty(row.technicalRating, row.waterRating, row.timeRating, row.riskRating);
99
31
  difficulty.risk = PagePreview.getEffectiveRisk(difficulty);
100
32
  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, PagePreview.parsePermit(row.permits));
101
33
  }
@@ -103,15 +35,15 @@ class PagePreview {
103
35
  if (value == null || value === '')
104
36
  return null;
105
37
  const trimmed = value.trim();
106
- return Object.values(PermitStatus).includes(trimmed) ? trimmed : null;
38
+ return Object.values(permitStatus_1.PermitStatus).includes(trimmed) ? trimmed : null;
107
39
  }
108
40
  static getDefaultRisk(difficulty) {
109
- if (difficulty.technical === DifficultyTechnical.One)
110
- return DifficultyRisk.G;
111
- if (difficulty.technical === DifficultyTechnical.Two)
112
- return DifficultyRisk.PG;
113
- if (difficulty.technical === DifficultyTechnical.Three || difficulty.technical === DifficultyTechnical.Four) {
114
- return DifficultyRisk.PG13;
41
+ if (difficulty.technical === difficulty_1.DifficultyTechnical.One)
42
+ return difficulty_1.DifficultyRisk.G;
43
+ if (difficulty.technical === difficulty_1.DifficultyTechnical.Two)
44
+ return difficulty_1.DifficultyRisk.PG;
45
+ if (difficulty.technical === difficulty_1.DifficultyTechnical.Three || difficulty.technical === difficulty_1.DifficultyTechnical.Four) {
46
+ return difficulty_1.DifficultyRisk.PG13;
115
47
  }
116
48
  return null;
117
49
  }
@@ -128,10 +60,10 @@ class PagePreview {
128
60
  }
129
61
  exports.PagePreview = PagePreview;
130
62
  PagePreview.RISK_ORDER = {
131
- [DifficultyRisk.G]: 0,
132
- [DifficultyRisk.PG]: 1,
133
- [DifficultyRisk.PG13]: 2,
134
- [DifficultyRisk.R]: 3,
135
- [DifficultyRisk.X]: 4,
136
- [DifficultyRisk.XX]: 5,
63
+ [difficulty_1.DifficultyRisk.G]: 0,
64
+ [difficulty_1.DifficultyRisk.PG]: 1,
65
+ [difficulty_1.DifficultyRisk.PG13]: 2,
66
+ [difficulty_1.DifficultyRisk.R]: 3,
67
+ [difficulty_1.DifficultyRisk.X]: 4,
68
+ [difficulty_1.DifficultyRisk.XX]: 5,
137
69
  };
@@ -0,0 +1,49 @@
1
+ /** Technical difficulty: 1–4 */
2
+ export declare enum DifficultyTechnical {
3
+ One = "1",
4
+ Two = "2",
5
+ Three = "3",
6
+ Four = "4"
7
+ }
8
+ /** Water difficulty: A, B, C, or C1–C4 */
9
+ export declare enum DifficultyWater {
10
+ A = "A",
11
+ B = "B",
12
+ C = "C",
13
+ C1 = "C1",
14
+ C2 = "C2",
15
+ C3 = "C3",
16
+ C4 = "C4"
17
+ }
18
+ /** Time difficulty: I–VI (Roman numerals) */
19
+ export declare enum DifficultyTime {
20
+ I = "I",
21
+ II = "II",
22
+ III = "III",
23
+ IV = "IV",
24
+ V = "V",
25
+ VI = "VI"
26
+ }
27
+ /** Risk rating: G, PG, PG13, R, X, XX */
28
+ export declare enum DifficultyRisk {
29
+ G = "G",
30
+ PG = "PG",
31
+ PG13 = "PG13",
32
+ R = "R",
33
+ X = "X",
34
+ XX = "XX"
35
+ }
36
+ /**
37
+ * Difficulty ratings for a page (e.g. Ropewiki technical, water, time, risk).
38
+ * Each property is nullable; the object is always present on PagePreview.
39
+ * Throws if a non-empty rating string is not one of the allowed enum values.
40
+ */
41
+ export declare class Difficulty {
42
+ technical: DifficultyTechnical | null;
43
+ water: DifficultyWater | null;
44
+ time: DifficultyTime | null;
45
+ risk: DifficultyRisk | null;
46
+ constructor(technicalRating: string | null | undefined, waterRating: string | null | undefined, timeRating: string | null | undefined, riskRating: string | null | undefined);
47
+ private static parseDifficultyField;
48
+ }
49
+ //# sourceMappingURL=difficulty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"difficulty.d.ts","sourceRoot":"","sources":["../../src/types/difficulty.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,oBAAY,mBAAmB;IAC3B,GAAG,MAAM;IACT,GAAG,MAAM;IACT,KAAK,MAAM;IACX,IAAI,MAAM;CACb;AAED,0CAA0C;AAC1C,oBAAY,eAAe;IACvB,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;CACZ;AAED,6CAA6C;AAC7C,oBAAY,cAAc;IACtB,CAAC,MAAM;IACP,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,EAAE,OAAO;IACT,CAAC,MAAM;IACP,EAAE,OAAO;CACZ;AAED,yCAAyC;AACzC,oBAAY,cAAc;IACtB,CAAC,MAAM;IACP,EAAE,OAAO;IACT,IAAI,SAAS;IACb,CAAC,MAAM;IACP,CAAC,MAAM;IACP,EAAE,OAAO;CACZ;AAED;;;;GAIG;AACH,qBAAa,UAAU;IACnB,SAAS,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACtC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAC9B,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;gBAGxB,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC1C,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACrC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAwBzC,OAAO,CAAC,MAAM,CAAC,oBAAoB;CActC"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Difficulty = exports.DifficultyRisk = exports.DifficultyTime = exports.DifficultyWater = exports.DifficultyTechnical = void 0;
4
+ /** Technical difficulty: 1–4 */
5
+ var DifficultyTechnical;
6
+ (function (DifficultyTechnical) {
7
+ DifficultyTechnical["One"] = "1";
8
+ DifficultyTechnical["Two"] = "2";
9
+ DifficultyTechnical["Three"] = "3";
10
+ DifficultyTechnical["Four"] = "4";
11
+ })(DifficultyTechnical || (exports.DifficultyTechnical = DifficultyTechnical = {}));
12
+ /** Water difficulty: A, B, C, or C1–C4 */
13
+ var DifficultyWater;
14
+ (function (DifficultyWater) {
15
+ DifficultyWater["A"] = "A";
16
+ DifficultyWater["B"] = "B";
17
+ DifficultyWater["C"] = "C";
18
+ DifficultyWater["C1"] = "C1";
19
+ DifficultyWater["C2"] = "C2";
20
+ DifficultyWater["C3"] = "C3";
21
+ DifficultyWater["C4"] = "C4";
22
+ })(DifficultyWater || (exports.DifficultyWater = DifficultyWater = {}));
23
+ /** Time difficulty: I–VI (Roman numerals) */
24
+ var DifficultyTime;
25
+ (function (DifficultyTime) {
26
+ DifficultyTime["I"] = "I";
27
+ DifficultyTime["II"] = "II";
28
+ DifficultyTime["III"] = "III";
29
+ DifficultyTime["IV"] = "IV";
30
+ DifficultyTime["V"] = "V";
31
+ DifficultyTime["VI"] = "VI";
32
+ })(DifficultyTime || (exports.DifficultyTime = DifficultyTime = {}));
33
+ /** Risk rating: G, PG, PG13, R, X, XX */
34
+ var DifficultyRisk;
35
+ (function (DifficultyRisk) {
36
+ DifficultyRisk["G"] = "G";
37
+ DifficultyRisk["PG"] = "PG";
38
+ DifficultyRisk["PG13"] = "PG13";
39
+ DifficultyRisk["R"] = "R";
40
+ DifficultyRisk["X"] = "X";
41
+ DifficultyRisk["XX"] = "XX";
42
+ })(DifficultyRisk || (exports.DifficultyRisk = DifficultyRisk = {}));
43
+ /**
44
+ * Difficulty ratings for a page (e.g. Ropewiki technical, water, time, risk).
45
+ * Each property is nullable; the object is always present on PagePreview.
46
+ * Throws if a non-empty rating string is not one of the allowed enum values.
47
+ */
48
+ class Difficulty {
49
+ constructor(technicalRating, waterRating, timeRating, riskRating) {
50
+ this.technical = Difficulty.parseDifficultyField(technicalRating, Object.values(DifficultyTechnical), 'technical');
51
+ this.water = Difficulty.parseDifficultyField(waterRating, Object.values(DifficultyWater), 'water');
52
+ this.time = Difficulty.parseDifficultyField(timeRating, Object.values(DifficultyTime), 'time');
53
+ this.risk = Difficulty.parseDifficultyField(riskRating, Object.values(DifficultyRisk), 'risk');
54
+ }
55
+ static parseDifficultyField(value, allowed, fieldName) {
56
+ if (value == null || value === '')
57
+ return null;
58
+ const trimmed = value.trim();
59
+ if (!allowed.includes(trimmed)) {
60
+ throw new Error(`Invalid difficulty ${fieldName}: "${value}" is not one of [${allowed.join(', ')}]`);
61
+ }
62
+ return trimmed;
63
+ }
64
+ }
65
+ exports.Difficulty = Difficulty;
@@ -0,0 +1,8 @@
1
+ /** Permit status: Yes, No, Restricted, Closed, or null. */
2
+ export declare enum PermitStatus {
3
+ Yes = "Yes",
4
+ No = "No",
5
+ Restricted = "Restricted",
6
+ Closed = "Closed"
7
+ }
8
+ //# sourceMappingURL=permitStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permitStatus.d.ts","sourceRoot":"","sources":["../../src/types/permitStatus.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAY,YAAY;IACpB,GAAG,QAAQ;IACX,EAAE,OAAO;IACT,UAAU,eAAe;IACzB,MAAM,WAAW;CACpB"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PermitStatus = void 0;
4
+ /** Permit status: Yes, No, Restricted, Closed, or null. */
5
+ var PermitStatus;
6
+ (function (PermitStatus) {
7
+ PermitStatus["Yes"] = "Yes";
8
+ PermitStatus["No"] = "No";
9
+ PermitStatus["Restricted"] = "Restricted";
10
+ PermitStatus["Closed"] = "Closed";
11
+ })(PermitStatus || (exports.PermitStatus = PermitStatus = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ropegeo-common",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Shared types and utilities for RopeGeo and WebScraper",
5
5
  "license": "ISC",
6
6
  "repository": {