@communecter/cocolight-api-client 1.0.105 → 1.0.106

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@communecter/cocolight-api-client",
3
- "version": "1.0.105",
3
+ "version": "1.0.106",
4
4
  "description": "Client Axios simplifié pour l'API cocolight",
5
5
  "repository": {
6
6
  "type": "git",
@@ -2211,7 +2211,7 @@ export class BaseEntity<TServerData = any> {
2211
2211
 
2212
2212
  // Pour les events : chercher dans organizer avec priorité project > organization > user
2213
2213
  if (entity.getEntityType() === "events") {
2214
- const eventData = serverData as { organizer?: Record<string, { type: string; name?: string }> };
2214
+ const eventData = serverData as { organizer?: Record<string, { type: string; name?: string; id?: string; slug?: string; _id?: any }> };
2215
2215
  if (eventData.organizer) {
2216
2216
  const organizers = Object.entries(eventData.organizer);
2217
2217
 
@@ -41,6 +41,9 @@ export type CollectionType = "citoyens" | "organizations" | "projects" | "events
41
41
  export interface EntityRef {
42
42
  type: string;
43
43
  name?: string;
44
+ id?: string;
45
+ slug?: string;
46
+ _id?: any;
44
47
  }
45
48
 
46
49
  export type EntityRefsMap = Record<string, EntityRef>;
@@ -11,6 +11,9 @@ export interface ParentData {
11
11
  [key: string]: {
12
12
  type?: string;
13
13
  name?: string;
14
+ id?: string;
15
+ slug?: string;
16
+ _id?: any;
14
17
  };
15
18
  }
16
19
 
@@ -18,6 +21,9 @@ export interface OrganizerData {
18
21
  [key: string]: {
19
22
  type?: string;
20
23
  name?: string;
24
+ id?: string;
25
+ slug?: string;
26
+ _id?: any;
21
27
  };
22
28
  }
23
29
 
@@ -81,8 +87,8 @@ export type EntityTransforms = EventTransforms | UserTransforms | OrganizationTr
81
87
  /**
82
88
  * Fonction helper pour créer des transforms d'entité avec type safety
83
89
  */
84
- export function createEntityRef(type: string, name?: string) {
85
- return { type, name };
90
+ export function createEntityRef(type: string, name?: string, id?: string, slug?: string, _id?: any) {
91
+ return { type, name, id, slug, _id };
86
92
  }
87
93
 
88
94
  /**
@@ -94,10 +100,13 @@ export function transformEntityRefs(val: ParentData | OrganizerData | null): Ent
94
100
  return Object.fromEntries(
95
101
  Object.entries(val).map(([key, obj]) => [
96
102
  key,
97
- createEntityRef(
98
- obj?.type ?? "",
99
- obj?.name ?? undefined
100
- )
103
+ {
104
+ type: obj?.type ?? "",
105
+ name: obj?.name,
106
+ id: obj?.id,
107
+ slug: obj?.slug
108
+ // _id exclu volontairement
109
+ }
101
110
  ])
102
111
  );
103
112
  }
@@ -106,5 +115,5 @@ export function transformEntityRefs(val: ParentData | OrganizerData | null): Ent
106
115
  * Fonction helper pour extraire les données de réseaux sociaux
107
116
  */
108
117
  export function createSocialTransform(field: keyof SocialNetworkData): TransformFunction<any, string | undefined> {
109
- return (val: any, full?: any) => full?.socialNetwork?.[field];
118
+ return (_val: any, full?: any) => full?.socialNetwork?.[field];
110
119
  }
@@ -40,6 +40,9 @@ export type CollectionType = "citoyens" | "organizations" | "projects" | "events
40
40
  export interface EntityRef {
41
41
  type: string;
42
42
  name?: string;
43
+ id?: string;
44
+ slug?: string;
45
+ _id?: any;
43
46
  }
44
47
  export type EntityRefsMap = Record<string, EntityRef>;
45
48
  /**
@@ -7,12 +7,18 @@ export interface ParentData {
7
7
  [key: string]: {
8
8
  type?: string;
9
9
  name?: string;
10
+ id?: string;
11
+ slug?: string;
12
+ _id?: any;
10
13
  };
11
14
  }
12
15
  export interface OrganizerData {
13
16
  [key: string]: {
14
17
  type?: string;
15
18
  name?: string;
19
+ id?: string;
20
+ slug?: string;
21
+ _id?: any;
16
22
  };
17
23
  }
18
24
  export type SocialNetworkData = SocialNetworkPayload;
@@ -65,9 +71,12 @@ export type EntityTransforms = EventTransforms | UserTransforms | OrganizationTr
65
71
  /**
66
72
  * Fonction helper pour créer des transforms d'entité avec type safety
67
73
  */
68
- export declare function createEntityRef(type: string, name?: string): {
74
+ export declare function createEntityRef(type: string, name?: string, id?: string, slug?: string, _id?: any): {
69
75
  type: string;
70
76
  name: string | undefined;
77
+ id: string | undefined;
78
+ slug: string | undefined;
79
+ _id: any;
71
80
  };
72
81
  /**
73
82
  * Fonction helper pour transformer les données parent/organizer