@rr0/cms 0.3.2 → 0.3.3

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.
Files changed (44) hide show
  1. package/dist/BuildContext.d.ts +7 -0
  2. package/dist/RR0Build.d.ts +22 -14
  3. package/dist/RR0Build.js +9 -21
  4. package/dist/RR0Build.test.js +20 -2
  5. package/dist/index.d.ts +1 -0
  6. package/dist/org/CmsOrganization.d.ts +1 -2
  7. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanDatasource.test.js +1 -1
  8. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanRR0Mapping.d.ts +6 -5
  9. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanRR0Mapping.js +5 -2
  10. package/dist/people/PeopleDirectoryStep.js +1 -1
  11. package/dist/people/PeopleDirectoryStepFactory.d.ts +4 -1
  12. package/dist/people/PeopleDirectoryStepFactory.js +4 -1
  13. package/dist/test/RR0TestUtil.d.ts +3 -2
  14. package/dist/test/RR0TestUtil.js +1 -1
  15. package/dist/time/datasource/ChronologyReplacer.test.js +1 -1
  16. package/dist/time/datasource/JsonMapper.test.js +1 -1
  17. package/dist/time/datasource/baseovnifrance/BaseOvniFranceDatasource.test.js +1 -1
  18. package/dist/time/datasource/baseovnifrance/BaseOvniFranceRR0Mapping.d.ts +5 -4
  19. package/dist/time/datasource/baseovnifrance/BaseOvniFranceRR0Mapping.js +5 -2
  20. package/dist/time/datasource/fufora/FuforaDatasource.test.js +1 -1
  21. package/dist/time/datasource/fufora/FuforaRR0Mapping.d.ts +3 -2
  22. package/dist/time/datasource/fufora/FuforaRR0Mapping.js +5 -2
  23. package/dist/time/datasource/nuforc/NuforcDatasource.test.js +1 -1
  24. package/dist/time/datasource/nuforc/NuforcRR0Mapping.d.ts +3 -3
  25. package/dist/time/datasource/nuforc/NuforcRR0Mapping.js +5 -2
  26. package/dist/time/datasource/rr0/RR0CaseMapping.d.ts +2 -0
  27. package/dist/time/datasource/rr0/RR0Datasource.test.d.ts +5 -3
  28. package/dist/time/datasource/rr0/RR0Datasource.test.js +3 -0
  29. package/dist/time/datasource/rr0/RR0HttpDatasource.js +2 -1
  30. package/dist/time/datasource/rr0/RR0Mapping.d.ts +6 -5
  31. package/dist/time/datasource/rr0/RR0Mapping.js +5 -2
  32. package/dist/time/datasource/sceau/SceauDatasource.test.d.ts +4 -2
  33. package/dist/time/datasource/sceau/SceauDatasource.test.js +3 -0
  34. package/dist/time/datasource/sceau/SceauRR0Mapping.d.ts +3 -2
  35. package/dist/time/datasource/sceau/SceauRR0Mapping.js +5 -2
  36. package/dist/time/datasource/ufo-search/UfoSearchDatasource.test.js +1 -1
  37. package/dist/time/datasource/ufo-search/UfoSearchMapping.d.ts +3 -2
  38. package/dist/time/datasource/ufo-search/UfoSearchMapping.js +5 -2
  39. package/dist/time/datasource/urecat/UrecatDatasource.test.js +2 -1
  40. package/dist/time/datasource/urecat/UrecatRR0Mapping.d.ts +3 -3
  41. package/dist/time/datasource/urecat/UrecatRR0Mapping.js +5 -2
  42. package/package.json +3 -3
  43. package/dist/people/PeopleFactory.test.js +0 -25
  44. /package/dist/{people/PeopleFactory.test.d.ts → BuildContext.js} +0 -0
@@ -0,0 +1,7 @@
1
+ import { CityService, DepartmentService } from "./org";
2
+ import { CountryService } from "./org/country/CountryService";
3
+ export interface BuildContext {
4
+ cityService: CityService;
5
+ departmentService: DepartmentService;
6
+ countryService: CountryService;
7
+ }
@@ -1,6 +1,13 @@
1
- import { TimeServiceOptions } from "./time";
1
+ import { RR0CaseMapping, TimeService, TimeServiceOptions, TimeTextBuilder } from "./time";
2
+ import { CaseFactory } from "./science/index.js";
3
+ import { CityService, DepartmentService, OrganizationService } from "./org/index.js";
4
+ import { RR0ContextImpl } from "./RR0Context.js";
2
5
  import { FileWriteConfig } from "ssg-api";
3
6
  import { PeopleDirectoryStepOptions } from "./people";
