@rr0/cms 0.3.1 → 0.3.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/RR0Build.js +2 -2
- package/dist/RR0Build.test.js +2 -4
- package/dist/org/CmsOrganization.d.ts +1 -4
- package/dist/org/CmsOrganization.js +3 -4
- package/dist/org/CmsOrganizationFactory.d.ts +7 -0
- package/dist/org/CmsOrganizationFactory.js +13 -0
- package/dist/org/OrganizationService.d.ts +3 -3
- package/dist/org/br/Brazil.js +1 -2
- package/dist/org/index.d.ts +1 -1
- package/dist/org/index.js +1 -1
- package/dist/place/PlaceReplacer.test.js +2 -0
- package/dist/test/RR0TestUtil.d.ts +2 -2
- package/dist/test/RR0TestUtil.js +2 -2
- package/package.json +2 -2
- package/dist/org/OrganizationFactory.d.ts +0 -7
- package/dist/org/OrganizationFactory.js +0 -12
- package/dist/org/OrganizationJson.d.ts +0 -17
- package/dist/org/OrganizationJson.js +0 -6
package/dist/RR0Build.js
CHANGED
|
@@ -3,7 +3,7 @@ import fs from "fs";
|
|
|
3
3
|
import { BaseOvniFranceRR0Mapping, CaseSummaryRenderer, ChronologyReplacerFactory, CsvMapper, EventReplacer, EventReplacerFactory, FuforaRR0Mapping, HttpSource, NuforcRR0Mapping, RR0Mapping, SceauRR0Mapping, SsiTitleReplaceCommand, TimeElementFactory, TimeLinkDefaultHandler, TimeReplacer, TimeReplacerFactory, TimeService, TimeTextBuilder, TimeUrlBuilder, UrecatRR0Mapping } from "./time";
|
|
4
4
|
import { CaseDirectoryStep, CaseFactory, CaseService } from "./science/index.js";
|
|
5
5
|
import { PlaceReplacerFactory } from "./place/index.js";
|
|
6
|
-
import { cities, CityService, countries, departments, DepartmentService,
|
|
6
|
+
import { cities, CityService, countries, departments, DepartmentService, CmsOrganizationFactory, OrganizationService, regions, RegionService } from "./org/index.js";
|
|
7
7
|
import { RR0ContextImpl } from "./RR0Context.js";
|
|
8
8
|
import { HtmlTable } from "./util/index.js";
|
|
9
9
|
import { AngularExpressionReplaceCommand, ClassDomReplaceCommand, CopyStep, DomReplaceCommand, HtAccessToNetlifyConfigReplaceCommand, HtmlFileContents, Ssg, SsiEchoVarReplaceCommand, SsiIfReplaceCommand, SsiIncludeReplaceCommand, SsiLastModifiedReplaceCommand, SsiSetVarReplaceCommand, StringEchoVarReplaceCommand } from "ssg-api";
|
|
@@ -60,7 +60,7 @@ export class RR0Build {
|
|
|
60
60
|
context.setVar("mail", options.mail);
|
|
61
61
|
const eventFactory = new RR0EventFactory();
|
|
62
62
|
this.placeService = new GooglePlaceService("place", options.googleMapsApiKey);
|
|
63
|
-
const orgFactory = new
|
|
63
|
+
const orgFactory = new CmsOrganizationFactory(eventFactory);
|
|
64
64
|
this.orgService = new OrganizationService([], "org", orgFactory, undefined);
|
|
65
65
|
const countryService = this.countryService = new CountryService(countries, "org", orgFactory, undefined);
|
|
66
66
|
const regionService = new RegionService(regions, "org", orgFactory, countryService);
|
package/dist/RR0Build.test.js
CHANGED
|
@@ -6,6 +6,7 @@ import * as process from "node:process";
|
|
|
6
6
|
describe("Build", () => {
|
|
7
7
|
console.time("ssg");
|
|
8
8
|
const args = {
|
|
9
|
+
contents: ["test/org/us/faa/index.html"],
|
|
9
10
|
force: "true"
|
|
10
11
|
};
|
|
11
12
|
const cliContents = args.contents;
|
|
@@ -89,10 +90,7 @@ describe("Build", () => {
|
|
|
89
90
|
const sourceRegistryFileName = testFilePath("source/index.json");
|
|
90
91
|
const siteBaseUrl = "https://rr0.org/";
|
|
91
92
|
const mail = "rr0@rr0.org";
|
|
92
|
-
const timeOptions = {
|
|
93
|
-
root: testFilePath("time"),
|
|
94
|
-
files: timeFiles
|
|
95
|
-
};
|
|
93
|
+
const timeOptions = { root: testFilePath("time"), files: timeFiles };
|
|
96
94
|
const build = new RR0Build({
|
|
97
95
|
contentRoots, copies, outDir, locale: "fr", googleMapsApiKey, mail, timeOptions,
|
|
98
96
|
siteBaseUrl, timeFormat, directoryPages,
|
|
@@ -5,11 +5,8 @@ import { Organization } from "@rr0/data";
|
|
|
5
5
|
import { OrganizationKind } from "@rr0/data";
|
|
6
6
|
import { Place } from "@rr0/place";
|
|
7
7
|
export declare class CmsOrganization<M extends TitleMessage = OrganizationMessages> extends Organization {
|
|
8
|
-
readonly id: string;
|
|
9
|
-
readonly places: Place[];
|
|
10
|
-
readonly kind: OrganizationKind;
|
|
11
|
-
readonly parent?: CmsOrganization;
|
|
12
8
|
constructor(id: string, places: Place[], kind: OrganizationKind, parent?: CmsOrganization);
|
|
9
|
+
get parent(): CmsOrganization | undefined;
|
|
13
10
|
getMessages(context: RR0Context): M;
|
|
14
11
|
getTitle(context: RR0Context, options?: OrganizationMessageOptions): string;
|
|
15
12
|
}
|
|
@@ -3,10 +3,9 @@ import { Organization } from "@rr0/data";
|
|
|
3
3
|
export class CmsOrganization extends Organization {
|
|
4
4
|
constructor(id, places, kind, parent) {
|
|
5
5
|
super(id, places, kind, parent);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.parent = parent;
|
|
6
|
+
}
|
|
7
|
+
get parent() {
|
|
8
|
+
return super.parent;
|
|
10
9
|
}
|
|
11
10
|
getMessages(context) {
|
|
12
11
|
const parent = this.parent;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CmsOrganization } from "./CmsOrganization.js";
|
|
2
|
+
import { OrganizationFactory, RR0EventFactory } from "@rr0/data";
|
|
3
|
+
import { OrganizationJson } from "@rr0/data/dist/org/OrganizationJson";
|
|
4
|
+
export declare class CmsOrganizationFactory extends OrganizationFactory {
|
|
5
|
+
constructor(eventFactory: RR0EventFactory);
|
|
6
|
+
parse(dataJson: OrganizationJson): CmsOrganization;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CmsOrganization } from "./CmsOrganization.js";
|
|
2
|
+
import { OrganizationFactory } from "@rr0/data";
|
|
3
|
+
export class CmsOrganizationFactory extends OrganizationFactory {
|
|
4
|
+
constructor(eventFactory) {
|
|
5
|
+
super(eventFactory);
|
|
6
|
+
}
|
|
7
|
+
parse(dataJson) {
|
|
8
|
+
const base = super.parse(dataJson);
|
|
9
|
+
const org = new CmsOrganization(base.id, base.places, base.kind);
|
|
10
|
+
org.title = base.title;
|
|
11
|
+
return org;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CmsOrganization } from "./CmsOrganization.js";
|
|
2
2
|
import { RR0Context } from "../RR0Context.js";
|
|
3
|
-
import {
|
|
3
|
+
import { CmsOrganizationFactory } from "./CmsOrganizationFactory";
|
|
4
4
|
export declare class OrganizationService<O extends CmsOrganization = CmsOrganization, P extends CmsOrganization = undefined> {
|
|
5
5
|
readonly orgs: O[];
|
|
6
6
|
readonly rootDir: string;
|
|
7
|
-
protected factory:
|
|
7
|
+
protected factory: CmsOrganizationFactory;
|
|
8
8
|
readonly parentService: OrganizationService;
|
|
9
|
-
constructor(orgs: O[], rootDir: string, factory:
|
|
9
|
+
constructor(orgs: O[], rootDir: string, factory: CmsOrganizationFactory, parentService: OrganizationService);
|
|
10
10
|
static normalizeName(name: string): string;
|
|
11
11
|
get(code: string, parent?: P): O | undefined;
|
|
12
12
|
/**
|
package/dist/org/br/Brazil.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { CountryCode } from "@rr0/data";
|
|
1
|
+
import { CountryCode, OrganizationKind } from "@rr0/data";
|
|
2
2
|
import { CmsOrganization } from "../CmsOrganization.js";
|
|
3
|
-
import { OrganizationKind } from "@rr0/data";
|
|
4
3
|
export const brazil = new CmsOrganization(CountryCode.br, [], OrganizationKind.country);
|
|
5
4
|
export function brazilRegion(code, place) {
|
|
6
5
|
return new CmsOrganization(code, [place], OrganizationKind.region, brazil);
|
package/dist/org/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from "./CountryMessagesList.js";
|
|
|
3
3
|
export * from "./CountryMessageList_en.js";
|
|
4
4
|
export * from "./CountryMessageList_fr.js";
|
|
5
5
|
export * from "./CmsOrganization.js";
|
|
6
|
-
export * from "./
|
|
6
|
+
export * from "./CmsOrganizationFactory.js";
|
|
7
7
|
export * from "./OrganizationMessages.js";
|
|
8
8
|
export * from "./OrganizationService.js";
|
|
9
9
|
export * from "./OrgMessages.js";
|
package/dist/org/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export * from "./CountryMessagesList.js";
|
|
|
3
3
|
export * from "./CountryMessageList_en.js";
|
|
4
4
|
export * from "./CountryMessageList_fr.js";
|
|
5
5
|
export * from "./CmsOrganization.js";
|
|
6
|
-
export * from "./
|
|
6
|
+
export * from "./CmsOrganizationFactory.js";
|
|
7
7
|
export * from "./OrganizationMessages.js";
|
|
8
8
|
export * from "./OrganizationService.js";
|
|
9
9
|
export * from "./OrgMessages.js";
|
|
@@ -37,6 +37,8 @@ class MockOrganizationService extends OrganizationService {
|
|
|
37
37
|
getTitle(_context) {
|
|
38
38
|
return title;
|
|
39
39
|
},
|
|
40
|
+
parent: undefined,
|
|
41
|
+
title,
|
|
40
42
|
places: [new Place([new PlaceLocation(35.87555555555556, -106.32416666666666)])],
|
|
41
43
|
getMessages: (_context) => new OrganizationMessages([title]),
|
|
42
44
|
events: []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HtmlRR0Context, RR0Context } from "../RR0Context.js";
|
|
2
2
|
import { FileWriteConfig } from "ssg-api";
|
|
3
|
-
import { CityService, DepartmentService,
|
|
3
|
+
import { CityService, DepartmentService, CmsOrganizationFactory, OrganizationService, RegionService } from "../org/index.js";
|
|
4
4
|
import { CaseFactory } from "../science/index.js";
|
|
5
5
|
import { TimeTestUtil } from "../time/TimeTestUtil";
|
|
6
6
|
import { AllDataService, PeopleFactory } from "@rr0/data";
|
|
@@ -16,7 +16,7 @@ export declare class RR0TestUtil {
|
|
|
16
16
|
readonly time: TimeTestUtil;
|
|
17
17
|
readonly orgService: OrganizationService<any, undefined>;
|
|
18
18
|
readonly cityService: CityService;
|
|
19
|
-
readonly orgFactory:
|
|
19
|
+
readonly orgFactory: CmsOrganizationFactory;
|
|
20
20
|
readonly departmentService: DepartmentService;
|
|
21
21
|
readonly countryService: CountryService;
|
|
22
22
|
readonly regionService: RegionService;
|
package/dist/test/RR0TestUtil.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { RR0ContextImpl } from "../RR0Context.js";
|
|
3
3
|
import { HtmlFileContents } from "ssg-api";
|
|
4
|
-
import { cities, CityService, countries, departments, DepartmentService,
|
|
4
|
+
import { cities, CityService, countries, departments, DepartmentService, CmsOrganizationFactory, OrganizationService, regions, RegionService } from "../org/index.js";
|
|
5
5
|
import { CaseFactory } from "../science/index.js";
|
|
6
6
|
import { APIFactory } from "../tech/index.js";
|
|
7
7
|
import { TimeTestUtil } from "../time/TimeTestUtil";
|
|
@@ -29,7 +29,7 @@ export class RR0TestUtil {
|
|
|
29
29
|
};
|
|
30
30
|
const eventFactory = new RR0EventFactory();
|
|
31
31
|
const sightingFactory = new EventDataFactory(eventFactory, "sighting", ["index"]);
|
|
32
|
-
const orgFactory = this.orgFactory = new
|
|
32
|
+
const orgFactory = this.orgFactory = new CmsOrganizationFactory(eventFactory);
|
|
33
33
|
this.orgService = new OrganizationService([], "org", orgFactory, undefined);
|
|
34
34
|
this.caseFactory = new CaseFactory(eventFactory);
|
|
35
35
|
this.peopleFactory = new PeopleFactory(eventFactory);
|
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.2",
|
|
6
6
|
"description": "RR0 Content Management System (CMS)",
|
|
7
7
|
"exports": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
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.4",
|
|
34
34
|
"@rr0/lang": "^0.1.12",
|
|
35
35
|
"@rr0/place": "^0.5.1",
|
|
36
36
|
"@rr0/time": "^0.9.2",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CmsOrganization } from "./CmsOrganization.js";
|
|
2
|
-
import { RR0EventFactory, TypedDataFactory } from "@rr0/data";
|
|
3
|
-
import { OrganizationJson } from "./OrganizationJson";
|
|
4
|
-
export declare class OrganizationFactory extends TypedDataFactory<CmsOrganization, OrganizationJson> {
|
|
5
|
-
constructor(eventFactory: RR0EventFactory);
|
|
6
|
-
parse(dataJson: OrganizationJson): CmsOrganization;
|
|
7
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CmsOrganization } from "./CmsOrganization.js";
|
|
2
|
-
import { TypedDataFactory } from "@rr0/data";
|
|
3
|
-
export class OrganizationFactory extends TypedDataFactory {
|
|
4
|
-
constructor(eventFactory) {
|
|
5
|
-
super(eventFactory, "org", ["index"]);
|
|
6
|
-
}
|
|
7
|
-
parse(dataJson) {
|
|
8
|
-
const base = super.parse(dataJson);
|
|
9
|
-
const id = base.id || dataJson.dirName.replaceAll("/", "-");
|
|
10
|
-
return new CmsOrganization(id, dataJson.places, dataJson.kind);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { OrganizationMessages } from "./OrganizationMessages.js";
|
|
2
|
-
import { TitleMessage } from "./TitleMessage.js";
|
|
3
|
-
import { RR0DataJson, RR0EventJson } from "@rr0/data";
|
|
4
|
-
import { OrganizationKind } from "@rr0/data";
|
|
5
|
-
import { Place } from "@rr0/place";
|
|
6
|
-
export declare class OrganizationJson<M extends TitleMessage = OrganizationMessages> implements RR0DataJson {
|
|
7
|
-
readonly type = "org";
|
|
8
|
-
dirName: string;
|
|
9
|
-
events: RR0EventJson[];
|
|
10
|
-
readonly id: string;
|
|
11
|
-
places: Place[];
|
|
12
|
-
kind: OrganizationKind;
|
|
13
|
-
/**
|
|
14
|
-
* id of parent organization
|
|
15
|
-
*/
|
|
16
|
-
parent?: string;
|
|
17
|
-
}
|