@rr0/cms 0.3.9 → 0.3.11

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 CHANGED
@@ -76,7 +76,8 @@ export class RR0Build {
76
76
  const apiFactory = new APIFactory(eventFactory);
77
77
  const bookFactory = new TypedDataFactory(eventFactory, "book");
78
78
  const articleFactory = new TypedDataFactory(eventFactory, "article");
79
- const dataService = this.dataService = new AllDataService([orgFactory, caseFactory, peopleFactory, bookFactory, articleFactory, sightingFactory, apiFactory]);
79
+ const factories = [orgFactory, caseFactory, peopleFactory, bookFactory, articleFactory, sightingFactory, apiFactory];
80
+ const dataService = this.dataService = new AllDataService(factories);
80
81
  dataService.getFromDir("", ["people", "case"]).then(data => {
81
82
  console.debug(data);
82
83
  });
@@ -7,7 +7,7 @@ export class TimeContextFilter extends ContextFilter {
7
7
  var _a, _b, _c;
8
8
  const sightingTime = c.time;
9
9
  const time = this.context.time;
10
- if (time) {
10
+ if (time && sightingTime) {
11
11
  const day = time.getDayOfMonth();
12
12
  const month = time.getMonth();
13
13
  const year = time.getYear();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { beforeEach, describe, expect, test } from "@javarome/testscript";
2
+ import { TimeContextFilter } from "./TimeContextFilter";
3
+ import { rr0TestUtil } from "../../test";
4
+ describe("TimeContextFilter", () => {
5
+ let context;
6
+ beforeEach(() => {
7
+ context = rr0TestUtil.time.newHtmlContext("1/9/7/0/03/index.html");
8
+ context.time.setYear(1970);
9
+ context.time.setMonth(3);
10
+ });
11
+ test("test", async () => {
12
+ const filter = new TimeContextFilter(context);
13
+ expect(filter.filter({})).toBe(true);
14
+ });
15
+ });
@@ -8,7 +8,7 @@ export class RR0Datasource extends AbstractDatasource {
8
8
  }
9
9
  static id(dateTime, place) {
10
10
  var _a;
11
- return `${(dateTime === null || dateTime === void 0 ? void 0 : dateTime.toString()) || ("rr0-" + this.idCount++)}$${((_a = place === null || place === void 0 ? void 0 : place.toString()) !== null && _a !== void 0 ? _a : "")}`;
11
+ return `${(dateTime === null || dateTime === void 0 ? void 0 : dateTime.toString()) || ("rr0-" + ++this.idCount)}$${((_a = place === null || place === void 0 ? void 0 : place.toString()) !== null && _a !== void 0 ? _a : "")}`;
12
12
  }
13
13
  }
14
14
  RR0Datasource.idCount = 0;
@@ -88,5 +88,6 @@ describe("RR0CaseSource", () => {
88
88
  test("id", async () => {
89
89
  expect(RR0Datasource.id(EdtfDate.fromString("1972-08-12"), new NamedPlace("Chatillon"))).toBe("1972-08-12$Chatillon");
90
90
  expect(RR0Datasource.id(EdtfDate.fromString("1972-08-12"), undefined)).toBe("1972-08-12$");
91
+ expect(RR0Datasource.id(undefined, undefined)).toBe("rr0-1$");
91
92
  });
92
93
  });
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.9",
5
+ "version": "0.3.11",
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.8",
33
+ "@rr0/data": "^0.3.9",
34
34
  "@rr0/lang": "^0.1.12",
35
35
  "@rr0/place": "^0.5.2",
36
36
  "@rr0/time": "^0.10.0",