@rr0/cms 0.1.14 → 0.1.16

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 (223) hide show
  1. package/dist/BaseReplaceCommand.d.ts +2 -2
  2. package/dist/DefaultContentVisitor.d.ts +11 -11
  3. package/dist/DescriptionReplaceCommand.d.ts +3 -3
  4. package/dist/ImageCommand.d.ts +3 -3
  5. package/dist/MetaLinkReplaceCommand.d.ts +3 -3
  6. package/dist/OpenGraphCommand.d.ts +6 -6
  7. package/dist/OpenGraphCommand.js +1 -1
  8. package/dist/RR0ContentStep.d.ts +11 -11
  9. package/dist/RR0ContentStep.js +2 -2
  10. package/dist/{RR0SsgContext.d.ts → RR0Context.d.ts} +8 -8
  11. package/dist/{RR0SsgContext.js → RR0Context.js} +4 -4
  12. package/dist/anchor/AnchorHandler.d.ts +2 -2
  13. package/dist/anchor/AnchorReplaceCommand.d.ts +2 -2
  14. package/dist/anchor/AnchorReplacer.d.ts +3 -3
  15. package/dist/anchor/CaseAnchorHandler.d.ts +2 -2
  16. package/dist/anchor/CaseAnchorHandler.js +2 -2
  17. package/dist/anchor/DataAnchorHandler.d.ts +6 -6
  18. package/dist/book/BookContentVisitor.d.ts +2 -2
  19. package/dist/book/BookDirectoryStep.d.ts +5 -5
  20. package/dist/book/BookService.d.ts +3 -1
  21. package/dist/book/BookService.js +4 -4
  22. package/dist/book/Chapters.d.ts +3 -3
  23. package/dist/book/Chapters.js +2 -2
  24. package/dist/build.js +27 -8
  25. package/dist/data/AbstractDataFactory.d.ts +3 -2
  26. package/dist/data/AbstractDataFactory.js +1 -1
  27. package/dist/data/AbstractDataService.d.ts +2 -3
  28. package/dist/data/AbstractDataService.js +2 -8
  29. package/dist/data/RR0Data.d.ts +4 -3
  30. package/dist/data/TypedDataFactory.d.ts +3 -2
  31. package/dist/data/TypedDataFactory.js +4 -0
  32. package/dist/data/index.d.ts +1 -1
  33. package/dist/data/index.js +1 -1
  34. package/dist/index/IndexedReplacer.d.ts +4 -4
  35. package/dist/index/IndexedReplacerFactory.d.ts +2 -2
  36. package/dist/index.d.ts +1 -1
  37. package/dist/index.js +1 -1
  38. package/dist/lang/LanguageReplaceCommand.d.ts +3 -3
  39. package/dist/lang/RR0Messages.d.ts +1 -1
  40. package/dist/lang/RR0Messages_en.d.ts +1 -1
  41. package/dist/lang/RR0Messages_en.js +1 -1
  42. package/dist/lang/RR0Messages_fr.d.ts +1 -1
  43. package/dist/lang/RR0Messages_fr.js +1 -1
  44. package/dist/note/NoteFileCounter.d.ts +2 -2
  45. package/dist/note/NoteRenderer.d.ts +2 -2
  46. package/dist/note/NoteReplacer.d.ts +2 -2
  47. package/dist/note/NoteReplacerFactory.d.ts +2 -2
  48. package/dist/org/OrgMessages.d.ts +2 -2
  49. package/dist/org/Organization.d.ts +3 -3
  50. package/dist/org/Organization.js +3 -3
  51. package/dist/org/OrganizationMessages.d.ts +3 -3
  52. package/dist/org/OrganizationService.d.ts +4 -3
  53. package/dist/org/OrganizationService.js +10 -9
  54. package/dist/org/au/region/vic/index.d.ts +1 -1
  55. package/dist/org/au/region/vic/index.js +1 -1
  56. package/dist/org/br/region/cw/CentralWest.js +1 -1
  57. package/dist/org/br/region/se/SouthEast.js +1 -1
  58. package/dist/org/country/region/department/city/CityService.d.ts +2 -2
  59. package/dist/org/country/region/department/city/CityService.js +2 -1
  60. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseSummary.d.ts +1 -1
  61. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseSummaryRR0Mapper.d.ts +4 -4
  62. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseSummaryRR0Mapper.js +1 -1
  63. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseToSummaryMapper.d.ts +3 -3
  64. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseToSummaryMapper.js +1 -1
  65. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanDatasource.d.ts +3 -3
  66. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanFileDatasource.d.ts +3 -3
  67. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanHttpDatasource.d.ts +6 -5
  68. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanSummaryToCaseMapper.d.ts +3 -3
  69. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanTestCases.js +1 -1
  70. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanTestimonial.d.ts +1 -1
  71. package/dist/org/us/region/fl/Florida.js +1 -1
  72. package/dist/org/us/region/hi/Hawaii.js +1 -1
  73. package/dist/org/us/region/in/Indiana.js +1 -1
  74. package/dist/org/us/region/va/Virginia.js +1 -1
  75. package/dist/org/us/region/wa/Washington.js +1 -1
  76. package/dist/org/us/region/wv/WestVirginia.js +1 -1
  77. package/dist/people/PeopleDirectoryStep.d.ts +4 -4
  78. package/dist/people/PeopleReplacer.d.ts +3 -3
  79. package/dist/people/PeopleReplacerFactory.d.ts +2 -2
  80. package/dist/people/PeopleService.d.ts +3 -4
  81. package/dist/people/PeopleService.js +3 -14
  82. package/dist/people/author/AuthorReplaceCommand.d.ts +2 -2
  83. package/dist/people/witness/WitnessReplacer.d.ts +2 -2
  84. package/dist/people/witness/WitnessReplacerFactory.d.ts +2 -2
  85. package/dist/place/GooglePlaceService.d.ts +1 -1
  86. package/dist/place/GooglePlaceService.js +1 -1
  87. package/dist/place/Place.d.ts +1 -1
  88. package/dist/place/Place.js +1 -1
  89. package/dist/place/PlaceService.d.ts +1 -1
  90. package/dist/place/PlaceService.js +1 -1
  91. package/dist/place/index.d.ts +0 -4
  92. package/dist/place/index.js +0 -4
  93. package/dist/science/crypto/ufo/enquete/dossier/CaseDirectoryStep.d.ts +5 -5
  94. package/dist/science/crypto/ufo/enquete/dossier/CaseDirectoryStep.js +1 -1
  95. package/dist/science/crypto/ufo/enquete/dossier/CaseService.d.ts +3 -3
  96. package/dist/science/crypto/ufo/enquete/dossier/CaseService.js +2 -2
  97. package/dist/search/SearchVisitor.d.ts +5 -5
  98. package/dist/source/Source.d.ts +1 -1
  99. package/dist/source/SourceFactory.d.ts +4 -4
  100. package/dist/source/SourceFactory.js +3 -2
  101. package/dist/source/SourceFileCounter.d.ts +2 -2
  102. package/dist/source/SourceRegistry.d.ts +2 -2
  103. package/dist/source/SourceRenderer.d.ts +3 -3
  104. package/dist/source/SourceRenderer.js +2 -2
  105. package/dist/source/SourceReplacer.d.ts +3 -3
  106. package/dist/source/SourceReplacerFactory.d.ts +2 -2
  107. package/dist/tech/info/soft/proj/impl/lang/CodeReplacer.d.ts +3 -3
  108. package/dist/tech/info/soft/proj/impl/lang/CodeReplacerFactory.d.ts +2 -2
  109. package/dist/time/CaseSummaryRenderer.d.ts +1 -1
  110. package/dist/time/EventRenderer.d.ts +7 -7
  111. package/dist/time/EventReplacerFactory.d.ts +4 -4
  112. package/dist/time/SsiTitleReplaceCommand.d.ts +2 -2
  113. package/dist/time/Time.d.ts +5 -3
  114. package/dist/time/Time.js +31 -5
  115. package/dist/time/TimeLinkDefaultHandler.d.ts +10 -9
  116. package/dist/time/TimeLinkDefaultHandler.js +8 -12
  117. package/dist/time/TimeService.d.ts +16 -7
  118. package/dist/time/TimeService.js +16 -22
  119. package/dist/time/TimeTestUtil.d.ts +16 -0
  120. package/dist/time/TimeTestUtil.js +29 -0
  121. package/dist/time/TimeUrlBuilder.d.ts +7 -3
  122. package/dist/time/TimeUrlBuilder.js +7 -4
  123. package/dist/time/datasource/AbstractDatasource.d.ts +6 -6
  124. package/dist/time/datasource/ChronologyReplacer.d.ts +6 -6
  125. package/dist/time/datasource/ChronologyReplacerFactory.d.ts +2 -2
  126. package/dist/time/datasource/ChronologyReplacerFactory.js +1 -1
  127. package/dist/time/datasource/ContextFilter.d.ts +3 -3
  128. package/dist/time/datasource/CsvFileSource.d.ts +2 -2
  129. package/dist/time/datasource/CsvMapper.d.ts +5 -5
  130. package/dist/time/datasource/CsvMapper.js +1 -1
  131. package/dist/time/datasource/Datasource.d.ts +2 -2
  132. package/dist/time/datasource/DatasourceTestCase.d.ts +8 -8
  133. package/dist/time/datasource/DatasourceTestCase.js +18 -16
  134. package/dist/time/datasource/FileDatasource.d.ts +2 -2
  135. package/dist/time/datasource/JsonMapper.d.ts +4 -4
  136. package/dist/time/datasource/TimeContextFilter.d.ts +3 -3
  137. package/dist/time/datasource/acufo/AcufoCase.d.ts +1 -1
  138. package/dist/time/datasource/acufo/AcufoDatasource.d.ts +3 -3
  139. package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummary.d.ts +1 -1
  140. package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryMapper.d.ts +3 -3
  141. package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryMapper.js +1 -1
  142. package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryRR0Mapper.d.ts +3 -3
  143. package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryRR0Mapper.js +1 -1
  144. package/dist/time/datasource/baseovnifrance/BaseOvniFranceDatasource.d.ts +2 -2
  145. package/dist/time/datasource/baseovnifrance/BaseOvniFranceHttpDatasource.d.ts +6 -6
  146. package/dist/time/datasource/baseovnifrance/BaseOvniFranceTestCases.js +1 -1
  147. package/dist/time/datasource/fufora/FuforaCaseSummary.d.ts +1 -1
  148. package/dist/time/datasource/fufora/FuforaCaseSummaryRR0Mapper.d.ts +3 -3
  149. package/dist/time/datasource/fufora/FuforaCaseSummaryRR0Mapper.js +1 -1
  150. package/dist/time/datasource/fufora/FuforaDatasource.d.ts +2 -2
  151. package/dist/time/datasource/fufora/FuforaHttpDatasource.d.ts +5 -5
  152. package/dist/time/datasource/fufora/FuforaTestCases.js +1 -1
  153. package/dist/time/datasource/nuforc/NuforcCaseSummary.d.ts +1 -1
  154. package/dist/time/datasource/nuforc/NuforcDatasource.d.ts +2 -2
  155. package/dist/time/datasource/nuforc/NuforcHttpDatasource.d.ts +6 -6
  156. package/dist/time/datasource/nuforc/NuforcRR0Mapper.d.ts +3 -3
  157. package/dist/time/datasource/nuforc/NuforcRR0Mapper.js +1 -1
  158. package/dist/time/datasource/nuforc/NuforcTestCases.js +1 -1
  159. package/dist/time/datasource/rr0/NamedPlace.d.ts +7 -0
  160. package/dist/time/datasource/rr0/RR0CaseMapping.d.ts +2 -2
  161. package/dist/time/datasource/rr0/RR0CaseSummary.d.ts +0 -7
  162. package/dist/time/datasource/rr0/RR0CaseSummaryMapper.d.ts +3 -3
  163. package/dist/time/datasource/rr0/RR0FileDatasource.d.ts +5 -5
  164. package/dist/time/datasource/rr0/RR0HttpDatasource.d.ts +10 -9
  165. package/dist/time/datasource/rr0/RR0HttpDatasource.js +3 -32
  166. package/dist/time/datasource/rr0/RR0TestCases.js +1 -1
  167. package/dist/time/datasource/rr0/index.d.ts +1 -0
  168. package/dist/time/datasource/rr0/index.js +1 -0
  169. package/dist/time/datasource/sceau/SceauCaseSummaryRR0Mapper.d.ts +3 -3
  170. package/dist/time/datasource/sceau/SceauCaseSummaryRR0Mapper.js +1 -1
  171. package/dist/time/datasource/sceau/SceauDatasource.d.ts +4 -4
  172. package/dist/time/datasource/sceau/SceauDatasource.js +1 -1
  173. package/dist/time/datasource/sceau/SceauHttpDatasource.d.ts +5 -5
  174. package/dist/time/datasource/ufo-search/UfoSearchCase.d.ts +1 -1
  175. package/dist/time/datasource/ufo-search/UfoSearchCaseRR0Mapper.d.ts +4 -4
  176. package/dist/time/datasource/ufo-search/UfoSearchCaseRR0Mapper.js +10 -10
  177. package/dist/time/datasource/ufo-search/UfoSearchDatasource.d.ts +2 -2
  178. package/dist/time/datasource/ufo-search/UfoSearchFileDatasource.d.ts +3 -3
  179. package/dist/time/datasource/ufo-search/UfoSearchFileDatasource.js +1 -1
  180. package/dist/time/datasource/ufo-search/UfoSearchHttpDatasource.d.ts +4 -4
  181. package/dist/time/datasource/ufo-search/UfoSearchTestCases.js +1 -1
  182. package/dist/time/datasource/urecat/UrecatCase.d.ts +1 -1
  183. package/dist/time/datasource/urecat/UrecatHttpDatasource.d.ts +5 -5
  184. package/dist/time/datasource/urecat/UrecatHttpDatasource.js +1 -1
  185. package/dist/time/datasource/urecat/UrecatRR0Mapper.d.ts +3 -3
  186. package/dist/time/datasource/urecat/UrecatRR0Mapper.js +1 -1
  187. package/dist/time/datasource/urecat/UrecatTestCases.js +1 -1
  188. package/dist/time/html/TimeElementFactory.d.ts +15 -0
  189. package/dist/time/{TimeElementFactory.js → html/TimeElementFactory.js} +16 -22
  190. package/dist/time/html/TimeRenderer.d.ts +18 -0
  191. package/dist/time/html/TimeRenderer.js +46 -0
  192. package/dist/time/html/TimeReplacer.d.ts +12 -0
  193. package/dist/time/{TimeReplacer.js → html/TimeReplacer.js} +0 -3
  194. package/dist/time/{TimeReplacerFactory.d.ts → html/TimeReplacerFactory.d.ts} +2 -2
  195. package/dist/time/{TimeReplacerFactory.js → html/TimeReplacerFactory.js} +1 -1
  196. package/dist/time/html/index.d.ts +4 -0
  197. package/dist/time/html/index.js +4 -0
  198. package/dist/time/index.d.ts +3 -8
  199. package/dist/time/index.js +3 -8
  200. package/dist/time/{RelativeTimeTextBuilder.d.ts → text/RelativeTimeTextBuilder.d.ts} +2 -2
  201. package/dist/time/text/RelativeTimeTextBuilder.js +165 -0
  202. package/dist/time/{TimeTextBuilder.d.ts → text/TimeTextBuilder.d.ts} +2 -2
  203. package/dist/time/{TimeTextBuilder.js → text/TimeTextBuilder.js} +1 -1
  204. package/dist/time/text/index.d.ts +2 -0
  205. package/dist/time/text/index.js +2 -0
  206. package/dist/value/UnitReplaceCommand.d.ts +2 -2
  207. package/package.json +12 -11
  208. package/tsconfig.json +2 -1
  209. package/dist/place/PlaceLocation.d.ts +0 -26
  210. package/dist/place/PlaceLocation.js +0 -48
  211. package/dist/place/PlaceMessages.d.ts +0 -5
  212. package/dist/place/PlaceMessages_en.d.ts +0 -2
  213. package/dist/place/PlaceMessages_en.js +0 -4
  214. package/dist/place/PlaceMessages_fr.d.ts +0 -2
  215. package/dist/place/PlaceMessages_fr.js +0 -4
  216. package/dist/time/RelativeTimeTextBuilder.js +0 -166
  217. package/dist/time/TimeContext.d.ts +0 -59
  218. package/dist/time/TimeContext.js +0 -267
  219. package/dist/time/TimeElementFactory.d.ts +0 -15
  220. package/dist/time/TimeRenderer.d.ts +0 -19
  221. package/dist/time/TimeRenderer.js +0 -63
  222. package/dist/time/TimeReplacer.d.ts +0 -24
  223. /package/dist/{place/PlaceMessages.js → time/datasource/rr0/NamedPlace.js} +0 -0
