ropegeo-common 1.2.8 → 1.2.10
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 +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/types/api/getRopewikiRegionView/ropewikiRegionView.d.ts +25 -23
- package/dist/types/api/getRopewikiRegionView/ropewikiRegionView.d.ts.map +1 -1
- package/dist/types/api/getRopewikiRegionView/ropewikiRegionView.js +115 -14
- package/dist/types/cursors/cursor.d.ts.map +1 -1
- package/dist/types/cursors/cursor.js +3 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ export { SearchParams } from './types/api/search/searchParams';
|
|
|
19
19
|
export type { SearchOrder } from './types/api/search/searchParams';
|
|
20
20
|
export { SearchResults } from './types/api/search/searchResults';
|
|
21
21
|
export { RopewikiRegionView } from './types/api/getRopewikiRegionView/ropewikiRegionView';
|
|
22
|
-
export type { RopewikiRegionViewRow } from './types/api/getRopewikiRegionView/ropewikiRegionView';
|
|
23
22
|
export { RegionPreviewsCursor } from './types/cursors/regionPreviewsCursor';
|
|
24
23
|
export { RopewikiRegionPreviewsParams } from './types/api/getRopewikiRegionPreviews/ropewikiRegionPreviewsParams';
|
|
25
24
|
export { RopewikiRegionPreviewsResult } from './types/api/getRopewikiRegionPreviews/ropewikiRegionPreviewsResult';
|
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,OAAO,EAAE,WAAW,EAAE,MAAM,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E,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"}
|
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Row shape from the database (or join) for building a RopewikiRegionView.
|
|
3
|
-
* Column names match the RopewikiRegion schema; parentRegionId/parentRegionName
|
|
4
|
-
* come from a join when loading the parent region.
|
|
5
|
-
*/
|
|
6
|
-
export interface RopewikiRegionViewRow {
|
|
7
|
-
name: string;
|
|
8
|
-
parentRegionId?: string | null;
|
|
9
|
-
parentRegionName?: string | null;
|
|
10
|
-
rawPageCount?: number | null;
|
|
11
|
-
truePageCount?: number | null;
|
|
12
|
-
trueRegionCount?: number | null;
|
|
13
|
-
truePageCountWithDescendents?: number | null;
|
|
14
|
-
overview?: string | null;
|
|
15
|
-
bestMonths?: string[] | null;
|
|
16
|
-
isMajorRegion?: boolean | null;
|
|
17
|
-
latestRevisionDate: Date;
|
|
18
|
-
url: string;
|
|
19
|
-
}
|
|
20
1
|
/**
|
|
21
2
|
* Region view for getRopewikiRegionView (GET /ropewiki/region/{id}).
|
|
22
3
|
* Contains all RopewikiRegion info for the region except the region's id.
|
|
23
4
|
*/
|
|
24
5
|
export declare class RopewikiRegionView {
|
|
25
6
|
name: string;
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
/** Full lineage of parent regions from immediate parent up to root (same shape as RopewikiPageView.regions). */
|
|
8
|
+
regions: {
|
|
28
9
|
name: string;
|
|
29
|
-
|
|
10
|
+
id: string;
|
|
11
|
+
}[];
|
|
30
12
|
/** Actual number of pages in this region (computed). Default 0. */
|
|
31
13
|
regionCount: number;
|
|
32
14
|
/** Pages in this region only (computed). Default 0. */
|
|
33
15
|
topLevelPageCount: number;
|
|
34
16
|
/** Raw page count from getRegions API (rawPageCount). Default 0. */
|
|
35
17
|
pageCount: number;
|
|
18
|
+
/** Pages in this region and all descendants (truePageCountWithDescendents). Default 0. */
|
|
19
|
+
totalPageCount: number;
|
|
36
20
|
overview: string | null;
|
|
37
21
|
bestMonths: string[];
|
|
38
22
|
isMajorRegion: boolean;
|
|
39
23
|
latestRevisionDate: Date;
|
|
24
|
+
/** When the region was last synced (from updatedAt). */
|
|
25
|
+
syncDate: Date;
|
|
40
26
|
externalLink: string;
|
|
41
|
-
constructor(
|
|
27
|
+
constructor(name: string, latestRevisionDate: Date, url: string, updatedAt: Date, regions?: {
|
|
28
|
+
name: string;
|
|
29
|
+
id: string;
|
|
30
|
+
}[], rawPageCount?: number | null, truePageCount?: number | null, trueRegionCount?: number | null, truePageCountWithDescendents?: number | null, overview?: string | null, bestMonths?: string[] | null, isMajorRegion?: boolean | null);
|
|
31
|
+
/**
|
|
32
|
+
* Validates response body has RopewikiRegionView fields and returns a RopewikiRegionView instance.
|
|
33
|
+
* Mutates the body (parses latestRevisionDate to Date) and sets RopewikiRegionView.prototype.
|
|
34
|
+
*/
|
|
35
|
+
static fromResponseBody(body: unknown): RopewikiRegionView;
|
|
36
|
+
private static assertString;
|
|
37
|
+
private static assertNullableString;
|
|
38
|
+
private static assertNonNegativeNumber;
|
|
39
|
+
private static assertRegionsArray;
|
|
40
|
+
private static assertStringArray;
|
|
41
|
+
private static assertBoolean;
|
|
42
|
+
private static assertIso8601DateString;
|
|
43
|
+
private static assertValidUrl;
|
|
42
44
|
}
|
|
43
45
|
//# sourceMappingURL=ropewikiRegionView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ropewikiRegionView.d.ts","sourceRoot":"","sources":["../../../../src/types/api/getRopewikiRegionView/ropewikiRegionView.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ropewikiRegionView.d.ts","sourceRoot":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OAAO,CAAC,MAAM,CAAC,YAAY;IAS3B,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAYnC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAYtC,OAAO,CAAC,MAAM,CAAC,kBAAkB;IA+BjC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAmBhC,OAAO,CAAC,MAAM,CAAC,aAAa;IAY5B,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAkBtC,OAAO,CAAC,MAAM,CAAC,cAAc;CAkBhC"}
|
|
@@ -6,20 +6,121 @@ exports.RopewikiRegionView = void 0;
|
|
|
6
6
|
* Contains all RopewikiRegion info for the region except the region's id.
|
|
7
7
|
*/
|
|
8
8
|
class RopewikiRegionView {
|
|
9
|
-
constructor(
|
|
10
|
-
this.name =
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
|
|
9
|
+
constructor(name, latestRevisionDate, url, updatedAt, regions, rawPageCount, truePageCount, trueRegionCount, truePageCountWithDescendents, overview, bestMonths, isMajorRegion) {
|
|
10
|
+
this.name = name;
|
|
11
|
+
this.regions = Array.isArray(regions) ? regions.slice() : [];
|
|
12
|
+
this.regionCount = trueRegionCount ?? 0;
|
|
13
|
+
this.topLevelPageCount = truePageCount ?? 0;
|
|
14
|
+
this.pageCount = rawPageCount ?? 0;
|
|
15
|
+
this.totalPageCount = truePageCountWithDescendents ?? 0;
|
|
16
|
+
this.overview = overview ?? null;
|
|
17
|
+
this.bestMonths = Array.isArray(bestMonths) ? bestMonths : [];
|
|
18
|
+
this.isMajorRegion = isMajorRegion ?? false;
|
|
19
|
+
this.latestRevisionDate = new Date(latestRevisionDate);
|
|
20
|
+
this.syncDate = new Date(updatedAt);
|
|
21
|
+
this.externalLink = url;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Validates response body has RopewikiRegionView fields and returns a RopewikiRegionView instance.
|
|
25
|
+
* Mutates the body (parses latestRevisionDate to Date) and sets RopewikiRegionView.prototype.
|
|
26
|
+
*/
|
|
27
|
+
static fromResponseBody(body) {
|
|
28
|
+
if (body == null || typeof body !== 'object') {
|
|
29
|
+
throw new Error('RopewikiRegionView body must be an object');
|
|
30
|
+
}
|
|
31
|
+
const r = body;
|
|
32
|
+
RopewikiRegionView.assertString(r, 'name');
|
|
33
|
+
RopewikiRegionView.assertRegionsArray(r, 'regions');
|
|
34
|
+
RopewikiRegionView.assertNonNegativeNumber(r, 'regionCount');
|
|
35
|
+
RopewikiRegionView.assertNonNegativeNumber(r, 'topLevelPageCount');
|
|
36
|
+
RopewikiRegionView.assertNonNegativeNumber(r, 'pageCount');
|
|
37
|
+
RopewikiRegionView.assertNonNegativeNumber(r, 'totalPageCount');
|
|
38
|
+
RopewikiRegionView.assertNullableString(r, 'overview');
|
|
39
|
+
RopewikiRegionView.assertStringArray(r, 'bestMonths');
|
|
40
|
+
RopewikiRegionView.assertBoolean(r, 'isMajorRegion');
|
|
41
|
+
RopewikiRegionView.assertIso8601DateString(r, 'latestRevisionDate');
|
|
42
|
+
RopewikiRegionView.assertIso8601DateString(r, 'syncDate');
|
|
43
|
+
RopewikiRegionView.assertValidUrl(r, 'externalLink');
|
|
44
|
+
r.latestRevisionDate = new Date(r.latestRevisionDate);
|
|
45
|
+
r.syncDate = new Date(r.syncDate);
|
|
46
|
+
Object.setPrototypeOf(r, RopewikiRegionView.prototype);
|
|
47
|
+
return r;
|
|
48
|
+
}
|
|
49
|
+
static assertString(obj, key) {
|
|
50
|
+
const v = obj[key];
|
|
51
|
+
if (typeof v !== 'string') {
|
|
52
|
+
throw new Error(`RopewikiRegionView.${key} must be a string, got: ${typeof v}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
static assertNullableString(obj, key) {
|
|
56
|
+
const v = obj[key];
|
|
57
|
+
if (v !== null && v !== undefined && typeof v !== 'string') {
|
|
58
|
+
throw new Error(`RopewikiRegionView.${key} must be string or null, got: ${typeof v}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
static assertNonNegativeNumber(obj, key) {
|
|
62
|
+
const v = obj[key];
|
|
63
|
+
if (typeof v !== 'number' || Number.isNaN(v) || v < 0) {
|
|
64
|
+
throw new Error(`RopewikiRegionView.${key} must be a number >= 0, got: ${typeof v}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
static assertRegionsArray(obj, key) {
|
|
68
|
+
const v = obj[key];
|
|
69
|
+
if (!Array.isArray(v)) {
|
|
70
|
+
throw new Error(`RopewikiRegionView.${key} must be an array, got: ${typeof v}`);
|
|
71
|
+
}
|
|
72
|
+
for (let i = 0; i < v.length; i++) {
|
|
73
|
+
const item = v[i];
|
|
74
|
+
if (item == null || typeof item !== 'object') {
|
|
75
|
+
throw new Error(`RopewikiRegionView.${key}[${i}] must be an object with id and name`);
|
|
76
|
+
}
|
|
77
|
+
const o = item;
|
|
78
|
+
if (typeof o.id !== 'string') {
|
|
79
|
+
throw new Error(`RopewikiRegionView.${key}[${i}].id must be a string, got: ${typeof o.id}`);
|
|
80
|
+
}
|
|
81
|
+
if (typeof o.name !== 'string') {
|
|
82
|
+
throw new Error(`RopewikiRegionView.${key}[${i}].name must be a string, got: ${typeof o.name}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
static assertStringArray(obj, key) {
|
|
87
|
+
const v = obj[key];
|
|
88
|
+
if (!Array.isArray(v)) {
|
|
89
|
+
throw new Error(`RopewikiRegionView.${key} must be an array, got: ${typeof v}`);
|
|
90
|
+
}
|
|
91
|
+
for (let i = 0; i < v.length; i++) {
|
|
92
|
+
if (typeof v[i] !== 'string') {
|
|
93
|
+
throw new Error(`RopewikiRegionView.${key}[${i}] must be a string`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
static assertBoolean(obj, key) {
|
|
98
|
+
const v = obj[key];
|
|
99
|
+
if (typeof v !== 'boolean') {
|
|
100
|
+
throw new Error(`RopewikiRegionView.${key} must be a boolean, got: ${typeof v}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
static assertIso8601DateString(obj, key) {
|
|
104
|
+
const v = obj[key];
|
|
105
|
+
if (typeof v !== 'string') {
|
|
106
|
+
throw new Error(`RopewikiRegionView.${key} must be an ISO 8601 date string, got: ${typeof v}`);
|
|
107
|
+
}
|
|
108
|
+
const date = new Date(v);
|
|
109
|
+
if (Number.isNaN(date.getTime())) {
|
|
110
|
+
throw new Error(`RopewikiRegionView.${key} must be a valid ISO 8601 date string, got: ${v}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
static assertValidUrl(obj, key) {
|
|
114
|
+
const v = obj[key];
|
|
115
|
+
if (typeof v !== 'string') {
|
|
116
|
+
throw new Error(`RopewikiRegionView.${key} must be a string (valid URL), got: ${typeof v}`);
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
new URL(v);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
throw new Error(`RopewikiRegionView.${key} must be a valid URL, got: ${v}`);
|
|
123
|
+
}
|
|
23
124
|
}
|
|
24
125
|
}
|
|
25
126
|
exports.RopewikiRegionView = RopewikiRegionView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/types/cursors/cursor.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IAClB,MAAM,WAAW;IACjB,cAAc,oBAAoB;IAClC,YAAY,kBAAkB;CACjC;
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/types/cursors/cursor.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IAClB,MAAM,WAAW;IACjB,cAAc,oBAAoB;IAClC,YAAY,kBAAkB;CACjC;AAuBD;;;GAGG;AACH,8BAAsB,MAAM;IACxB,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAEzC,0EAA0E;IAC1E,SAAS,CAAC,QAAQ,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAEvD,YAAY,IAAI,MAAM;IAMtB;;;OAGG;IACH,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAkB7F;;;OAGG;IACH,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAC/B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,QAAQ,EAAE,UAAU,EACpB,UAAU,EAAE,MAAM,GACnB,IAAI;CAUV"}
|
|
@@ -8,13 +8,11 @@ var CursorType;
|
|
|
8
8
|
CursorType["RegionImages"] = "region_images";
|
|
9
9
|
})(CursorType || (exports.CursorType = CursorType = {}));
|
|
10
10
|
/**
|
|
11
|
-
* Base64url encode/decode
|
|
12
|
-
*
|
|
11
|
+
* Base64url encode/decode using only atob/btoa and TextEncoder/TextDecoder so it works in
|
|
12
|
+
* Node, React Native (Hermes), and browser without ever referencing Buffer (which is not
|
|
13
|
+
* available in RN and can cause "Property 'Buffer' doesn't exist" when bundlers inline code).
|
|
13
14
|
*/
|
|
14
15
|
function base64UrlEncode(utf8) {
|
|
15
|
-
if (typeof Buffer !== 'undefined') {
|
|
16
|
-
return Buffer.from(utf8, 'utf8').toString('base64url');
|
|
17
|
-
}
|
|
18
16
|
const bytes = new TextEncoder().encode(utf8);
|
|
19
17
|
let binary = '';
|
|
20
18
|
for (let i = 0; i < bytes.length; i++) {
|
|
@@ -25,9 +23,6 @@ function base64UrlEncode(utf8) {
|
|
|
25
23
|
}
|
|
26
24
|
function base64UrlDecode(encoded) {
|
|
27
25
|
const base64 = encoded.replace(/-/g, '+').replace(/_/g, '/') + '='.repeat((4 - (encoded.length % 4)) % 4);
|
|
28
|
-
if (typeof Buffer !== 'undefined') {
|
|
29
|
-
return Buffer.from(base64, 'base64').toString('utf8');
|
|
30
|
-
}
|
|
31
26
|
const binary = atob(base64);
|
|
32
27
|
return new TextDecoder().decode(Uint8Array.from(binary, (c) => c.charCodeAt(0)));
|
|
33
28
|
}
|