@dative-gpi/foundation-shared-domain 1.0.128 → 1.0.130-maps2

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.
@@ -1,4 +1,4 @@
1
- import { isoToEpoch } from "../../tools";
1
+ import { isoToEpoch } from "../../tools/datesTools";
2
2
 
3
3
  export class AuthTokenInfos {
4
4
  id: string;
@@ -1,7 +1,6 @@
1
1
  import { ImageInfos, type ImageInfosDTO } from "./imageInfos";
2
2
 
3
3
  export class ImageDetails extends ImageInfos {
4
-
5
4
  constructor(params: ImageDetailsDTO) {
6
5
  super(params);
7
6
  }
@@ -1,5 +1,7 @@
1
- import { type Criticity, type MessageType, type Scope } from "@dative-gpi/foundation-shared-domain/enums";
2
- import { isoToEpoch } from "@dative-gpi/foundation-shared-domain/tools";
1
+ import { type MessageType } from "../../enums/messages";
2
+ import { isoToEpoch } from "../../tools/datesTools";
3
+ import { Scope } from "../../enums/applications";
4
+ import { Criticity } from "../../enums/alerts";
3
5
 
4
6
  export class NotificationInfos {
5
7
  id: string;
@@ -32,6 +34,43 @@ export class NotificationInfos {
32
34
  this.acknowledgingTimestamp = params.acknowledgingTimestamp ?
33
35
  isoToEpoch(params.acknowledgingTimestamp) : null;
34
36
  }
37
+
38
+ static getFromAudience = (
39
+ notifications: NotificationInfos[],
40
+ application: boolean,
41
+ criticity: Criticity,
42
+ organisationId?: string | null,
43
+ userId?: string | null,
44
+ ): NotificationInfos[] => notifications.filter((n: NotificationInfos) => {
45
+ if (n.acknowledged) {
46
+ return false;
47
+ }
48
+ if (![Criticity.None, n.criticity].includes(criticity)) {
49
+ return false;
50
+ }
51
+ switch (n.audienceScope) {
52
+ case Scope.Organisation :
53
+ case Scope.UserOrganisation: return organisationId && n.organisationId && n.organisationId === organisationId;
54
+ case Scope.User : return userId && n.audienceId === userId;
55
+ case Scope.Application :
56
+ case Scope.Public : return application;
57
+
58
+ }
59
+ return false;
60
+ });
61
+
62
+ static getForDrawer = (
63
+ notifications: NotificationInfos[],
64
+ organisationId: string,
65
+ userId: string,
66
+ criticity: Criticity = Criticity.None
67
+ ): NotificationInfos[] => NotificationInfos.getFromAudience(notifications, true, criticity, organisationId, userId);
68
+
69
+ static getForCard = (
70
+ notifications: NotificationInfos[],
71
+ organisationId: string,
72
+ criticity: Criticity = Criticity.None
73
+ ): NotificationInfos[] => NotificationInfos.getFromAudience(notifications, false, criticity, organisationId, null);
35
74
  }
36
75
 
37
76
  export interface NotificationInfosDTO {
@@ -1,4 +1,4 @@
1
- import { isoToEpoch } from "../../tools";
1
+ import { isoToEpoch } from "../../tools/datesTools";
2
2
 
3
3
  export class TerminalInfos {
4
4
  id: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-domain",
3
3
  "sideEffects": false,
4
- "version": "1.0.128",
4
+ "version": "1.0.130-maps2",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -12,5 +12,5 @@
12
12
  "peerDependencies": {
13
13
  "date-fns": "^3.6.0"
14
14
  },
15
- "gitHead": "ca2de0b5abd0fb4f1fdfaafbc4267182ab609336"
15
+ "gitHead": "a0739b48282166f721cf6c2376a430e4690d92ef"
16
16
  }
@@ -7,6 +7,10 @@ export const OPTIONS: { [key: string]: Intl.DateTimeFormatOptions } = {
7
7
  day: "2-digit",
8
8
  month: "long"
9
9
  },
10
+ dayMonthShortOnly: {
11
+ day: "2-digit",
12
+ month: "2-digit"
13
+ },
10
14
  shortDate: {
11
15
  day: "2-digit",
12
16
  month: "2-digit",
@@ -18,6 +22,12 @@ export const OPTIONS: { [key: string]: Intl.DateTimeFormatOptions } = {
18
22
  month: "long",
19
23
  year: "numeric"
20
24
  },
25
+ monthShortTime: {
26
+ day: "2-digit",
27
+ month: "2-digit",
28
+ hour: "2-digit",
29
+ minute: "2-digit"
30
+ },
21
31
  shortTime: {
22
32
  day: "2-digit",
23
33
  month: "2-digit",
package/tools/index.ts CHANGED
@@ -1,6 +1,4 @@
1
1
  export * from "./autoRefresh";
2
2
  export * from "./datesTools";
3
- export * from "./deviceExplorerElements";
4
3
  export * from "./enumTools";
5
- export * from "./notificationsTools";
6
4
  export * from "./single";
@@ -1,34 +0,0 @@
1
- import { type DeviceExplorerElementInfos, type DeviceOrganisationInfos, type GroupInfos } from "@dative-gpi/foundation-core-domain/models";
2
-
3
- import { DeviceExplorerElementType } from "../enums";
4
-
5
- export const fromDeviceOrganisation = (deviceOrganisation: DeviceOrganisationInfos): DeviceExplorerElementInfos => ({
6
- ...deviceOrganisation,
7
- type: DeviceExplorerElementType.DeviceOrganisation,
8
- parentId: deviceOrganisation.groupId,
9
- icon: null,
10
- groupsIds: null,
11
- deviceOrganisationsIds: null,
12
- modelsIds: null,
13
- recursiveGroupsIds: null,
14
- recursiveDeviceOrganisationsIds: null,
15
- recursiveModelsIds: null
16
- });
17
-
18
- export const fromGroup = (group: GroupInfos): DeviceExplorerElementInfos => ({
19
- ...group,
20
- type: DeviceExplorerElementType.Group,
21
- manufacturerLabel: null,
22
- articleLabel: null,
23
- modelLabel: null,
24
- ownerLabel: null,
25
- managerName: null,
26
- unrestricted: null,
27
- online: null,
28
- meta: null,
29
- modelStatuses: null,
30
- status: null,
31
- connectivity: null,
32
- alerts: null,
33
- worstAlert: null
34
- });
@@ -1,39 +0,0 @@
1
- import { type NotificationInfos } from "../models";
2
- import { Criticity, Scope } from "../enums";
3
-
4
- export const getFromAudience = (
5
- notifications: NotificationInfos[],
6
- application: boolean,
7
- criticity: Criticity,
8
- organisationId?: string | null,
9
- userId?: string | null,
10
- ): NotificationInfos[] => notifications.filter((n: NotificationInfos) => {
11
- if (n.acknowledged) {
12
- return false;
13
- }
14
- if (![Criticity.None, n.criticity].includes(criticity)) {
15
- return false;
16
- }
17
- switch (n.audienceScope) {
18
- case Scope.Organisation :
19
- case Scope.UserOrganisation: return organisationId && n.organisationId && n.organisationId === organisationId;
20
- case Scope.User : return userId && n.audienceId === userId;
21
- case Scope.Application :
22
- case Scope.Public : return application;
23
-
24
- }
25
- return false;
26
- });
27
-
28
- export const getForDrawer = (
29
- notifications: NotificationInfos[],
30
- organisationId: string,
31
- userId: string,
32
- criticity: Criticity = Criticity.None
33
- ): NotificationInfos[] => getFromAudience(notifications, true, criticity, organisationId, userId);
34
-
35
- export const getForCard = (
36
- notifications: NotificationInfos[],
37
- organisationId: string,
38
- criticity: Criticity = Criticity.None
39
- ): NotificationInfos[] => getFromAudience(notifications, false, criticity, organisationId, null);