@rr0/cms 0.3.5 → 0.3.6

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.
@@ -8,4 +8,5 @@ export declare class CmsOrganization<M extends TitleMessage = OrganizationMessag
8
8
  get parent(): CmsOrganization | undefined;
9
9
  getMessages(context: RR0Context): M;
10
10
  getTitle(context: RR0Context, options?: OrganizationMessageOptions): string;
11
+ toString(): string;
11
12
  }
@@ -27,4 +27,7 @@ export class CmsOrganization extends Organization {
27
27
  }
28
28
  return str;
29
29
  }
30
+ toString() {
31
+ return this.kind + "$" + this.id;
32
+ }
30
33
  }
@@ -3,4 +3,5 @@ import { Place } from "@rr0/place";
3
3
  export declare class OrganizationPlace extends Place {
4
4
  readonly org: CmsOrganization;
5
5
  constructor(org: CmsOrganization);
6
+ toString(): string;
6
7
  }
@@ -5,4 +5,8 @@ export class OrganizationPlace extends Place {
5
5
  this.org = org;
6
6
  Object.assign(this, org.places[0]);
7
7
  }
8
+ toString() {
9
+ var _a, _b;
10
+ return (_b = (_a = this.org) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : super.toString();
11
+ }
8
12
  }
@@ -7,8 +7,8 @@ export class RR0Datasource extends AbstractDatasource {
7
7
  super(["Beau, Jérôme"], "RR0");
8
8
  }
9
9
  static id(dateTime, place) {
10
- const placeStr = place ? "$" + `${place.id || place.name}` : "";
11
- return `${dateTime.toString()}${placeStr}`;
10
+ var _a;
11
+ return `${dateTime.toString()}$${((_a = place === null || place === void 0 ? void 0 : place.toString()) !== null && _a !== void 0 ? _a : "")}`;
12
12
  }
13
13
  }
14
14
  RR0Datasource.placeRegex = /^(.+?)(?:\s*\((.+?)(?:\s*,\s*(.+?)(?:\s*,\s*(.+?)))?\))?$/g;
@@ -9,6 +9,8 @@ import { TimeTextBuilder } from "../../text/TimeTextBuilder.js";
9
9
  import { RR0CaseSummaryMapper } from "./RR0CaseSummaryMapper";
10
10
  import { RR0FileDatasource } from "./RR0FileDatasource";
11
11
  import { NamedPlace } from "@rr0/place";
12
+ import { OrganizationPlace } from "../../../place/OrganizationPlace";
13
+ import { parisCity } from "../../../org/eu/fr/region/idf/75/paris/Paris";
12
14
  export class RR0TestDatasource extends RR0Datasource {
13
15
  constructor() {
14
16
  super();
@@ -86,7 +88,8 @@ describe("RR0CaseSource", () => {
86
88
  await testCase.testRender(context);
87
89
  });
88
90
  test("id", async () => {
89
- const id = RR0Datasource.id(EdtfDate.fromString("1972-08-12"), new NamedPlace("Chatillon"));
90
- expect(id).toBe("1972-08-12$Chatillon");
91
+ expect(RR0Datasource.id(EdtfDate.fromString("1972-08-12"), new NamedPlace("Chatillon"))).toBe("1972-08-12$Chatillon");
92
+ expect(RR0Datasource.id(EdtfDate.fromString("1972-08-12"), new OrganizationPlace(parisCity))).toBe("1972-08-12$city$75000");
93
+ expect(RR0Datasource.id(EdtfDate.fromString("1972-08-12"), undefined)).toBe("1972-08-12$");
91
94
  });
92
95
  });
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",
5
+ "version": "0.3.6",
6
6
  "description": "RR0 Content Management System (CMS)",
7
7
  "exports": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
@@ -30,9 +30,9 @@
30
30
  "dependencies": {
31
31
  "@javarome/fileutil": "^0.3.6",
32
32
  "@rr0/common": "^1.1.3",
33
- "@rr0/data": "^0.3.5",
33
+ "@rr0/data": "^0.3.6",
34
34
  "@rr0/lang": "^0.1.12",
35
- "@rr0/place": "^0.5.1",
35
+ "@rr0/place": "^0.5.2",
36
36
  "@rr0/time": "^0.10.0",
37
37
  "canvas": "^2.11.2",
38
38
  "csv-parser": "^3.0.0",