@rr0/cms 0.2.0 → 0.2.2
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/org/br/region/cw/CentralWest.js +1 -2
- package/dist/org/br/region/se/SouthEast.js +1 -2
- package/dist/org/us/region/fl/Florida.js +1 -2
- package/dist/org/us/region/hi/Hawaii.js +1 -2
- package/dist/org/us/region/in/Indiana.js +1 -2
- package/dist/org/us/region/va/Virginia.js +1 -2
- package/dist/org/us/region/wa/Washington.js +1 -2
- package/dist/org/us/region/wv/WestVirginia.js +1 -2
- package/dist/people/PeopleFactory.d.ts +1 -1
- package/dist/people/PeopleFactory.js +2 -12
- package/dist/people/PeopleJson.d.ts +4 -1
- package/dist/place/PlaceService.test.js +1 -1
- package/dist/tech/info/soft/APIFactory.d.ts +2 -2
- package/dist/tech/info/soft/APIFactory.js +3 -4
- package/dist/time/TimeUrlBuilder.d.ts +1 -2
- package/dist/time/datasource/rr0/RR0HttpDatasource.js +19 -3
- package/dist/time/datasource/rr0/RR0Mapping.d.ts +2 -2
- package/dist/time/datasource/rr0/RR0TestCases.js +1 -1
- package/dist/time/datasource/sceau/SceauCaseSummaryRR0Mapper.js +10 -1
- package/package.json +4 -4
- package/dist/place/NamedPlace.d.ts +0 -5
- package/dist/place/NamedPlace.js +0 -7
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Place } from "@rr0/place";
|
|
1
|
+
import { Place, PlaceLocation } from "@rr0/place";
|
|
2
2
|
import { brazilRegion } from "../../Brazil.js";
|
|
3
3
|
import { BrazilRegionCode } from "../BrazilRegionCode.js";
|
|
4
|
-
import { PlaceLocation } from "@rr0/place";
|
|
5
4
|
export const centralWest = brazilRegion(BrazilRegionCode.cw, new Place([PlaceLocation.fromDMS("14°47′S,53°31′O")]));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Place } from "@rr0/place";
|
|
1
|
+
import { Place, PlaceLocation } from "@rr0/place";
|
|
2
2
|
import { brazilRegion } from "../../Brazil.js";
|
|
3
3
|
import { BrazilRegionCode } from "../BrazilRegionCode.js";
|
|
4
|
-
import { PlaceLocation } from "@rr0/place";
|
|
5
4
|
export const southEast = brazilRegion(BrazilRegionCode.se, new Place([PlaceLocation.fromDMS("14°47′S,53°31′O")]));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Place } from "@rr0/place";
|
|
1
|
+
import { Place, PlaceLocation } from "@rr0/place";
|
|
2
2
|
import { UsaStates } from "../UsaStates.js";
|
|
3
3
|
import { usaRegion } from "../../Usa.js";
|
|
4
|
-
import { PlaceLocation } from "@rr0/place";
|
|
5
4
|
export const florida = usaRegion(UsaStates.fl, new Place([PlaceLocation.fromDMS("24°27'N,80° 02' W"), PlaceLocation.fromDMS("31° 00' N,87° 38' W")]));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Place } from "@rr0/place";
|
|
1
|
+
import { Place, PlaceLocation } from "@rr0/place";
|
|
2
2
|
import { UsaStates } from "../UsaStates.js";
|
|
3
3
|
import { usaRegion } from "../../Usa.js";
|
|
4
|
-
import { PlaceLocation } from "@rr0/place";
|
|
5
4
|
export const hawaii = usaRegion(UsaStates.hi, new Place([PlaceLocation.fromDMS("21°28′00″N,157°58′00″W")]));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Place } from "@rr0/place";
|
|
1
|
+
import { Place, PlaceLocation } from "@rr0/place";
|
|
2
2
|
import { UsaStates } from "../UsaStates.js";
|
|
3
3
|
import { usaRegion } from "../../Usa.js";
|
|
4
|
-
import { PlaceLocation } from "@rr0/place";
|
|
5
4
|
export const indiana = usaRegion(UsaStates.in, new Place([PlaceLocation.fromDMS("39°09′44″N,86°31′45″O")]));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Place } from "@rr0/place";
|
|
1
|
+
import { Place, PlaceLocation } from "@rr0/place";
|
|
2
2
|
import { UsaStates } from "../UsaStates.js";
|
|
3
3
|
import { usaRegion } from "../../Usa.js";
|
|
4
|
-
import { PlaceLocation } from "@rr0/place";
|
|
5
4
|
export const virginia = usaRegion(UsaStates.va, new Place([PlaceLocation.fromDMS("38°0'N, 79°0'W")]));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Place } from "@rr0/place";
|
|
1
|
+
import { Place, PlaceLocation } from "@rr0/place";
|
|
2
2
|
import { UsaStates } from "../UsaStates.js";
|
|
3
3
|
import { usaRegion } from "../../Usa.js";
|
|
4
|
-
import { PlaceLocation } from "@rr0/place";
|
|
5
4
|
export const washington = usaRegion(UsaStates.wa, new Place([PlaceLocation.fromDMS("45°33′ N,116°55′ W"), PlaceLocation.fromDMS("49°0' N,124°46′ W")]));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Place } from "@rr0/place";
|
|
1
|
+
import { Place, PlaceLocation } from "@rr0/place";
|
|
2
2
|
import { UsaStates } from "../UsaStates.js";
|
|
3
3
|
import { usaRegion } from "../../Usa.js";
|
|
4
|
-
import { PlaceLocation } from "@rr0/place";
|
|
5
4
|
export const westVirginia = usaRegion(UsaStates.wv, new Place([PlaceLocation.fromDMS("38°51′27″N,82°7′43″W")]));
|
|
@@ -22,7 +22,7 @@ export class PeopleFactory extends TypedDataFactory {
|
|
|
22
22
|
const id = path.basename(dirName);
|
|
23
23
|
return new People(firstNames, lastName, undefined, undefined, undefined, false, undefined, undefined, undefined, id, dirName);
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
parse(peopleJson) {
|
|
26
26
|
const people = this.createFromDirName(peopleJson.dirName);
|
|
27
27
|
peopleJson.name = people.name;
|
|
28
28
|
Object.assign(people, super.parse(peopleJson));
|
|
@@ -49,17 +49,7 @@ export class PeopleFactory extends TypedDataFactory {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
people.title = people.firstAndLastName + (qualifier ? ` (${qualifier})` : "");
|
|
52
|
-
|
|
53
|
-
const events = peopleJson.events || [];
|
|
54
|
-
if (birthTime) {
|
|
55
|
-
delete peopleJson.birthTime;
|
|
56
|
-
events.push({ type: "event", eventType: "birth", time: birthTime, events: [] });
|
|
57
|
-
}
|
|
58
|
-
const deathTime = peopleJson.deathTime;
|
|
59
|
-
if (deathTime) {
|
|
60
|
-
delete peopleJson.deathTime;
|
|
61
|
-
events.push({ type: "event", eventType: "death", time: deathTime, events: [] });
|
|
62
|
-
}
|
|
52
|
+
Object.assign(people, { events: peopleJson.events.map(this.eventFactory.parse) });
|
|
63
53
|
return people;
|
|
64
54
|
}
|
|
65
55
|
}
|
|
@@ -23,9 +23,12 @@ export declare class PeopleJson implements RR0DataJson {
|
|
|
23
23
|
*/
|
|
24
24
|
discredited: boolean;
|
|
25
25
|
/**
|
|
26
|
-
* @deprecated Use a "birth"-typed
|
|
26
|
+
* @deprecated Use a "birth"-typed event instead.
|
|
27
27
|
*/
|
|
28
28
|
birthTime?: EdtfDate;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Use a "death"-typed event instead.
|
|
31
|
+
*/
|
|
29
32
|
deathTime?: EdtfDate;
|
|
30
33
|
gender?: Gender;
|
|
31
34
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, test } from "@javarome/testscript";
|
|
2
|
-
import {
|
|
2
|
+
import { GooglePlaceService, PlaceLocation } from "@rr0/place";
|
|
3
3
|
describe("PlaceService", () => {
|
|
4
4
|
const apiKey = process.env.GOOGLE_MAPS_API_KEY;
|
|
5
5
|
if (!apiKey) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { API } from "./API.js";
|
|
2
|
-
import {
|
|
2
|
+
import { RR0EventFactory, TypedDataFactory } from "@rr0/data";
|
|
3
3
|
import { APIJson } from "./APIJson";
|
|
4
4
|
export declare class APIFactory extends TypedDataFactory<API, APIJson> {
|
|
5
5
|
constructor(eventFactory: RR0EventFactory);
|
|
6
|
-
|
|
6
|
+
parse(apiJson: APIJson): API;
|
|
7
7
|
}
|
|
@@ -3,9 +3,8 @@ export class APIFactory extends TypedDataFactory {
|
|
|
3
3
|
constructor(eventFactory) {
|
|
4
4
|
super(eventFactory, "api", ["index"]);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
return api;
|
|
6
|
+
parse(apiJson) {
|
|
7
|
+
const events = apiJson.events.map(this.eventFactory.parse);
|
|
8
|
+
return { type: "api", id: apiJson.id, dirName: apiJson.dirName, url: apiJson.url, events };
|
|
10
9
|
}
|
|
11
10
|
}
|
|
@@ -2,8 +2,8 @@ import { HttpSource } from "../HttpSource.js";
|
|
|
2
2
|
import { UrlUtil } from "../../../util/index.js";
|
|
3
3
|
import { RR0Datasource } from "./RR0Datasource.js";
|
|
4
4
|
import { Level2Date as EdtfDate } from "@rr0/time";
|
|
5
|
+
import { NamedPlace } from "@rr0/place";
|
|
5
6
|
import { OrganizationPlace } from "../../../place/OrganizationPlace";
|
|
6
|
-
import { NamedPlace } from "../../../place/NamedPlace";
|
|
7
7
|
export class RR0HttpDatasource extends RR0Datasource {
|
|
8
8
|
constructor(baseUrl, searchPath, cityService) {
|
|
9
9
|
super();
|
|
@@ -55,7 +55,17 @@ export class RR0HttpDatasource extends RR0Datasource {
|
|
|
55
55
|
const sources = this.getSources(row, itemContext);
|
|
56
56
|
const description = this.getDescription(row);
|
|
57
57
|
const id = RR0HttpDatasource.id(itemTime.date, place);
|
|
58
|
-
return {
|
|
58
|
+
return {
|
|
59
|
+
type: "event",
|
|
60
|
+
eventType: "sighting",
|
|
61
|
+
events: [],
|
|
62
|
+
url: url.href,
|
|
63
|
+
place,
|
|
64
|
+
time: itemTime.date,
|
|
65
|
+
description,
|
|
66
|
+
sources,
|
|
67
|
+
id
|
|
68
|
+
};
|
|
59
69
|
}
|
|
60
70
|
async readCases(context) {
|
|
61
71
|
const queryUrl = this.queryUrl(context);
|
|
@@ -77,7 +87,13 @@ export class RR0HttpDatasource extends RR0Datasource {
|
|
|
77
87
|
const pubItems = title.split(",");
|
|
78
88
|
const timeStr = pubItems[pubItems.length - 1].trim();
|
|
79
89
|
let publisher;
|
|
80
|
-
|
|
90
|
+
let time;
|
|
91
|
+
try {
|
|
92
|
+
time = EdtfDate.fromString(timeStr);
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
console.warn("Could not parse source time", e);
|
|
96
|
+
}
|
|
81
97
|
if (time) {
|
|
82
98
|
pubItems.pop();
|
|
83
99
|
}
|
|
@@ -7,10 +7,10 @@ import { CityService } from "../../../org";
|
|
|
7
7
|
import { RR0Datasource } from "./RR0Datasource";
|
|
8
8
|
export declare class RR0Mapping implements RR0CaseMapping<RR0CaseSummary> {
|
|
9
9
|
readonly actions: ChronologyReplacerActions;
|
|
10
|
+
static baseUrl: URL;
|
|
11
|
+
static searchPath: string;
|
|
10
12
|
readonly datasource: RR0Datasource;
|
|
11
13
|
readonly fileDatasource: RR0FileDatasource;
|
|
12
14
|
readonly mapper: RR0CaseSummaryMapper;
|
|
13
|
-
static baseUrl: URL;
|
|
14
|
-
static searchPath: string;
|
|
15
15
|
constructor(cityService: CityService, actions: ChronologyReplacerActions);
|
|
16
16
|
}
|
|
@@ -2,7 +2,7 @@ import { Level2Date as EdtfDate } from "@rr0/time";
|
|
|
2
2
|
import { UrlUtil } from "../../../util/index.js";
|
|
3
3
|
import { RR0HttpDatasource } from "./RR0HttpDatasource";
|
|
4
4
|
import { RR0Mapping } from "./RR0Mapping";
|
|
5
|
-
import { NamedPlace } from "
|
|
5
|
+
import { NamedPlace } from "@rr0/place";
|
|
6
6
|
function testCase(urlPath, time, description, sources, place) {
|
|
7
7
|
const path = UrlUtil.join(RR0Mapping.searchPath, urlPath);
|
|
8
8
|
const url = new URL(path, RR0Mapping.baseUrl).href;
|
|
@@ -16,7 +16,16 @@ export class SceauCaseSummaryRR0Mapper {
|
|
|
16
16
|
const source = {
|
|
17
17
|
previousSourceRefs: [], events: [],
|
|
18
18
|
url: sourceCase.url, title: "cas n° " + id, authors: this.authors,
|
|
19
|
-
publication: {
|
|
19
|
+
publication: {
|
|
20
|
+
publisher: this.copyright,
|
|
21
|
+
time: new EdtfDate({
|
|
22
|
+
year: sourceTime.getFullYear(),
|
|
23
|
+
month: sourceTime.getMonth(),
|
|
24
|
+
day: sourceTime.getDate(),
|
|
25
|
+
hour: sourceTime.getHours(),
|
|
26
|
+
minute: sourceTime.getSeconds()
|
|
27
|
+
})
|
|
28
|
+
}
|
|
20
29
|
};
|
|
21
30
|
const cityName = sourceCase.ville;
|
|
22
31
|
const city = this.cityService.find(context, cityName, undefined);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@rr0/cms",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"author": "Jérôme Beau <rr0@rr0.org> (https://rr0.org)",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.2",
|
|
6
6
|
"description": "RR0 Content Management System (CMS)",
|
|
7
7
|
"exports": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
"build": "rm -Rf dist && tsc --project tsconfig.prod.json",
|
|
25
25
|
"prepublishOnly": "npm run build",
|
|
26
26
|
"test": "testscript",
|
|
27
|
-
"test-one": "rm -Rf out && tsx src/
|
|
27
|
+
"test-one": "rm -Rf out && tsx src/RR0Build.test.ts",
|
|
28
28
|
"test-ci": "rm -Rf out && testscript"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@rr0/common": "^1.1.3",
|
|
32
32
|
"@rr0/lang": "^0.1.12",
|
|
33
33
|
"@rr0/time": "^0.9.1",
|
|
34
|
-
"@rr0/place": "^0.5.
|
|
35
|
-
"@rr0/data": "^0.2.
|
|
34
|
+
"@rr0/place": "^0.5.1",
|
|
35
|
+
"@rr0/data": "^0.2.1",
|
|
36
36
|
"@javarome/fileutil": "^0.3.6",
|
|
37
37
|
"ssg-api": "^1.16.12",
|
|
38
38
|
"canvas": "^2.11.2",
|