@rr0/cms 0.3.6 → 0.3.8
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/country/Countries.js +2 -1
- package/dist/org/jp/Japan.d.ts +2 -0
- package/dist/org/jp/Japan.js +3 -0
- package/dist/people/PeopleReplacer.js +1 -1
- package/dist/place/OrganizationPlace.js +2 -1
- package/dist/place/OrganizationPlace.test.d.ts +1 -0
- package/dist/place/OrganizationPlace.test.js +24 -0
- package/dist/place/PlaceReplacer.test.js +1 -2
- package/dist/time/datasource/rr0/RR0Datasource.test.js +0 -3
- package/package.json +3 -3
|
@@ -29,6 +29,7 @@ import { uk } from "../uk/Uk";
|
|
|
29
29
|
import { usa } from "../us/Usa";
|
|
30
30
|
import { CmsCountry } from "./CmsCountry";
|
|
31
31
|
import { georgia } from "../ge/Georgia";
|
|
32
|
+
import { japan } from "../jp/Japan";
|
|
32
33
|
export const countries = [
|
|
33
34
|
algeria,
|
|
34
35
|
new CmsCountry(CountryCode.ar),
|
|
@@ -56,7 +57,7 @@ export const countries = [
|
|
|
56
57
|
india,
|
|
57
58
|
new CmsCountry(CountryCode.ir),
|
|
58
59
|
new CmsCountry(CountryCode.it),
|
|
59
|
-
|
|
60
|
+
japan,
|
|
60
61
|
new CmsCountry(CountryCode.ma),
|
|
61
62
|
mexico,
|
|
62
63
|
mozambique,
|
|
@@ -17,7 +17,7 @@ export class PeopleReplacer {
|
|
|
17
17
|
peopleStr = peopleStr.trim().replaceAll("\n", "").replace(/ /g, " ");
|
|
18
18
|
let people = this.service.cache.get(peopleStr);
|
|
19
19
|
if (!people) {
|
|
20
|
-
people = this.service.
|
|
20
|
+
people = this.service.createFromTitle(peopleStr);
|
|
21
21
|
}
|
|
22
22
|
let url = people.dirName;
|
|
23
23
|
let replacement;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Place } from "@rr0/place";
|
|
2
2
|
export class OrganizationPlace extends Place {
|
|
3
3
|
constructor(org) {
|
|
4
|
-
|
|
4
|
+
var _a, _b, _c;
|
|
5
|
+
super(((_a = org.places[0]) === null || _a === void 0 ? void 0 : _a.locations) || [], (_b = org.places[0]) === null || _b === void 0 ? void 0 : _b.elevation, (_c = org.places[0]) === null || _c === void 0 ? void 0 : _c.dirName);
|
|
5
6
|
this.org = org;
|
|
6
7
|
Object.assign(this, org.places[0]);
|
|
7
8
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, expect, test } from "@javarome/testscript";
|
|
2
|
+
import { OrganizationPlace } from "./OrganizationPlace";
|
|
3
|
+
import { parisCity } from "../org/eu/fr/region/idf/75/paris/Paris";
|
|
4
|
+
import { RR0Datasource } from "../time";
|
|
5
|
+
import { Level2Date as EdtfDate } from "@rr0/time";
|
|
6
|
+
import { CountryCode } from "@rr0/data";
|
|
7
|
+
import { CmsCountry } from "../org/country/CmsCountry";
|
|
8
|
+
describe("OrganizationPlace", () => {
|
|
9
|
+
test("existing organization", async () => {
|
|
10
|
+
const org = parisCity;
|
|
11
|
+
const place = new OrganizationPlace(org);
|
|
12
|
+
expect(place.org).toBe(org);
|
|
13
|
+
expect(place.locations).toBe(org.places[0].locations);
|
|
14
|
+
});
|
|
15
|
+
test("organization with no places", async () => {
|
|
16
|
+
const org = new CmsCountry(CountryCode.jp);
|
|
17
|
+
const place = new OrganizationPlace(org);
|
|
18
|
+
expect(place.org).toBe(org);
|
|
19
|
+
expect(place.locations).toEqual([]);
|
|
20
|
+
});
|
|
21
|
+
test("toString", () => {
|
|
22
|
+
expect(RR0Datasource.id(EdtfDate.fromString("1972-08-12"), new OrganizationPlace(parisCity))).toBe("1972-08-12$city$75000");
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -52,8 +52,7 @@ describe("PlaceReplacer", () => {
|
|
|
52
52
|
placeTag.innerHTML = text;
|
|
53
53
|
return placeTag;
|
|
54
54
|
}
|
|
55
|
-
test("link to existing organization", async () => {
|
|
56
|
-
return; // Disable test
|
|
55
|
+
test("link to existing organization", { skip: true }, async () => {
|
|
57
56
|
const location = new PlaceLocation(35.8440582, -106.287162);
|
|
58
57
|
const elevation = 2161.025390625;
|
|
59
58
|
const dirName = "org/us/state/nm/lanl/";
|
|
@@ -9,8 +9,6 @@ import { TimeTextBuilder } from "../../text/TimeTextBuilder.js";
|
|
|
9
9
|
import { RR0CaseSummaryMapper } from "./RR0CaseSummaryMapper";
|
|
10
10
|
import { RR0FileDatasource } from "./RR0FileDatasource";
|
|
11
11
|
import { NamedPlace } from "@rr0/place";
|
|
12
|
-
import { OrganizationPlace } from "../../../place/OrganizationPlace";
|
|
13
|
-
import { parisCity } from "../../../org/eu/fr/region/idf/75/paris/Paris";
|
|
14
12
|
export class RR0TestDatasource extends RR0Datasource {
|
|
15
13
|
constructor() {
|
|
16
14
|
super();
|
|
@@ -89,7 +87,6 @@ describe("RR0CaseSource", () => {
|
|
|
89
87
|
});
|
|
90
88
|
test("id", async () => {
|
|
91
89
|
expect(RR0Datasource.id(EdtfDate.fromString("1972-08-12"), new NamedPlace("Chatillon"))).toBe("1972-08-12$Chatillon");
|
|
92
|
-
expect(RR0Datasource.id(EdtfDate.fromString("1972-08-12"), new OrganizationPlace(parisCity))).toBe("1972-08-12$city$75000");
|
|
93
90
|
expect(RR0Datasource.id(EdtfDate.fromString("1972-08-12"), undefined)).toBe("1972-08-12$");
|
|
94
91
|
});
|
|
95
92
|
});
|
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.3.
|
|
5
|
+
"version": "0.3.8",
|
|
6
6
|
"description": "RR0 Content Management System (CMS)",
|
|
7
7
|
"exports": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
@@ -24,13 +24,13 @@
|
|
|
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
|
"@javarome/fileutil": "^0.3.6",
|
|
32
32
|
"@rr0/common": "^1.1.3",
|
|
33
|
-
"@rr0/data": "^0.3.
|
|
33
|
+
"@rr0/data": "^0.3.8",
|
|
34
34
|
"@rr0/lang": "^0.1.12",
|
|
35
35
|
"@rr0/place": "^0.5.2",
|
|
36
36
|
"@rr0/time": "^0.10.0",
|