7
+ import { AllDataService, PeopleFactory } from "@rr0/data";
8
+ import { GooglePlaceService } from "@rr0/place";
9
+ import { CountryService } from "./org/country/CountryService";
10
+ import { BuildContext } from "./BuildContext";
4
11
  export interface RR0BuildOptions {
5
12
  contentRoots: string[];
6
13
  copies: string[];
@@ -17,6 +24,7 @@ export interface RR0BuildOptions {
17
24
  sourceRegistryFileName: string;
18
25
  directoryExcluded: string[];
19
26
  directoryOptions: PeopleDirectoryStepOptions;
27
+ mappings: RR0CaseMapping<any>[];
20
28
  }
21
29
  export interface RR0BuildArgs {
22
30
  /**
@@ -45,20 +53,20 @@ export interface RR0BuildArgs {
45
53
  */
46
54
  force?: string;
47
55
  }
48
- export declare class RR0Build {
56
+ export declare class RR0Build implements BuildContext {
49
57
  protected options: RR0BuildOptions;
50
- config: FileWriteConfig;
51
- private context;
52
- private placeService;
53
- private orgService;
54
- private timeService;
55
- private caseFactory;
56
- private dataService;
57
- private peopleFactory;
58
- private timeTextBuilder;
59
- private cityService;
60
- private departmentService;
61
- private countryService;
58
+ readonly config: FileWriteConfig;
59
+ readonly context: RR0ContextImpl;
60
+ readonly placeService: GooglePlaceService;
61
+ readonly orgService: OrganizationService<any>;
62
+ readonly timeService: TimeService;
63
+ readonly caseFactory: CaseFactory;
64
+ readonly dataService: AllDataService;
65
+ readonly peopleFactory: PeopleFactory;
66
+ readonly timeTextBuilder: TimeTextBuilder;
67
+ readonly cityService: CityService;
68
+ readonly departmentService: DepartmentService;
69
+ readonly countryService: CountryService;
62
70
  constructor(options: RR0BuildOptions);
63
71
  run(args: RR0BuildArgs): Promise<void>;
64
72
  }
package/dist/RR0Build.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
- import { BaseOvniFranceRR0Mapping, CaseSummaryRenderer, ChronologyReplacerFactory, CsvMapper, EventReplacer, EventReplacerFactory, FuforaRR0Mapping, HttpSource, NuforcRR0Mapping, RR0Mapping, SceauRR0Mapping, SsiTitleReplaceCommand, TimeElementFactory, TimeLinkDefaultHandler, TimeReplacer, TimeReplacerFactory, TimeService, TimeTextBuilder, TimeUrlBuilder, UrecatRR0Mapping } from "./time";
3
+ import { CaseSummaryRenderer, ChronologyReplacerFactory, CsvMapper, EventReplacer, EventReplacerFactory, HttpSource, RR0Mapping, SsiTitleReplaceCommand, TimeElementFactory, TimeLinkDefaultHandler, TimeReplacer, TimeReplacerFactory, TimeService, TimeTextBuilder, TimeUrlBuilder } 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, CmsOrganizationFactory, OrganizationService, regions, RegionService } from "./org/index.js";
6
+ import { cities, CityService, CmsOrganizationFactory, countries, departments, DepartmentService, 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";
@@ -30,7 +30,6 @@ import { TimeContext } from "@rr0/time";
30
30
  import { writeFile } from "@javarome/fileutil";
31
31
  import { AllDataService, EventDataFactory, PeopleFactory, PeopleService, RR0EventFactory, TypedDataFactory } from "@rr0/data";
32
32
  import { GooglePlaceService } from "@rr0/place";
33
- import { GeipanRR0Mapping } from "./org/eu/fr/cnes/geipan/geipan/GeipanRR0Mapping";
34
33
  import { PeopleHtmlRenderer } from "./people/PeopleHtmlRenderer";
35
34
  import { CountryService } from "./org/country/CountryService";
36
35
  const outputFunc = async (context, outFile) => {
@@ -59,13 +58,14 @@ export class RR0Build {
59
58
  context.setVar("mapsApiKey", options.googleMapsApiKey);
60
59
  context.setVar("mail", options.mail);
61
60
  const eventFactory = new RR0EventFactory();
62
- this.placeService = new GooglePlaceService("place", options.googleMapsApiKey);
63
61
  const orgFactory = new CmsOrganizationFactory(eventFactory);
64
- this.orgService = new OrganizationService([], "org", orgFactory, undefined);
65
62
  const countryService = this.countryService = new CountryService(countries, "org", orgFactory, undefined);
66
63
  const regionService = new RegionService(regions, "org", orgFactory, countryService);
67
64
  const departmentService = this.departmentService = new DepartmentService(departments, "org", orgFactory, regionService);
68
- this.cityService = new CityService(cities, "org", orgFactory, departmentService);
65
+ const cityService = new CityService(cities, "org", orgFactory, departmentService);
66
+ this.placeService = new GooglePlaceService("place", options.googleMapsApiKey);
67
+ this.orgService = new OrganizationService([], "org", orgFactory, undefined);
68
+ this.cityService = cityService;
69
69
  const timeTextBuilder = this.timeTextBuilder = new TimeTextBuilder(options.timeFormat);
70
70
  const timeOptions = options.timeOptions;
71
71
  const timeRoot = timeOptions.root;
@@ -131,21 +131,9 @@ export class RR0Build {
131
131
  const noteCounter = new NoteFileCounter();
132
132
  const noteRenderer = new NoteRenderer(noteCounter);
133
133
  const caseRenderer = new CaseSummaryRenderer(noteRenderer, sourceFactory, sourceRenderer, timeElementFactory);
134
- // const actions: ChronologyReplacerActions = {read: ["backup", "fetch"], write: ["backup", "pages"]}
135
- // const actions: ChronologyReplacerActions = {read: [], write: ["backup"]}
136
- const actions = { read: ["fetch"], write: ["backup"] };
137
- const rr0Mapping = new RR0Mapping(this.cityService, actions);
138
- const geipanRR0Mapping = new GeipanRR0Mapping(this.cityService, actions);
139
- const baseOvniFranceRR0Mapping = new BaseOvniFranceRR0Mapping(this.cityService, this.departmentService, actions);
140
- const fuforaRR0Mapping = new FuforaRR0Mapping(this.cityService, actions);
141
- const nuforcRR0Mapping = new NuforcRR0Mapping(this.cityService, this.countryService, actions);
142
- const urecatRR0Mapping = new UrecatRR0Mapping(this.cityService, this.countryService, actions);
143
- const sceauRR0Mapping = new SceauRR0Mapping(this.cityService, actions);
144
- const databaseAggregationCommand = new DomReplaceCommand(".contents ul", new ChronologyReplacerFactory(timeService, [rr0Mapping,
145
- geipanRR0Mapping,
146
- baseOvniFranceRR0Mapping, fuforaRR0Mapping, nuforcRR0Mapping, urecatRR0Mapping,
147
- sceauRR0Mapping
148
- ], caseRenderer));
134
+ const mappings = this.options.mappings || [new RR0Mapping({ read: ["fetch"], write: ["backup"] })];
135
+ mappings.forEach(mapping => mapping.init(this));
136
+ const databaseAggregationCommand = new DomReplaceCommand(".contents ul", new ChronologyReplacerFactory(timeService, mappings, caseRenderer));
149
137
  const timeDefaultHandler = (context) => {
150
138
  let title;
151
139
  title = timeService.titleFromFile(context, context.file.name, timeTextBuilder);
@@ -1,12 +1,14 @@
1
1
  import { glob } from "glob";
2
2
  import { describe } from "@javarome/testscript";
3
3
  import { RR0Build } from "./RR0Build.js";
4
+ import { BaseOvniFranceRR0Mapping, FuforaRR0Mapping, NuforcRR0Mapping, RR0Mapping, SceauRR0Mapping, UrecatRR0Mapping } from "./time/index.js";
4
5
  import { testFilePath } from "./test";
5
6
  import * as process from "node:process";
7
+ import { GeipanRR0Mapping } from "./org/eu/fr/cnes/geipan/geipan/GeipanRR0Mapping";
6
8
  describe("Build", () => {
7
9
  console.time("ssg");
8
10
  const args = {
9
- contents: ["test/org/us/faa/index.html"],
11
+ contents: ["test/**/*.html"],
10
12
  force: "true"
11
13
  };
12
14
  const cliContents = args.contents;
@@ -91,6 +93,21 @@ describe("Build", () => {
91
93
  const siteBaseUrl = "https://rr0.org/";
92
94
  const mail = "rr0@rr0.org";
93
95
  const timeOptions = { root: testFilePath("time"), files: timeFiles };
96
+ // const actions: ChronologyReplacerActions = {read: ["backup", "fetch"], write: ["backup", "pages"]}
97
+ // const actions: ChronologyReplacerActions = {read: [], write: ["backup"]}
98
+ const actions = { read: ["fetch"], write: ["backup"] };
99
+ const rr0Mapping = new RR0Mapping(actions);
100
+ const geipanRR0Mapping = new GeipanRR0Mapping(actions);
101
+ const baseOvniFranceRR0Mapping = new BaseOvniFranceRR0Mapping(actions);
102
+ const fuforaRR0Mapping = new FuforaRR0Mapping(actions);
103
+ const nuforcRR0Mapping = new NuforcRR0Mapping(actions);
104
+ const urecatRR0Mapping = new UrecatRR0Mapping(actions);
105
+ const sceauRR0Mapping = new SceauRR0Mapping(actions);
106
+ const mappings = [rr0Mapping,
107
+ /* geipanRR0Mapping,
108
+ baseOvniFranceRR0Mapping, fuforaRR0Mapping, nuforcRR0Mapping, urecatRR0Mapping,
109
+ sceauRR0Mapping*/
110
+ ];
94
111
  const build = new RR0Build({
95
112
  contentRoots, copies, outDir, locale: "fr", googleMapsApiKey, mail, timeOptions,
96
113
  siteBaseUrl, timeFormat, directoryPages,
@@ -98,7 +115,8 @@ describe("Build", () => {
98
115
  ufoCasesExclusions: ["science/crypto/ufo/enquete/dossier/canular"].map(testFilePath),
99
116
  sourceRegistryFileName,
100
117
  directoryExcluded: ["people/Astronomers_fichiers", "people/witness", "people/author"].map(testFilePath),
101
- directoryOptions
118
+ directoryOptions,
119
+ mappings
102
120
  });
103
121
  await build.run(args);
104
122
  });
package/dist/index.d.ts CHANGED
@@ -29,3 +29,4 @@ export * from "./RR0DefaultCopyright.js";
29
29
  export * from "./RR0Context.js";
30
30
  export * from "./TableReplaceCommand.js";
31
31
  export * from "./RR0Build.js";
32
+ export { BuildContext } from "./BuildContext";
@@ -1,8 +1,7 @@
1
1
  import { RR0Context } from "../RR0Context.js";
2
2
  import { OrganizationMessageOptions, OrganizationMessages } from "./OrganizationMessages.js";
3
3
  import { TitleMessage } from "./TitleMessage.js";
4
- import { Organization } from "@rr0/data";
5
- import { OrganizationKind } from "@rr0/data";
4
+ import { Organization, OrganizationKind } from "@rr0/data";
6
5
  import { Place } from "@rr0/place";
7
6
  export declare class CmsOrganization<M extends TitleMessage = OrganizationMessages> extends Organization {
8
7
  constructor(id: string, places: Place[], kind: OrganizationKind, parent?: CmsOrganization);
@@ -5,7 +5,7 @@ import { DatasourceTestCase } from "../../../../../../time/datasource/Datasource
5
5
  import { rr0TestUtil } from "../../../../../../test/index.js";
6
6
  describe("GeipanCaseSource", () => {
7
7
  const actions = { read: ["backup", "fetch"], write: ["backup", "pages"] };
8
- const geipanRR0Mapping = new GeipanRR0Mapping(rr0TestUtil.cityService, actions);
8
+ const geipanRR0Mapping = new GeipanRR0Mapping(actions).init(rr0TestUtil);
9
9
  const testCase = new class extends DatasourceTestCase {
10
10
  constructor(mapping, sourceCases) {
11
11
  super(mapping, sourceCases);
@@ -3,13 +3,14 @@ import { GeipanCaseSummaryRR0Mapper } from "./GeipanCaseSummaryRR0Mapper.js";
3
3
  import { GeipanFileDatasource } from "./GeipanFileDatasource.js";
4
4
  import { GeipanCaseSummary } from "./GeipanCaseSummary.js";
5
5
  import { ChronologyReplacerActions, RR0CaseMapping } from "../../../../../../time/index.js";
6
- import { CityService } from "../../../../../country";
6
+ import { BuildContext } from "../../../../../../BuildContext";
7
7
  export declare const geipanHttpDatasource: GeipanHttpDatasource;
8
8
  export declare const geipanFileDatasource: GeipanFileDatasource;
9
9
  export declare class GeipanRR0Mapping implements RR0CaseMapping<GeipanCaseSummary> {
10
10
  readonly actions: ChronologyReplacerActions;
11
- readonly datasource: GeipanHttpDatasource;
12
- readonly backupDatasource: GeipanFileDatasource;
13
- readonly mapper: GeipanCaseSummaryRR0Mapper;
14
- constructor(cityService: CityService, actions: ChronologyReplacerActions);
11
+ datasource: GeipanHttpDatasource;
12
+ backupDatasource: GeipanFileDatasource;
13
+ mapper: GeipanCaseSummaryRR0Mapper;
14
+ constructor(actions: ChronologyReplacerActions);
15
+ init(build: BuildContext): this;
15
16
  }
@@ -4,10 +4,13 @@ import { GeipanFileDatasource } from "./GeipanFileDatasource.js";
4
4
  export const geipanHttpDatasource = new GeipanHttpDatasource(new URL("https://geipan.fr"), "fr/recherche/cas");
5
5
  export const geipanFileDatasource = new GeipanFileDatasource("org/eu/fr/cnes/geipan/export_cas_pub_20210219111412.csv", "latin1");
6
6
  export class GeipanRR0Mapping {
7
- constructor(cityService, actions) {
7
+ constructor(actions) {
8
8
  this.actions = actions;
9
9
  this.datasource = geipanHttpDatasource;
10
10
  this.backupDatasource = geipanFileDatasource;
11
- this.mapper = new GeipanCaseSummaryRR0Mapper(cityService, geipanHttpDatasource.baseUrl, geipanHttpDatasource.copyright, geipanHttpDatasource.authors);
11
+ }
12
+ init(build) {
13
+ this.mapper = new GeipanCaseSummaryRR0Mapper(build.cityService, geipanHttpDatasource.baseUrl, geipanHttpDatasource.copyright, geipanHttpDatasource.authors);
14
+ return this;
12
15
  }
13
16
  }
@@ -26,7 +26,7 @@ export class PeopleDirectoryStep extends DirectoryStep {
26
26
  var _a;
27
27
  if (((_a = peopleInfo.pseudonyms) === null || _a === void 0 ? void 0 : _a.length) > 0) {
28
28
  for (const pseudonym of peopleInfo.pseudonyms) {
29
- const pseudo = new People(peopleInfo.firstNames, peopleInfo.lastName, peopleInfo.pseudonyms, peopleInfo.occupations, peopleInfo.countries, peopleInfo.discredited, peopleInfo.birthTime, peopleInfo.deathTime, peopleInfo.gender, peopleInfo.id, peopleInfo.dirName, peopleInfo.image);
29
+ const pseudo = new People(peopleInfo.firstNames, peopleInfo.lastName, peopleInfo.pseudonyms, peopleInfo.occupations, peopleInfo.countries, peopleInfo.discredited, peopleInfo.gender, peopleInfo.id, peopleInfo.dirName, peopleInfo.image);
30
30
  pseudo.lastAndFirstName = pseudonym;
31
31
  prevPeopleList.push(pseudo);
32
32
  }
@@ -16,7 +16,7 @@ export type PeopleDirectoryStepOptions = {
16
16
  rulers?: string;
17
17
  };
18
18
  /**
19
- * Scan directories for people information, then populates a template with collected data.
19
+ * Create directory steps for different types of people.
20
20
  */
21
21
  export declare class PeopleDirectoryStepFactory {
22
22
  protected outputFunc: OutputFunc;
@@ -26,6 +26,9 @@ export declare class PeopleDirectoryStepFactory {
26
26
  protected excludedDirs: string[];
27
27
  constructor(outputFunc: OutputFunc, config: FileWriteConfig, service: PeopleService, renderer: PeopleHtmlRenderer, excludedDirs: string[]);
28
28
  create(options: PeopleDirectoryStepOptions): Promise<PeopleDirectoryStep[]>;
29
+ /**
30
+ * Create steps to generate directory pages for people with name starting with every first letter.
31
+ */
29
32
  createLetters(): Promise<PeopleDirectoryStep[]>;
30
33
  createAll(dirs: string[], templateFileName: string): PeopleDirectoryStep;
31
34
  createMilitary(dirs: string[], templateFileName: string): PeopleDirectoryStep;
@@ -4,7 +4,7 @@ import { glob } from "glob";
4
4
  import path from "path";
5
5
  import { Occupation } from "@rr0/data";
6
6
  /**
7
- * Scan directories for people information, then populates a template with collected data.
7
+ * Create directory steps for different types of people.
8
8
  */
9
9
  export class PeopleDirectoryStepFactory {
10
10
  constructor(outputFunc, config, service, renderer, excludedDirs) {
@@ -60,6 +60,9 @@ export class PeopleDirectoryStepFactory {
60
60
  }
61
61
  return steps;
62
62
  }
63
+ /**
64
+ * Create steps to generate directory pages for people with name starting with every first letter.
65
+ */
63
66
  async createLetters() {
64
67
  const letterDirs = await glob("people/*/");
65
68
  const peopleLetterFiles = letterDirs.filter(l => /(.+)\/[a-z]$/.test(l));
@@ -1,11 +1,12 @@
1
1
  import { HtmlRR0Context, RR0Context } from "../RR0Context.js";
2
2
  import { FileWriteConfig } from "ssg-api";
3
- import { CityService, DepartmentService, CmsOrganizationFactory, OrganizationService, RegionService } from "../org/index.js";
3
+ import { CityService, CmsOrganizationFactory, DepartmentService, 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";
7
7
  import { CountryService } from "../org/country/CountryService";
8
- export declare class RR0TestUtil {
8
+ import { BuildContext } from "../BuildContext";
9
+ export declare class RR0TestUtil implements BuildContext {
9
10
  readonly rootDir: string;
10
11
  readonly outDir: string;
11
12
  readonly config: FileWriteConfig;
@@ -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, CmsOrganizationFactory, OrganizationService, regions, RegionService } from "../org/index.js";
4
+ import { cities, CityService, CmsOrganizationFactory, countries, departments, DepartmentService, 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";
@@ -19,7 +19,7 @@ describe("ChronologyReplacer", () => {
19
19
  const sourceFactory = new SourceFactory(dataService, http, baseUrl, rr0TestUtil.intlOptions, timeTestUtil.getService());
20
20
  const timeTextBuilder = new TimeTextBuilder(rr0TestUtil.intlOptions);
21
21
  const caseRenderer = new CaseSummaryRenderer(new NoteRenderer(new NoteFileCounter()), sourceFactory, new SourceRenderer(timeTextBuilder), timeTestUtil.timeElementFactory);
22
- const urecatRR0Mapping = new UrecatRR0Mapping(rr0TestUtil.cityService, rr0TestUtil.countryService, { read: ["fetch"], write: ["backup"] });
22
+ const urecatRR0Mapping = new UrecatRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(rr0TestUtil);
23
23
  chronologyReplacer = new ChronologyReplacer([urecatRR0Mapping], caseRenderer);
24
24
  context = timeTestUtil.newHtmlContext("index.html");
25
25
  context.time.setYear(undefined);
@@ -10,7 +10,7 @@ describe("JsonMapper", () => {
10
10
  context = rr0TestUtil.time.newHtmlContext("1/9/7/0/03/index.html", undefined, "en");
11
11
  });
12
12
  test("read", () => {
13
- const ufoSearchMapping = new UfoSearchRR0Mapping(rr0TestUtil.cityService, { read: ["fetch"], write: ["backup"] });
13
+ const ufoSearchMapping = new UfoSearchRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(rr0TestUtil);
14
14
  const ufoSearchFileDatasource = ufoSearchMapping.backupDatasource;
15
15
  const data = fs.readFileSync(path.join("src", ufoSearchFileDatasource.fileName), { encoding: "utf-8" });
16
16
  const cases = ufoSearchFileDatasource.fileMapper.parse(context, data);
@@ -4,7 +4,7 @@ import { baseOvniFranceTestCases } from "./BaseOvniFranceTestCases.js";
4
4
  import { DatasourceTestCase } from "../DatasourceTestCase.js";
5
5
  import { BaseOvniFranceRR0Mapping, baseOvniFranceSortComparator } from "./BaseOvniFranceRR0Mapping.js";
6
6
  describe("BaseOvniFranceCaseSource", () => {
7
- const baseOvniFranceRR0Mapping = new BaseOvniFranceRR0Mapping(rr0TestUtil.cityService, rr0TestUtil.departmentService, { read: ["fetch"], write: ["backup"] });
7
+ const baseOvniFranceRR0Mapping = new BaseOvniFranceRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(rr0TestUtil);
8
8
  const testCase = new class extends DatasourceTestCase {
9
9
  constructor(mapping, sourceCases) {
10
10
  super(mapping, sourceCases);
@@ -3,12 +3,13 @@ import { BaseOvniFranceCaseSummary } from "./BaseOvniFranceCaseSummary.js";
3
3
  import { BaseOvniFranceHttpDatasource } from "./BaseOvniFranceHttpDatasource.js";
4
4
  import { RR0CaseMapping } from "../rr0/index.js";
5
5
  import { ChronologyReplacerActions } from "../ChronologyReplacerActions.js";
6
- import { CityService, DepartmentService } from "../../../org";
6
+ import { BuildContext } from "../../../BuildContext";
7
7
  export declare const baseOvniFranceDatasource: BaseOvniFranceHttpDatasource;
8
8
  export declare class BaseOvniFranceRR0Mapping implements RR0CaseMapping<BaseOvniFranceCaseSummary> {
9
9
  readonly actions: ChronologyReplacerActions;
10
- readonly datasource: BaseOvniFranceHttpDatasource;
11
- readonly mapper: BaseOvniFranceCaseSummaryRR0Mapper;
12
- constructor(cityService: CityService, departmentService: DepartmentService, actions: ChronologyReplacerActions);
10
+ datasource: BaseOvniFranceHttpDatasource;
11
+ mapper: BaseOvniFranceCaseSummaryRR0Mapper;
12
+ constructor(actions: ChronologyReplacerActions);
13
+ init(build: BuildContext): this;
13
14
  }
14
15
  export declare const baseOvniFranceSortComparator: (c1: BaseOvniFranceCaseSummary, c2: BaseOvniFranceCaseSummary) => 0 | 1 | -1;
@@ -2,10 +2,13 @@ import { BaseOvniFranceCaseSummaryRR0Mapper } from "./BaseOvniFranceCaseSummaryR
2
2
  import { BaseOvniFranceHttpDatasource } from "./BaseOvniFranceHttpDatasource.js";
3
3
  export const baseOvniFranceDatasource = new BaseOvniFranceHttpDatasource();
4
4
  export class BaseOvniFranceRR0Mapping {
5
- constructor(cityService, departmentService, actions) {
5
+ constructor(actions) {
6
6
  this.actions = actions;
7
+ }
8
+ init(build) {
7
9
  const datasource = this.datasource = baseOvniFranceDatasource;
8
- this.mapper = new BaseOvniFranceCaseSummaryRR0Mapper(departmentService, cityService, datasource.baseUrl, datasource.copyright, datasource.authors);
10
+ this.mapper = new BaseOvniFranceCaseSummaryRR0Mapper(build.departmentService, build.cityService, datasource.baseUrl, datasource.copyright, datasource.authors);
11
+ return this;
9
12
  }
10
13
  }
11
14
  export const baseOvniFranceSortComparator = (c1, c2) => c1.id < c2.id ? -1 : c1.id > c2.id ? 1 : 0;
@@ -4,7 +4,7 @@ import { fuforaTestCases } from "./FuforaTestCases.js";
4
4
  import { DatasourceTestCase } from "../DatasourceTestCase.js";
5
5
  import { FuforaRR0Mapping } from "./FuforaRR0Mapping";
6
6
  describe("FuforaCaseSource", () => {
7
- const fuforaRR0Mapping = new FuforaRR0Mapping(rr0TestUtil.cityService, { read: ["fetch"], write: ["backup"] });
7
+ const fuforaRR0Mapping = new FuforaRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(rr0TestUtil);
8
8
  const testCase = new class extends DatasourceTestCase {
9
9
  constructor(mapping, sourceCases) {
10
10
  super(mapping, sourceCases);
@@ -2,12 +2,13 @@ import { FuforaHttpDatasource } from "./FuforaHttpDatasource.js";
2
2
  import { FuforaCaseSummaryRR0Mapper } from "./FuforaCaseSummaryRR0Mapper.js";
3
3
  import { RR0CaseMapping } from "../rr0/RR0CaseMapping.js";
4
4
  import { FuforaCaseSummary } from "./FuforaCaseSummary.js";
5
- import { CityService } from "../../../org";
6
5
  import { ChronologyReplacerActions } from "../ChronologyReplacerActions";
6
+ import { BuildContext } from "../../../BuildContext";
7
7
  export declare const fuforaDatasource: FuforaHttpDatasource;
8
8
  export declare class FuforaRR0Mapping implements RR0CaseMapping<FuforaCaseSummary> {
9
9
  readonly actions: ChronologyReplacerActions;
10
10
  mapper: FuforaCaseSummaryRR0Mapper;
11
11
  datasource: FuforaHttpDatasource;
12
- constructor(cityService: CityService, actions: ChronologyReplacerActions);
12
+ constructor(actions: ChronologyReplacerActions);
13
+ init(build: BuildContext): this;
13
14
  }
@@ -2,9 +2,12 @@ import { FuforaHttpDatasource } from "./FuforaHttpDatasource.js";
2
2
  import { FuforaCaseSummaryRR0Mapper } from "./FuforaCaseSummaryRR0Mapper.js";
3
3
  export const fuforaDatasource = new FuforaHttpDatasource(new URL("https://www.fufora.fi"), "ufodb2/ufohaku.php");
4
4
  export class FuforaRR0Mapping {
5
- constructor(cityService, actions) {
5
+ constructor(actions) {
6
6
  this.actions = actions;
7
7
  this.datasource = fuforaDatasource;
8
- this.mapper = new FuforaCaseSummaryRR0Mapper(cityService, fuforaDatasource.baseUrl, fuforaDatasource.copyright, fuforaDatasource.authors);
8
+ }
9
+ init(build) {
10
+ this.mapper = new FuforaCaseSummaryRR0Mapper(build.cityService, fuforaDatasource.baseUrl, fuforaDatasource.copyright, fuforaDatasource.authors);
11
+ return this;
9
12
  }
10
13
  }
@@ -4,7 +4,7 @@ import { nuforcTestCases } from "./NuforcTestCases.js";
4
4
  import { DatasourceTestCase } from "../DatasourceTestCase.js";
5
5
  import { NuforcRR0Mapping } from "./NuforcRR0Mapping";
6
6
  describe("NuforcCaseSource", () => {
7
- const nuforcRR0Mapping = new NuforcRR0Mapping(rr0TestUtil.cityService, rr0TestUtil.countryService, { read: ["fetch"], write: ["backup"] });
7
+ const nuforcRR0Mapping = new NuforcRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(rr0TestUtil);
8
8
  const testCase = new class extends DatasourceTestCase {
9
9
  constructor(mapping, sourceCases) {
10
10
  super(mapping, sourceCases);
@@ -1,14 +1,14 @@
1
1
  import { NuforcRR0Mapper } from "./NuforcRR0Mapper.js";
2
2
  import { NuforcHttpDatasource } from "./NuforcHttpDatasource.js";
3
- import { CityService } from "../../../org";
4
3
  import { RR0CaseMapping } from "../rr0";
5
4
  import { ChronologyReplacerActions } from "../ChronologyReplacerActions";
6
5
  import { NuforcCaseSummary } from "./NuforcCaseSummary";
7
- import { CountryService } from "../../../org/country/CountryService";
6
+ import { BuildContext } from "../../../BuildContext";
8
7
  export declare const nuforcDatasource: NuforcHttpDatasource;
9
8
  export declare class NuforcRR0Mapping implements RR0CaseMapping<NuforcCaseSummary> {
10
9
  readonly actions: ChronologyReplacerActions;
11
10
  datasource: NuforcHttpDatasource;
12
11
  mapper: NuforcRR0Mapper;
13
- constructor(cityService: CityService, countryService: CountryService, actions: ChronologyReplacerActions);
12
+ constructor(actions: ChronologyReplacerActions);
13
+ init(build: BuildContext): this;
14
14
  }
@@ -2,9 +2,12 @@ import { NuforcRR0Mapper } from "./NuforcRR0Mapper.js";
2
2
  import { NuforcHttpDatasource } from "./NuforcHttpDatasource.js";
3
3
  export const nuforcDatasource = new NuforcHttpDatasource();
4
4
  export class NuforcRR0Mapping {
5
- constructor(cityService, countryService, actions) {
5
+ constructor(actions) {
6
6
  this.actions = actions;
7
7
  this.datasource = nuforcDatasource;
8
- this.mapper = new NuforcRR0Mapper(cityService, countryService, nuforcDatasource.baseUrl.href, nuforcDatasource.copyright, nuforcDatasource.authors);
8
+ }
9
+ init(build) {
10
+ this.mapper = new NuforcRR0Mapper(build.cityService, build.countryService, nuforcDatasource.baseUrl.href, nuforcDatasource.copyright, nuforcDatasource.authors);
11
+ return this;
9
12
  }
10
13
  }
@@ -1,10 +1,12 @@
1
1
  import { CaseMapping } from "../CaseMapping.js";
2
2
  import { HtmlRR0Context } from "../../../RR0Context.js";
3
3
  import { RR0CaseSummary } from "./RR0CaseSummary.js";
4
+ import { BuildContext } from "../../../BuildContext";
4
5
  /**
5
6
  * Maps some datasource case to a RR0 case.
6
7
  *
7
8
  * @param S The source case type.
8
9
  */
9
10
  export interface RR0CaseMapping<S> extends CaseMapping<HtmlRR0Context, S, RR0CaseSummary> {
11
+ init(build: BuildContext): this;
10
12
  }
@@ -7,6 +7,7 @@ import { ChronologyReplacerActions } from "../ChronologyReplacerActions.js";
7
7
  import { TimeTextBuilder } from "../../text/TimeTextBuilder.js";
8
8
  import { RR0CaseSummaryMapper } from "./RR0CaseSummaryMapper";
9
9
  import { RR0FileDatasource } from "./RR0FileDatasource";
10
+ import { BuildContext } from "../../../BuildContext";
10
11
  export declare class RR0TestDatasource extends RR0Datasource implements Datasource<RR0CaseSummary> {
11
12
  timeTextBuilder: TimeTextBuilder;
12
13
  constructor();
@@ -14,8 +15,9 @@ export declare class RR0TestDatasource extends RR0Datasource implements Datasour
14
15
  }
15
16
  export declare class RR0TestMapping implements RR0CaseMapping<RR0CaseSummary> {
16
17
  readonly actions: ChronologyReplacerActions;
17
- readonly datasource: RR0TestDatasource;
18
- readonly backupDatasource: RR0FileDatasource;
19
- readonly mapper: RR0CaseSummaryMapper;
18
+ datasource: RR0TestDatasource;
19
+ backupDatasource: RR0FileDatasource;
20
+ mapper: RR0CaseSummaryMapper;
20
21
  constructor(actions: ChronologyReplacerActions);
22
+ init(build: BuildContext): this;
21
23
  }
@@ -20,8 +20,11 @@ export class RR0TestMapping {
20
20
  constructor(actions) {
21
21
  this.actions = actions;
22
22
  this.datasource = new RR0TestDatasource();
23
+ }
24
+ init(build) {
23
25
  this.mapper = new RR0CaseSummaryMapper(new URL("https://rr0.org"), "time", ["Beau, Jérôme"]);
24
26
  this.backupDatasource = new RR0FileDatasource(this.mapper);
27
+ return this;
25
28
  }
26
29
  }
27
30
  describe("RR0CaseSource", () => {
@@ -14,7 +14,8 @@ export class RR0HttpDatasource extends RR0Datasource {
14
14
  }
15
15
  static id(dateTime, place) {
16
16
  var _a;
17
- return dateTime.toString() + (place instanceof OrganizationPlace ? "$" + ((_a = place.org) === null || _a === void 0 ? void 0 : _a.dirName.replaceAll("/", "_")) : "");
17
+ const dirName = (_a = place.org) === null || _a === void 0 ? void 0 : _a.dirName;
18
+ return `${dateTime.toString()}-${place.id || place.name}`;
18
19
  }
19
20
  getFromRows(context, rows) {
20
21
  const cases = [];
@@ -3,14 +3,15 @@ import { ChronologyReplacerActions } from "../ChronologyReplacerActions.js";
3
3
  import { RR0CaseMapping } from "./RR0CaseMapping.js";
4
4
  import { RR0CaseSummary } from "./RR0CaseSummary.js";
5
5
  import { RR0FileDatasource } from "./RR0FileDatasource.js";
6
- import { CityService } from "../../../org";
7
6
  import { RR0Datasource } from "./RR0Datasource";
7
+ import { BuildContext } from "../../../BuildContext";
8
8
  export declare class RR0Mapping implements RR0CaseMapping<RR0CaseSummary> {
9
9
  readonly actions: ChronologyReplacerActions;
10
10
  static baseUrl: URL;
11
11
  static searchPath: string;
12
- readonly datasource: RR0Datasource;
13
- readonly backupDatasource: RR0FileDatasource;
14
- readonly mapper: RR0CaseSummaryMapper;
15
- constructor(cityService: CityService, actions: ChronologyReplacerActions);
12
+ datasource: RR0Datasource;
13
+ backupDatasource: RR0FileDatasource;
14
+ mapper: RR0CaseSummaryMapper;
15
+ constructor(actions: ChronologyReplacerActions);
16
+ init(build: BuildContext): this;
16
17
  }
@@ -2,11 +2,14 @@ import { RR0CaseSummaryMapper } from "./RR0CaseSummaryMapper.js";
2
2
  import { RR0HttpDatasource } from "./RR0HttpDatasource.js";
3
3
  import { RR0FileDatasource } from "./RR0FileDatasource.js";
4
4
  export class RR0Mapping {
5
- constructor(cityService, actions) {
5
+ constructor(actions) {
6
6
  this.actions = actions;
7
- const rr0HttpDatasource = this.datasource = new RR0HttpDatasource(RR0Mapping.baseUrl, RR0Mapping.searchPath, cityService);
7
+ }
8
+ init(build) {
9
+ const rr0HttpDatasource = this.datasource = new RR0HttpDatasource(RR0Mapping.baseUrl, RR0Mapping.searchPath, build.cityService);
8
10
  const csvMapper = this.mapper = new RR0CaseSummaryMapper(rr0HttpDatasource.baseUrl, rr0HttpDatasource.searchPath, rr0HttpDatasource.authors);
9
11
  this.backupDatasource = new RR0FileDatasource(csvMapper);
12
+ return this;
10
13
  }
11
14
  }
12
15
  RR0Mapping.baseUrl = new URL("https://rr0.org");
@@ -5,6 +5,7 @@ import { TimeTextBuilder } from "../../text/TimeTextBuilder.js";
5
5
  import { HtmlRR0Context } from "../../../RR0Context.js";
6
6
  import { SceauCaseSummaryRR0Mapper } from "./SceauCaseSummaryRR0Mapper";
7
7
  import { ChronologyReplacerActions } from "../ChronologyReplacerActions";
8
+ import { BuildContext } from "../../../BuildContext";
8
9
  export declare class SceauTestDatasource extends SceauDatasource {
9
10
  timeTextBuilder: TimeTextBuilder;
10
11
  constructor();
@@ -12,7 +13,8 @@ export declare class SceauTestDatasource extends SceauDatasource {
12
13
  }
13
14
  export declare class SceauTestMapping implements SceauCaseMapping {
14
15
  readonly actions: ChronologyReplacerActions;
15
- readonly datasource: import("./SceauHttpDatasource.js").SceauHttpDatasource;
16
- readonly mapper: SceauCaseSummaryRR0Mapper;
16
+ datasource: import("./SceauHttpDatasource.js").SceauHttpDatasource;
17
+ mapper: SceauCaseSummaryRR0Mapper;
17
18
  constructor(actions?: ChronologyReplacerActions);
19
+ init(build: BuildContext): this;
18
20
  }
@@ -21,7 +21,10 @@ export class SceauTestMapping {
21
21
  constructor(actions = { read: ["fetch"], write: ["backup"] }) {
22
22
  this.actions = actions;
23
23
  this.datasource = sceauDatasource; // new SceauTestDatasource()
24
+ }
25
+ init(build) {
24
26
  this.mapper = new SceauCaseSummaryRR0Mapper(rr0TestUtil.cityService, sceauDatasource.baseUrl, sceauDatasource.copyright, sceauDatasource.authors);
27
+ return this;
25
28
  }
26
29
  }
27
30
  describe("SCEAUCaseSource", () => {
@@ -3,11 +3,12 @@ import { RR0CaseMapping } from "../rr0/index.js";
3
3
  import { SceauCaseSummary } from "./SceauCaseSummary.js";
4
4
  import { ChronologyReplacerActions } from "../ChronologyReplacerActions.js";
5
5
  import { SceauCaseSummaryRR0Mapper } from "./SceauCaseSummaryRR0Mapper.js";
6
- import { CityService } from "../../../org";
6
+ import { BuildContext } from "../../../BuildContext";
7
7
  export declare const sceauDatasource: SceauHttpDatasource;
8
8
  export declare class SceauRR0Mapping implements RR0CaseMapping<SceauCaseSummary> {
9
9
  readonly actions: ChronologyReplacerActions;
10
10
  datasource: SceauHttpDatasource;
11
11
  mapper: SceauCaseSummaryRR0Mapper;
12
- constructor(cityService: CityService, actions: ChronologyReplacerActions);
12
+ constructor(actions: ChronologyReplacerActions);
13
+ init(build: BuildContext): this;
13
14
  }
@@ -2,9 +2,12 @@ import { SceauHttpDatasource } from "./SceauHttpDatasource.js";
2
2
  import { SceauCaseSummaryRR0Mapper } from "./SceauCaseSummaryRR0Mapper.js";
3
3
  export const sceauDatasource = new SceauHttpDatasource(new URL("https://sceau-archives-ovni.org"));
4
4
  export class SceauRR0Mapping {
5
- constructor(cityService, actions) {
5
+ constructor(actions) {
6
6
  this.actions = actions;
7
7
  this.datasource = sceauDatasource;
8
- this.mapper = new SceauCaseSummaryRR0Mapper(cityService, sceauDatasource.baseUrl, sceauDatasource.copyright, sceauDatasource.authors);
8
+ }
9
+ init(build) {
10
+ this.mapper = new SceauCaseSummaryRR0Mapper(build.cityService, sceauDatasource.baseUrl, sceauDatasource.copyright, sceauDatasource.authors);
11
+ return this;
9
12
  }
10
13
  }
@@ -4,7 +4,7 @@ import { DatasourceTestCase } from "../DatasourceTestCase.js";
4
4
  import { ufoSearchTestCases } from "./UfoSearchTestCases.js";
5
5
  import { UfoSearchRR0Mapping } from "./UfoSearchMapping";
6
6
  describe("UfoSearchCaseSource", () => {
7
- const ufoSearchRR0Mapping = new UfoSearchRR0Mapping(rr0TestUtil.cityService, { read: ["fetch"], write: ["backup"] });
7
+ const ufoSearchRR0Mapping = new UfoSearchRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(rr0TestUtil);
8
8
  const testCase = new class extends DatasourceTestCase {
9
9
  constructor(mapping, sourceCases) {
10
10
  super(mapping, sourceCases);
@@ -4,12 +4,13 @@ import { UfoSearchCaseRR0Mapper } from "./UfoSearchCaseRR0Mapper.js";
4
4
  import { ChronologyReplacerActions } from "../ChronologyReplacerActions.js";
5
5
  import { RR0CaseMapping } from "../rr0";
6
6
  import { UfoSearchCase } from "./UfoSearchCase";
7
- import { CityService } from "../../../org";
7
+ import { BuildContext } from "../../../BuildContext";
8
8
  export declare const ufoSearchHttpDatasource: UfoSearchHttpDatasource;
9
9
  export declare class UfoSearchRR0Mapping implements RR0CaseMapping<UfoSearchCase> {
10
10
  readonly actions: ChronologyReplacerActions;
11
11
  datasource: UfoSearchHttpDatasource;
12
12
  backupDatasource: UfoSearchFileDatasource;
13
13
  mapper: UfoSearchCaseRR0Mapper;
14
- constructor(cityService: CityService, actions: ChronologyReplacerActions);
14
+ constructor(actions: ChronologyReplacerActions);
15
+ init(build: BuildContext): this;
15
16
  }
@@ -3,10 +3,13 @@ import { UfoSearchFileDatasource } from "./UfoSearchFileDatasource.js";
3
3
  import { UfoSearchCaseRR0Mapper } from "./UfoSearchCaseRR0Mapper.js";
4
4
  export const ufoSearchHttpDatasource = new UfoSearchHttpDatasource("https://www.ufo-search.com", "timeline/search.html");
5
5
  export class UfoSearchRR0Mapping {
6
- constructor(cityService, actions) {
6
+ constructor(actions) {
7
7
  this.actions = actions;
8
8
  this.datasource = ufoSearchHttpDatasource;
9
- this.mapper = new UfoSearchCaseRR0Mapper(cityService, ufoSearchHttpDatasource.baseUrl, ufoSearchHttpDatasource.copyright, ufoSearchHttpDatasource.authors);
9
+ }
10
+ init(build) {
11
+ this.mapper = new UfoSearchCaseRR0Mapper(build.cityService, ufoSearchHttpDatasource.baseUrl, ufoSearchHttpDatasource.copyright, ufoSearchHttpDatasource.authors);
10
12
  this.backupDatasource = new UfoSearchFileDatasource("time/datasource/ufo-search/majestic.json", this.mapper);
13
+ return this;
11
14
  }
12
15
  }
@@ -4,7 +4,8 @@ import { urecatTestCases } from "./UrecatTestCases.js";
4
4
  import { DatasourceTestCase } from "../DatasourceTestCase.js";
5
5
  import { UrecatRR0Mapping } from "./UrecatRR0Mapping";
6
6
  describe("UrecatCaseSource", () => {
7
- const urecatRR0Mapping = new UrecatRR0Mapping(rr0TestUtil.cityService, rr0TestUtil.countryService, { read: ["fetch"], write: ["backup"] });
7
+ const urecatRR0Mapping = new UrecatRR0Mapping({ read: ["fetch"], write: ["backup"] });
8
+ urecatRR0Mapping.init(rr0TestUtil);
8
9
  const testCase = new class extends DatasourceTestCase {
9
10
  constructor(mapping, sourceCases) {
10
11
  super(mapping, sourceCases);
@@ -3,12 +3,12 @@ import { UrecatHttpDatasource } from "./UrecatHttpDatasource.js";
3
3
  import { ChronologyReplacerActions } from "../ChronologyReplacerActions.js";
4
4
  import { RR0CaseMapping } from "../rr0";
5
5
  import { UrecatCase } from "./UrecatCase";
6
- import { CityService } from "../../../org";
7
- import { CountryService } from "../../../org/country/CountryService";
6
+ import { BuildContext } from "../../../BuildContext";
8
7
  export declare const urecatDatasource: UrecatHttpDatasource;
9
8
  export declare class UrecatRR0Mapping implements RR0CaseMapping<UrecatCase> {
10
9
  readonly actions: ChronologyReplacerActions;
11
10
  datasource: UrecatHttpDatasource;
12
11
  mapper: UrecatRR0Mapper;
13
- constructor(cityService: CityService, countryService: CountryService, actions: ChronologyReplacerActions);
12
+ constructor(actions: ChronologyReplacerActions);
13
+ init(build: BuildContext): this;
14
14
  }
@@ -2,9 +2,12 @@ import { UrecatRR0Mapper } from "./UrecatRR0Mapper.js";
2
2
  import { UrecatHttpDatasource } from "./UrecatHttpDatasource.js";
3
3
  export const urecatDatasource = new UrecatHttpDatasource(new URL("https://ufologie.patrickgross.org"), "ce3");
4
4
  export class UrecatRR0Mapping {
5
- constructor(cityService, countryService, actions) {
5
+ constructor(actions) {
6
6
  this.actions = actions;
7
7
  this.datasource = urecatDatasource;
8
- this.mapper = new UrecatRR0Mapper(cityService, countryService, urecatDatasource.baseUrl, urecatDatasource.copyright, urecatDatasource.authors);
8
+ }
9
+ init(build) {
10
+ this.mapper = new UrecatRR0Mapper(build.cityService, build.countryService, urecatDatasource.baseUrl, urecatDatasource.copyright, urecatDatasource.authors);
11
+ return this;
9
12
  }
10
13
  }
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.2",
5
+ "version": "0.3.3",
6
6
  "description": "RR0 Content Management System (CMS)",
7
7
  "exports": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
@@ -30,10 +30,10 @@
30
30
  "dependencies": {
31
31
  "@javarome/fileutil": "^0.3.6",
32
32
  "@rr0/common": "^1.1.3",
33
- "@rr0/data": "^0.3.4",
33
+ "@rr0/data": "^0.3.5",
34
34
  "@rr0/lang": "^0.1.12",
35
35
  "@rr0/place": "^0.5.1",
36
- "@rr0/time": "^0.9.2",
36
+ "@rr0/time": "^0.10.0",
37
37
  "canvas": "^2.11.2",
38
38
  "csv-parser": "^3.0.0",
39
39
  "glob": "^11.0.0",
@@ -1,25 +0,0 @@
1
- import { describe, expect, test } from "@javarome/testscript";
2
- import { CountryCode, Occupation, People, PeopleFactory, RR0EventFactory } from "@rr0/data";
3
- describe("PeopleFactory", () => {
4
- const eventFactory = new RR0EventFactory();
5
- const factory = new PeopleFactory(eventFactory);
6
- test("build people with two first names", () => {
7
- const villaJson = {
8
- "birthTime": "1916-09-24",
9
- "deathTime": "1980-11-22",
10
- "occupations": [
11
- "contactee",
12
- "mechanic"
13
- ],
14
- "countries": [
15
- "us"
16
- ],
17
- "pseudonyms": [
18
- "Paul Villa"
19
- ]
20
- };
21
- const parsed = factory.parse(villaJson);
22
- const expected = new People(undefined, undefined, ["Paul Villa"], [Occupation.contactee, Occupation.mechanic], [CountryCode.us], true);
23
- expect(parsed).toEqual(expected);
24
- });
25
- });