package/dist/time/Time.js CHANGED
@@ -1,5 +1,4 @@
1
- import { TimeContext } from "./TimeContext.js";
2
- import { RR0SsgContextImpl } from "../RR0SsgContext.js";
1
+ import { RR0ContextImpl } from "../RR0Context.js";
3
2
  import { StringUtil } from "../util/string/StringUtil.js";
4
3
  export class Time {
5
4
  /**
@@ -21,13 +20,40 @@ export class Time {
21
20
  }
22
21
  static titleFromFile(context, fileName, timeTextBuilder) {
23
22
  let title;
24
- const timeContext = TimeContext.fromFileName(context, fileName);
23
+ const timeContext = Time.contextFromFileName(context, fileName);
25
24
  if (timeContext) {
26
- const pageContext = new RR0SsgContextImpl(context.locale, timeContext, context.config, context.people, context.file);
27
- title = timeTextBuilder.build(pageContext);
25
+ const pageContext = new RR0ContextImpl(context.locale, timeContext, context.config, context.people, context.file);
26
+ title = timeTextBuilder.build(pageContext, true);
28
27
  title = StringUtil.capitalizeFirstLetter(title);
29
28
  }
30
29
  return title;
31
30
  }
31
+ static contextFromFileName(context, fileName = context.file.name) {
32
+ let timeContext;
33
+ let elems;
34
+ if (fileName.endsWith("index.html")) {
35
+ while ((elems = fileName.split("/")).length < 6) {
36
+ fileName = elems.slice(0, elems.length - 1).join("/") + "/0/index.html";
37
+ }
38
+ }
39
+ const timeExec = Time.parseFileName(fileName);
40
+ if (timeExec && timeExec.length > 5) {
41
+ const pageContext = context.clone();
42
+ timeContext = pageContext.time;
43
+ const m = parseInt(timeExec[2], 10);
44
+ const c = parseInt(timeExec[3], 10);
45
+ const d = parseInt(timeExec[4], 10);
46
+ const u = parseInt(timeExec[5], 10);
47
+ const year = (timeExec[1] ? -1 : 1) * (m * 1000 + c * 100 + d * 10 + u);
48
+ timeContext.setYear(year);
49
+ const monthStr = timeExec[6];
50
+ timeContext.setMonth(monthStr ? parseInt(monthStr, 10) : undefined);
51
+ const dayStr = timeExec[7];
52
+ timeContext.setDayOfMonth(dayStr ? parseInt(dayStr, 10) : undefined);
53
+ timeContext.setHour(undefined);
54
+ timeContext.setMinutes(undefined);
55
+ }
56
+ return timeContext;
57
+ }
32
58
  }
33
59
  Time.timePathRegex = /time\/(-)?(\d)\/(\d)\/(\d)\/(\d)\/?(\d{2})?\/?(\d{2})?\/?(index(_[a-z]{2})?.html)?/;
@@ -1,14 +1,15 @@
1
1
  import { LinkHandler } from "../MetaLinkReplaceCommand.js";
2
- import { HtmlRR0SsgContext } from "../RR0SsgContext.js";
2
+ import { HtmlRR0Context } from "../RR0Context.js";
3
3
  import { Link } from "ssg-api";
4
- import { TimeTextBuilder } from "./TimeTextBuilder.js";
5
- export declare class TimeLinkDefaultHandler implements LinkHandler<HtmlRR0SsgContext> {
6
- protected timeFiles: string[];
4
+ import { TimeTextBuilder } from "./text/TimeTextBuilder.js";
5
+ import { TimeService } from "./TimeService";
6
+ export declare class TimeLinkDefaultHandler implements LinkHandler<HtmlRR0Context> {
7
+ protected service: TimeService;
7
8
  protected timeTextBuilder: TimeTextBuilder;
8
- constructor(timeFiles: string[], timeTextBuilder: TimeTextBuilder);
9
- contents(context: HtmlRR0SsgContext): Link | undefined;
10
- next(context: HtmlRR0SsgContext): Link | undefined;
11
- prev(context: HtmlRR0SsgContext): Link | undefined;
12
- start(context: HtmlRR0SsgContext): Link | undefined;
9
+ constructor(service: TimeService, timeTextBuilder: TimeTextBuilder);
10
+ contents(context: HtmlRR0Context): Link | undefined;
11
+ next(context: HtmlRR0Context): Link | undefined;
12
+ prev(context: HtmlRR0Context): Link | undefined;
13
+ start(context: HtmlRR0Context): Link | undefined;
13
14
  protected isTimeFile(fileName: string): boolean;
14
15
  }
@@ -1,19 +1,15 @@
1
1
  import { Time } from "./Time.js";
2
2
  import { LinkType } from "ssg-api";
3
3
  export class TimeLinkDefaultHandler {
4
- constructor(timeFiles, timeTextBuilder) {
5
- this.timeFiles = timeFiles;
4
+ constructor(service, timeTextBuilder) {
5
+ this.service = service;
6
6
  this.timeTextBuilder = timeTextBuilder;
7
7
  }
8
8
  contents(context) {
9
9
  const prevLink = this.prev(context);
10
10
  if (prevLink) {
11
- let contentUrl = prevLink.url.substring(1);
12
- do {
13
- const slash = contentUrl.lastIndexOf("/");
14
- contentUrl = contentUrl.substring(0, slash);
15
- } while (this.timeFiles.indexOf(contentUrl) < 0 && contentUrl !== "time");
16
- if (contentUrl != "time") {
11
+ let contentUrl = this.service.matchExistingTimeFile(prevLink.url.substring(1));
12
+ if (contentUrl != this.service.root) {
17
13
  const text = Time.titleFromFile(context, contentUrl, this.timeTextBuilder);
18
14
  if (text) {
19
15
  return { type: LinkType.prev, text, url: "/" + contentUrl };
@@ -24,9 +20,9 @@ export class TimeLinkDefaultHandler {
24
20
  next(context) {
25
21
  let fileName = context.file.name;
26
22
  if (this.isTimeFile(fileName)) {
27
- const pos = this.timeFiles.indexOf(fileName);
23
+ const pos = this.service.files.indexOf(fileName);
28
24
  if (pos >= 0) {
29
- const nextFile = this.timeFiles[pos + 1];
25
+ const nextFile = this.service.files[pos + 1];
30
26
  if (nextFile) {
31
27
  const text = Time.titleFromFile(context, nextFile, this.timeTextBuilder);
32
28
  return { type: LinkType.next, text, url: "/" + nextFile };
@@ -37,9 +33,9 @@ export class TimeLinkDefaultHandler {
37
33
  prev(context) {
38
34
  let fileName = context.file.name;
39
35
  if (this.isTimeFile(fileName)) {
40
- const pos = this.timeFiles.indexOf(fileName);
36
+ const pos = this.service.files.indexOf(fileName);
41
37
  if (pos >= 0) {
42
- const prevFile = this.timeFiles[pos - 1];
38
+ const prevFile = this.service.files[pos - 1];
43
39
  if (prevFile) {
44
40
  const text = Time.titleFromFile(context, prevFile, this.timeTextBuilder);
45
41
  if (text) {
@@ -1,12 +1,21 @@
1
- import { TimeRenderer } from "./TimeRenderer.js";
2
- import { TimeTextBuilder } from "./TimeTextBuilder.js";
1
+ import { TimeRenderer } from "./html/TimeRenderer.js";
2
+ import { TimeTextBuilder } from "./text/TimeTextBuilder.js";
3
3
  import { AbstractDataService, AllDataService } from "../data/index.js";
4
4
  import { RR0Event } from "../event/index.js";
5
+ import { TimeUrlBuilder } from "./TimeUrlBuilder";
6
+ export type TimeServiceOptions = {
7
+ readonly root: string;
8
+ readonly files: string[];
9
+ };
5
10
  export declare class TimeService extends AbstractDataService<RR0Event> {
6
11
  readonly textBuilder: TimeTextBuilder;
7
- constructor(dataService: AllDataService, textBuilder: TimeTextBuilder);
8
- protected _renderer: TimeRenderer;
9
- get renderer(): TimeRenderer;
10
- getFiles(): Promise<string[]>;
11
- isTimeFile(filePath: string): Promise<boolean>;
12
+ readonly urlBuilder: TimeUrlBuilder;
13
+ readonly renderer: TimeRenderer;
14
+ readonly root: string;
15
+ constructor(dataService: AllDataService, textBuilder: TimeTextBuilder, urlBuilder: TimeUrlBuilder, options: TimeServiceOptions);
16
+ isTimeFile(filePath: string): boolean;
17
+ /**
18
+ * @return the found time URL or undefined if not found.
19
+ */
20
+ matchExistingTimeFile(url: string): string | undefined;
12
21
  }
@@ -1,30 +1,24 @@
1
- import { TimeRenderer } from "./TimeRenderer.js";
1
+ import { TimeRenderer } from "./html/TimeRenderer.js";
2
2
  import { AbstractDataService } from "../data/index.js";
3
- import { glob } from "glob";
4
3
  export class TimeService extends AbstractDataService {
5
- constructor(dataService, textBuilder) {
6
- super(dataService, null);
4
+ constructor(dataService, textBuilder, urlBuilder, options) {
5
+ super(dataService, null, options.files);
7
6
  this.textBuilder = textBuilder;
7
+ this.urlBuilder = urlBuilder;
8
+ this.root = options.root;
9
+ this.renderer = new TimeRenderer(this, this.textBuilder);
8
10
  }
9
- get renderer() {
10
- return this._renderer;
11
+ isTimeFile(filePath) {
12
+ return this.files.includes(filePath);
11
13
  }
12
- async getFiles() {
13
- if (!this.files) {
14
- const minusYearFiles = await glob("time/-?/?/?/?/index.html");
15
- const year1Files = await glob("time/?/index.html");
16
- const year2Files = await glob("time/?/?/index.html");
17
- const year3Files = await glob("time/?/?/?/index.html");
18
- const year4Files = await glob("time/?/?/?/?/index.html");
19
- const monthFiles = await glob("time/?/?/?/?/??/index.html");
20
- const dayFiles = await glob("time/?/?/?/?/??/??/index.html");
21
- const files = this.files = year1Files.concat(year2Files).concat(year3Files).concat(year4Files).concat(minusYearFiles).concat(monthFiles).concat(dayFiles).sort();
22
- this._renderer = new TimeRenderer(files, this.textBuilder);
14
+ /**
15
+ * @return the found time URL or undefined if not found.
16
+ */
17
+ matchExistingTimeFile(url) {
18
+ while (url && url !== this.root && this.files.indexOf(`${url}/index.html`) < 0) {
19
+ const slash = url.lastIndexOf("/");
20
+ url = url.substring(0, slash);
23
21
  }
24
- return this.files;
25
- }
26
- async isTimeFile(filePath) {
27
- const files = await this.getFiles();
28
- return files.includes(filePath);
22
+ return url === this.root ? undefined : url;
29
23
  }
30
24
  }
@@ -0,0 +1,16 @@
1
+ import { TimeElementFactory, TimeService, TimeServiceOptions, TimeTextBuilder, TimeUrlBuilder } from "../time/index.js";
2
+ import { RR0TestUtil } from "../test";
3
+ import { HtmlRR0Context } from "../RR0Context";
4
+ export declare class TimeTestUtil {
5
+ readonly timeTextBuilder: TimeTextBuilder;
6
+ timeElementFactory: TimeElementFactory;
7
+ timeOptions: TimeServiceOptions;
8
+ urlBuilder: TimeUrlBuilder;
9
+ protected timeService: TimeService;
10
+ fullRoot: string;
11
+ constructor(rr0TestUtil: RR0TestUtil);
12
+ newHtmlContext(inputFileName: string, contents?: string): HtmlRR0Context;
13
+ filePath(inputFileName: string): string;
14
+ url(inputFileName: string): string;
15
+ getService(options?: TimeServiceOptions): TimeService;
16
+ }
@@ -0,0 +1,29 @@
1
+ import path from "path";
2
+ import { TimeElementFactory, TimeService, TimeTextBuilder, TimeUrlBuilder } from "../time/index.js";
3
+ import { rr0TestUtil } from "../test";
4
+ export class TimeTestUtil {
5
+ constructor(rr0TestUtil) {
6
+ this.timeOptions = { root: "time", files: [] };
7
+ this.urlBuilder = new TimeUrlBuilder({ rootDir: this.timeOptions.root });
8
+ this.timeTextBuilder = new TimeTextBuilder(rr0TestUtil.intlOptions);
9
+ this.fullRoot = path.join(rr0TestUtil.rootDir, this.timeOptions.root);
10
+ }
11
+ newHtmlContext(inputFileName, contents) {
12
+ return rr0TestUtil.newHtmlContext(this.filePath(inputFileName), contents);
13
+ }
14
+ filePath(inputFileName) {
15
+ return path.join(this.timeOptions.root, inputFileName);
16
+ }
17
+ url(inputFileName) {
18
+ return path.join("/", this.filePath(inputFileName));
19
+ }
20
+ getService(options = this.timeOptions) {
21
+ if (!this.timeService
22
+ || this.timeService.root !== options.root
23
+ || JSON.stringify(this.timeService.files) !== JSON.stringify(options.files)) {
24
+ this.timeService = new TimeService(rr0TestUtil.dataService, this.timeTextBuilder, this.urlBuilder, options);
25
+ this.timeElementFactory = new TimeElementFactory(this.timeService.renderer);
26
+ }
27
+ return this.timeService;
28
+ }
29
+ }
@@ -1,5 +1,9 @@
1
- import { TimeContext } from "./TimeContext.js";
1
+ import { TimeContext } from "@rr0/time";
2
+ export type TimeUrlBuilderOptions = {
3
+ rootDir: string;
4
+ };
2
5
  export declare class TimeUrlBuilder {
3
- static readonly root = "time/";
4
- static fromContext(time: TimeContext): string;
6
+ readonly options: TimeUrlBuilderOptions;
7
+ constructor(options: TimeUrlBuilderOptions);
8
+ fromContext(time: TimeContext): string;
5
9
  }
@@ -1,9 +1,13 @@
1
+ import path from "path";
1
2
  export class TimeUrlBuilder {
2
- static fromContext(time) {
3
- let url = this.root;
3
+ constructor(options) {
4
+ this.options = options;
5
+ }
6
+ fromContext(time) {
7
+ let url = this.options.rootDir;
4
8
  const year = time.getYear();
5
9
  if (year) {
6
- url += year.toString().split("").join("/");
10
+ url = path.join(url, year.toString().split("").join("/"));
7
11
  }
8
12
  let month = time.getMonth();
9
13
  if (month) {
@@ -16,4 +20,3 @@ export class TimeUrlBuilder {
16
20
  return url;
17
21
  }
18
22
  }
19
- TimeUrlBuilder.root = "time/";
@@ -1,5 +1,5 @@
1
1
  import { Datasource } from "./Datasource";
2
- import { HtmlRR0SsgContext } from "../../RR0SsgContext.js";
2
+ import { HtmlRR0Context } from "../../RR0Context.js";
3
3
  import { ContextFilter } from "./ContextFilter.js";
4
4
  /**
5
5
  * Cache cases which were already fetched, and filter out cases in memory according to (time) context.
@@ -9,9 +9,9 @@ export declare abstract class AbstractDatasource<S> implements Datasource<S> {
9
9
  readonly copyright: string;
10
10
  protected readonly cases: Map<string, S[]>;
11
11
  protected constructor(authors: string[], copyright: string);
12
- getCases(context: HtmlRR0SsgContext): Promise<S[]>;
13
- fetch(context: HtmlRR0SsgContext): Promise<S[]>;
14
- protected createFilter(context: HtmlRR0SsgContext): ContextFilter<S>;
15
- protected contextKey(context: HtmlRR0SsgContext): string;
16
- protected abstract readCases(context: HtmlRR0SsgContext): Promise<S[]>;
12
+ getCases(context: HtmlRR0Context): Promise<S[]>;
13
+ fetch(context: HtmlRR0Context): Promise<S[]>;
14
+ protected createFilter(context: HtmlRR0Context): ContextFilter<S>;
15
+ protected contextKey(context: HtmlRR0Context): string;
16
+ protected abstract readCases(context: HtmlRR0Context): Promise<S[]>;
17
17
  }
@@ -1,12 +1,12 @@
1
1
  import { DomReplacement } from "../DomReplacement.js";
2
- import { HtmlRR0SsgContext } from "../../RR0SsgContext.js";
2
+ import { HtmlRR0Context } from "../../RR0Context.js";
3
3
  import { CaseSummaryRenderer } from "../CaseSummaryRenderer.js";
4
4
  import { RR0CaseSummary } from "./rr0/RR0CaseSummary.js";
5
5
  import { RR0CaseMapping } from "./rr0/RR0CaseMapping.js";
6
6
  /**
7
7
  * Replaces a (ul) tag from (chronology) files with case summaries from external datasources.
8
8
  */
9
- export declare class ChronologyReplacer implements DomReplacement<HtmlRR0SsgContext, HTMLUListElement> {
9
+ export declare class ChronologyReplacer implements DomReplacement<HtmlRR0Context, HTMLUListElement> {
10
10
  protected mappings: RR0CaseMapping<any>[];
11
11
  protected renderer: CaseSummaryRenderer;
12
12
  /**
@@ -16,8 +16,8 @@ export declare class ChronologyReplacer implements DomReplacement<HtmlRR0SsgCont
16
16
  */
17
17
  protected readonly done: Set<string>;
18
18
  constructor(mappings: RR0CaseMapping<any>[], renderer: CaseSummaryRenderer);
19
- replacement(context: HtmlRR0SsgContext, element: HTMLUListElement): Promise<HTMLUListElement>;
20
- protected aggregate(context: HtmlRR0SsgContext, element: HTMLUListElement): Promise<void>;
21
- protected aggregateDatasource(mapping: RR0CaseMapping<any>, context: HtmlRR0SsgContext, existingCases: RR0CaseSummary[], casesToAdd: RR0CaseSummary[]): Promise<void>;
22
- protected merge(context: HtmlRR0SsgContext, sourceCases: any[], fetchTime: Date, mapping: RR0CaseMapping<any>, existingCases: RR0CaseSummary[]): RR0CaseSummary[];
19
+ replacement(context: HtmlRR0Context, element: HTMLUListElement): Promise<HTMLUListElement>;
20
+ protected aggregate(context: HtmlRR0Context, element: HTMLUListElement): Promise<void>;
21
+ protected aggregateDatasource(mapping: RR0CaseMapping<any>, context: HtmlRR0Context, existingCases: RR0CaseSummary[], casesToAdd: RR0CaseSummary[]): Promise<void>;
22
+ protected merge(context: HtmlRR0Context, sourceCases: any[], fetchTime: Date, mapping: RR0CaseMapping<any>, existingCases: RR0CaseSummary[]): RR0CaseSummary[];
23
23
  }
@@ -1,6 +1,6 @@
1
1
  import { DomReplacer, ReplacerFactory } from "ssg-api";
2
2
  import { ChronologyReplacer } from "./ChronologyReplacer.js";
3
- import { HtmlRR0SsgContext } from "../../RR0SsgContext.js";
3
+ import { HtmlRR0Context } from "../../RR0Context.js";
4
4
  import { CaseSummaryRenderer } from "../CaseSummaryRenderer.js";
5
5
  import { TimeService } from "../TimeService.js";
6
6
  import { RR0CaseMapping } from "./rr0/RR0CaseMapping.js";
@@ -13,5 +13,5 @@ export declare class ChronologyReplacerFactory implements ReplacerFactory<DomRep
13
13
  *
14
14
  * @param context
15
15
  */
16
- create(context: HtmlRR0SsgContext): Promise<DomReplacer>;
16
+ create(context: HtmlRR0Context): Promise<DomReplacer>;
17
17
  }
@@ -12,7 +12,7 @@ export class ChronologyReplacerFactory {
12
12
  async create(context) {
13
13
  return {
14
14
  replace: async (ul) => {
15
- const isTimeFile = await this.timeService.isTimeFile(context.file.name);
15
+ const isTimeFile = this.timeService.isTimeFile(context.file.name);
16
16
  if (isTimeFile) {
17
17
  ul = await this.replacer.replacement(context, ul);
18
18
  }
@@ -1,12 +1,12 @@
1
1
  import { UfoCaseFilter } from "./UfoCaseFilter.js";
2
- import { RR0SsgContext } from "../../RR0SsgContext.js";
2
+ import { RR0Context } from "../../RR0Context.js";
3
3
  export declare abstract class ContextFilter<T> implements UfoCaseFilter<T> {
4
- protected context: RR0SsgContext;
4
+ protected context: RR0Context;
5
5
  /**
6
6
  * @param context The context to match
7
7
  * @protected
8
8
  */
9
- protected constructor(context: RR0SsgContext);
9
+ protected constructor(context: RR0Context);
10
10
  /**
11
11
  * @param ufoCase
12
12
  * @return if that UFO case matches the filter.
@@ -1,4 +1,4 @@
1
- import { HtmlRR0SsgContext } from "../../RR0SsgContext.js";
1
+ import { HtmlRR0Context } from "../../RR0Context.js";
2
2
  import { Datasource } from "./Datasource.js";
3
3
  import { CsvMapper } from "./CsvMapper.js";
4
4
  import { FileSource } from "./FileSource.js";
@@ -15,5 +15,5 @@ export declare class CsvFileSource<S> extends FileSource {
15
15
  * @protected
16
16
  */
17
17
  fileName(context: HtmlSsgContext, datasource: Datasource<S>): string;
18
- write(context: HtmlRR0SsgContext, datasourceCases: S[], fetchTime: Date, datasource: Datasource<any>): void;
18
+ write(context: HtmlRR0Context, datasourceCases: S[], fetchTime: Date, datasource: Datasource<any>): void;
19
19
  }
@@ -1,12 +1,12 @@
1
1
  import { CaseMapper } from "./CaseMapper.js";
2
- import { RR0SsgContext } from "../../RR0SsgContext.js";
3
- export declare class CsvMapper<S> implements CaseMapper<RR0SsgContext, S, string> {
2
+ import { RR0Context } from "../../RR0Context.js";
3
+ export declare class CsvMapper<S> implements CaseMapper<RR0Context, S, string> {
4
4
  readonly sep: string;
5
5
  readonly escapeStr: string;
6
6
  readonly prefix: string;
7
7
  readonly fields: Set<string>;
8
8
  constructor(sep?: string, escapeStr?: string, prefix?: string);
9
- readonly fieldMapper: (context: RR0SsgContext, key: string, value: any, sourceTime: Date) => string;
9
+ readonly fieldMapper: (context: RR0Context, key: string, value: any, sourceTime: Date) => string;
10
10
  /**
11
11
  * Map a case to a CSV row.
12
12
  *
@@ -14,7 +14,7 @@ export declare class CsvMapper<S> implements CaseMapper<RR0SsgContext, S, string
14
14
  * @param sourceCase
15
15
  * @param sourceTime
16
16
  */
17
- map(context: RR0SsgContext, sourceCase: S, sourceTime: Date): string;
17
+ map(context: RR0Context, sourceCase: S, sourceTime: Date): string;
18
18
  /**
19
19
  * Reduce a set of cases to a CSV string.
20
20
  *
@@ -22,7 +22,7 @@ export declare class CsvMapper<S> implements CaseMapper<RR0SsgContext, S, string
22
22
  * @param sourceCases
23
23
  * @param sourceTime
24
24
  */
25
- mapAll(context: RR0SsgContext, sourceCases: S[], sourceTime: Date): string;
25
+ mapAll(context: RR0Context, sourceCases: S[], sourceTime: Date): string;
26
26
  escape(value: string, force?: boolean): string;
27
27
  /**
28
28
  * Converts CSV contents to a list of cases.
@@ -1,4 +1,4 @@
1
- import { TimeContext } from "../TimeContext.js";
1
+ import { TimeContext } from "@rr0/time";
2
2
  export class CsvMapper {
3
3
  constructor(sep = ",", escapeStr = "\"", prefix = "") {
4
4
  this.sep = sep;
@@ -1,4 +1,4 @@
1
- import { HtmlRR0SsgContext } from "../../RR0SsgContext.js";
1
+ import { HtmlRR0Context } from "../../RR0Context.js";
2
2
  /**
3
3
  * A source for cases.
4
4
  *
@@ -19,5 +19,5 @@ export interface Datasource<S> {
19
19
  * @param context
20
20
  * @return Promise<S[]>
21
21
  */
22
- fetch(context: HtmlRR0SsgContext): Promise<S[]>;
22
+ fetch(context: HtmlRR0Context): Promise<S[]>;
23
23
  }
@@ -1,6 +1,6 @@
1
- import { HtmlRR0SsgContext } from "../../RR0SsgContext.js";
2
- import { TimeContext } from "../TimeContext.js";
3
- import { TimeTextBuilder } from "../TimeTextBuilder.js";
1
+ import { HtmlRR0Context } from "../../RR0Context.js";
2
+ import { TimeContext } from "@rr0/time";
3
+ import { TimeTextBuilder } from "../text/TimeTextBuilder.js";
4
4
  import { Source } from "../../source/index.js";
5
5
  import { RR0CaseMapping } from "./rr0/index.js";
6
6
  export declare abstract class DatasourceTestCase<S> {
@@ -8,11 +8,11 @@ export declare abstract class DatasourceTestCase<S> {
8
8
  readonly sourceCases: S[];
9
9
  protected readonly intlOptions: Intl.DateTimeFormatOptions;
10
10
  timeTextBuilder: TimeTextBuilder;
11
- protected constructor(mapping: RR0CaseMapping<S>, sourceCases: S[]);
12
- checkCaseHTML(context: HtmlRR0SsgContext, nativeCase: S, item: HTMLLIElement, dataDate: Date): void;
13
- testRender(context: HtmlRR0SsgContext): Promise<void>;
14
- testFetch(context: HtmlRR0SsgContext): Promise<void>;
11
+ protected constructor(mapping: RR0CaseMapping<S>, sourceCases: S[], intlOptions?: Intl.DateTimeFormatOptions);
12
+ checkCaseHTML(context: HtmlRR0Context, nativeCase: S, item: HTMLLIElement, dataDate: Date): void;
13
+ testRender(context: HtmlRR0Context): Promise<void>;
14
+ testFetch(context: HtmlRR0Context): Promise<void>;
15
15
  protected abstract sortComparator(c1: S, c2: S): number;
16
16
  protected abstract getTime(c: S): TimeContext;
17
- protected expectedSourceStr(context: HtmlRR0SsgContext, expectedSources: Source[], nativeCase: S): string;
17
+ protected expectedSourceStr(context: HtmlRR0Context, expectedSources: Source[], nativeCase: S): string;
18
18
  }
@@ -1,25 +1,26 @@
1
1
  import { expect } from "@javarome/testscript";
2
2
  import { CaseSummaryRenderer } from "../CaseSummaryRenderer.js";
3
- import { TimeTextBuilder } from "../TimeTextBuilder.js";
3
+ import { TimeTextBuilder } from "../text/TimeTextBuilder.js";
4
4
  import { SourceFactory, SourceRenderer } from "../../source/index.js";
5
5
  import { NoteFileCounter, NoteRenderer } from "../../note/index.js";
6
6
  import { AllDataService } from "../../data/index.js";
7
7
  import { HttpSource } from "./HttpSource.js";
8
- import { TimeElementFactory } from "../TimeElementFactory.js";
9
- import { TimeRenderer } from "../TimeRenderer.js";
8
+ import { TimeElementFactory } from "../html/TimeElementFactory.js";
9
+ import { TimeRenderer } from "../html/TimeRenderer.js";
10
+ import { rr0TestUtil } from "../../test";
10
11
  export class DatasourceTestCase {
11
- constructor(mapping, sourceCases) {
12
+ constructor(mapping, sourceCases, intlOptions = {
13
+ year: "numeric",
14
+ month: "long",
15
+ day: "numeric",
16
+ weekday: "long",
17
+ hour: "2-digit",
18
+ minute: "2-digit",
19
+ timeZoneName: "short"
20
+ }) {
12
21
  this.mapping = mapping;
13
22
  this.sourceCases = sourceCases;
14
- this.intlOptions = {
15
- year: "numeric",
16
- month: "long",
17
- day: "numeric",
18
- weekday: "long",
19
- hour: "2-digit",
20
- minute: "2-digit",
21
- timeZoneName: "short"
22
- };
23
+ this.intlOptions = intlOptions;
23
24
  this.timeTextBuilder = new TimeTextBuilder(this.intlOptions);
24
25
  }
25
26
  checkCaseHTML(context, nativeCase, item, dataDate) {
@@ -27,7 +28,7 @@ export class DatasourceTestCase {
27
28
  const time = this.getTime(nativeCase);
28
29
  const caseContext = context.clone();
29
30
  Object.assign(caseContext, { time });
30
- const timeStr = this.timeTextBuilder.build(caseContext);
31
+ const timeStr = this.timeTextBuilder.build(caseContext, true);
31
32
  const placeStr = expected.place ? ` À <span class="place">${expected.place.name}</span>` : "";
32
33
  const expectedSources = expected.sources;
33
34
  const sourceStr = (expectedSources === null || expectedSources === void 0 ? void 0 : expectedSources.length) > 0 ? this.expectedSourceStr(context, expectedSources, nativeCase) : "";
@@ -41,7 +42,8 @@ export class DatasourceTestCase {
41
42
  const baseUrl = "https://rr0.org";
42
43
  const http = new HttpSource();
43
44
  const sourceFactory = new SourceFactory(dataService, http, baseUrl, this.intlOptions);
44
- const timeElementFactory = new TimeElementFactory(new TimeRenderer([], this.timeTextBuilder));
45
+ const timeService = await rr0TestUtil.time.getService();
46
+ const timeElementFactory = new TimeElementFactory(new TimeRenderer(timeService, this.timeTextBuilder));
45
47
  const eventRenderer = new CaseSummaryRenderer(new NoteRenderer(new NoteFileCounter()), sourceFactory, new SourceRenderer(this.timeTextBuilder), timeElementFactory);
46
48
  const items = [];
47
49
  for (const c of cases) {
@@ -67,7 +69,7 @@ export class DatasourceTestCase {
67
69
  const source = expectedSources[0];
68
70
  const sourceContext = context.clone();
69
71
  sourceContext.time = source.publication.time;
70
- const publicationStr = source.publication ? `, ${this.timeTextBuilder.build(sourceContext)}` : "";
72
+ const publicationStr = source.publication ? `, ${this.timeTextBuilder.build(sourceContext, true)}` : "";
71
73
  const indexStr = source.index ? `, ${source.index}` : "";
72
74
  const authorStr = datasource.authors.map(authorStr => `<span class="people">${authorStr}</span>`).join(" &amp; ");
73
75
  const title = `cas n° ${nativeCase["id"]}`;
@@ -1,5 +1,5 @@
1
- import { HtmlRR0SsgContext } from "../../RR0SsgContext.js";
1
+ import { HtmlRR0Context } from "../../RR0Context.js";
2
2
  import { Datasource } from "./Datasource.js";
3
3
  export interface FileDatasource<S> extends Datasource<S> {
4
- save(context: HtmlRR0SsgContext, fetched: any[], fetchTime: Date): void;
4
+ save(context: HtmlRR0Context, fetched: any[], fetchTime: Date): void;
5
5
  }
@@ -1,12 +1,12 @@
1
1
  import { CaseMapper } from "./CaseMapper.js";
2
- import { RR0SsgContext } from "../../RR0SsgContext.js";
3
- export declare class JsonMapper<S> implements CaseMapper<RR0SsgContext, S, Object> {
4
- map(context: RR0SsgContext, sourceCase: S, sourceTime: Date): Object;
2
+ import { RR0Context } from "../../RR0Context.js";
3
+ export declare class JsonMapper<S> implements CaseMapper<RR0Context, S, Object> {
4
+ map(context: RR0Context, sourceCase: S, sourceTime: Date): Object;
5
5
  /**
6
6
  * Converts CSV contents to a list of cases.
7
7
  *
8
8
  * @param context
9
9
  * @param data
10
10
  */
11
- parse(context: RR0SsgContext, data: string): S[];
11
+ parse(context: RR0Context, data: string): S[];
12
12
  }
@@ -1,10 +1,10 @@
1
1
  import { ContextFilter } from "./ContextFilter.js";
2
- import { RR0SsgContext } from "../../RR0SsgContext.js";
3
- import { TimeContext } from "../TimeContext.js";
2
+ import { RR0Context } from "../../RR0Context.js";
3
+ import { TimeContext } from "@rr0/time";
4
4
  export interface TimeContextCase {
5
5
  time?: TimeContext;
6
6
  }
7
7
  export declare class TimeContextFilter<S extends TimeContextCase> extends ContextFilter<S> {
8
- constructor(context: RR0SsgContext);
8
+ constructor(context: RR0Context);
9
9
  filter(c: S): boolean;
10
10
  }
@@ -1,4 +1,4 @@
1
- import { TimeContext } from "../../TimeContext.js";
1
+ import { TimeContext } from "@rr0/time";
2
2
  import { City } from "../../../org/country/region/department/city/City.js";
3
3
  export type AcufoCaseDataTime = {
4
4
  dateTime: TimeContext;
@@ -1,4 +1,4 @@
1
- import { RR0SsgContext } from "../../../RR0SsgContext.js";
1
+ import { RR0Context } from "../../../RR0Context.js";
2
2
  import { HttpSource } from "../HttpSource.js";
3
3
  import { AcufoCase } from "./AcufoCase.js";
4
4
  import { AbstractDatasource } from "../AbstractDatasource.js";
@@ -7,6 +7,6 @@ export declare class AcufoDatasource extends AbstractDatasource<AcufoCase> {
7
7
  readonly searchPath: string;
8
8
  protected http: HttpSource;
9
9
  constructor(baseUrl?: string, searchPath?: string);
10
- protected readCases(context: RR0SsgContext): Promise<AcufoCase[]>;
11
- protected getNativeCase(context: RR0SsgContext, row: Element): AcufoCase;
10
+ protected readCases(context: RR0Context): Promise<AcufoCase[]>;
11
+ protected getNativeCase(context: RR0Context, row: Element): AcufoCase;
12
12
  }
@@ -1,4 +1,4 @@
1
- import { TimeContext } from "../../TimeContext.js";
1
+ import { TimeContext } from "@rr0/time";
2
2
  export declare enum BaseOvniFranceTypeObservation {
3
3
  visualClose = "Visuel : proche",
4
4
  visualFar = "Visuel : Eloign\u00E9"