@communecter/cocolight-api-client 1.0.98 → 1.0.100

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.98",
3
+ "version": "1.0.100",
4
4
  "description": "Client Axios simplifié pour l'API cocolight",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +1,6 @@
1
1
  import { ApiError } from "../error.js";
2
2
  import { BaseEntity } from "./BaseEntity.js";
3
+ import { createSocialTransform } from "../types/transforms.js";
3
4
 
4
5
  import type { PaginatorPage } from "./BaseEntity.js";
5
6
  import type {
@@ -115,15 +116,15 @@ export class Organization extends BaseEntity<OrganizationItemNormalized> {
115
116
  // role = admin c'est bizarre car en faite c'est gérer dans links sur user et l'orga
116
117
  // links.members.${this.userId}.isAdmin === true
117
118
  override transforms: Record<string, (val: any, full: any) => any> = {
118
- github: (val: any, full: any) => full?.socialNetwork?.github,
119
- gitlab: (val: any, full: any) => full?.socialNetwork?.gitlab,
120
- facebook: (val: any, full: any) => full?.socialNetwork?.facebook,
121
- twitter: (val: any, full: any) => full?.socialNetwork?.twitter,
122
- instagram: (val: any, full: any) => full?.socialNetwork?.instagram,
123
- diaspora: (val: any, full: any) => full?.socialNetwork?.diaspora,
124
- mastodon: (val: any, full: any) => full?.socialNetwork?.mastodon,
125
- telegram: (val: any, full: any) => full?.socialNetwork?.telegram,
126
- signal: (val: any, full: any) => full?.socialNetwork?.signal
119
+ github: createSocialTransform("github"),
120
+ gitlab: createSocialTransform("gitlab"),
121
+ facebook: createSocialTransform("facebook"),
122
+ twitter: createSocialTransform("twitter"),
123
+ instagram: createSocialTransform("instagram"),
124
+ diaspora: createSocialTransform("diaspora"),
125
+ mastodon: createSocialTransform("mastodon"),
126
+ telegram: createSocialTransform("telegram"),
127
+ signal: createSocialTransform("signal")
127
128
  };
128
129
 
129
130
  override _add = async (payload: Record<string, any>): Promise<void> => {
package/src/api/User.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ApiError } from "../error.js";
2
2
  import { BaseEntity } from "./BaseEntity.js";
3
3
  import { UserMixin } from "../mixin/UserMixin.js";
4
+ import { createSocialTransform } from "../types/transforms.js";
4
5
 
5
6
  import type { Badge } from "./Badge.js";
6
7
  import type { PaginatorPage } from "./BaseEntity.js";
@@ -68,27 +69,17 @@ export class User extends BaseEntity<UserItemNormalized> {
68
69
  "typeElement",
69
70
  ];
70
71
 
71
- override transforms: {
72
- github: (val: any, full: any) => any;
73
- gitlab: (val: any, full: any) => any;
74
- facebook: (val: any, full: any) => any;
75
- twitter: (val: any, full: any) => any;
76
- instagram: (val: any, full: any) => any;
77
- diaspora: (val: any, full: any) => any;
78
- mastodon: (val: any, full: any) => any;
79
- telegram: (val: any, full: any) => any;
80
- signal: (val: any, full: any) => any;
81
- } = {
82
- github: (val, full) => full?.socialNetwork?.github,
83
- gitlab: (val, full) => full?.socialNetwork?.gitlab,
84
- facebook: (val, full) => full?.socialNetwork?.facebook,
85
- twitter: (val, full) => full?.socialNetwork?.twitter,
86
- instagram: (val, full) => full?.socialNetwork?.instagram,
87
- diaspora: (val, full) => full?.socialNetwork?.diaspora,
88
- mastodon: (val, full) => full?.socialNetwork?.mastodon,
89
- telegram: (val, full) => full?.socialNetwork?.telegram,
90
- signal: (val, full) => full?.socialNetwork?.signal
91
- };
72
+ override transforms: Record<string, (val: any, full: any) => any> = {
73
+ github: createSocialTransform("github"),
74
+ gitlab: createSocialTransform("gitlab"),
75
+ facebook: createSocialTransform("facebook"),
76
+ twitter: createSocialTransform("twitter"),
77
+ instagram: createSocialTransform("instagram"),
78
+ diaspora: createSocialTransform("diaspora"),
79
+ mastodon: createSocialTransform("mastodon"),
80
+ telegram: createSocialTransform("telegram"),
81
+ signal: createSocialTransform("signal")
82
+ };
92
83
 
93
84
  /**
94
85
  * Crée une instance de `User`.
@@ -74,6 +74,8 @@ export interface EventItemJson {
74
74
  profilThumbImageUrl?: string;
75
75
  profilMarkerImageUrl?: string;
76
76
  timeZone?: string;
77
+ email?: string;
78
+ url?: string;
77
79
  [key: string]: unknown;
78
80
  }
79
81
 
@@ -104,5 +106,7 @@ export interface EventItemNormalized {
104
106
  profilThumbImageUrl?: string;
105
107
  profilMarkerImageUrl?: string;
106
108
  timeZone?: string;
109
+ email?: string;
110
+ url?: string;
107
111
  [key: string]: unknown;
108
112
  }
@@ -9,7 +9,8 @@ import type {
9
9
  OpeningHoursEntry,
10
10
  ParentsMap,
11
11
  PostalAddress,
12
- DateValue
12
+ DateValue,
13
+ SocialNetwork
13
14
  } from "./common.js";
14
15
  import type EJSONType from "../../EJSONType.js";
15
16
 
@@ -61,6 +62,8 @@ export interface OrganizationItemJson {
61
62
  profilThumbImageUrl?: string;
62
63
  profilMarkerImageUrl?: string;
63
64
  email?: string;
65
+ url?: string;
66
+ socialNetwork?: SocialNetwork;
64
67
  [key: string]: unknown;
65
68
  }
66
69
 
@@ -89,5 +92,7 @@ export interface OrganizationItemNormalized {
89
92
  profilThumbImageUrl?: string;
90
93
  profilMarkerImageUrl?: string;
91
94
  email?: string;
95
+ url?: string;
96
+ socialNetwork?: SocialNetwork;
92
97
  [key: string]: unknown;
93
98
  }
@@ -46,6 +46,8 @@ export interface PoiItemJson {
46
46
  profilMediumImageUrl?: string;
47
47
  profilThumbImageUrl?: string;
48
48
  profilMarkerImageUrl?: string;
49
+ email?: string;
50
+ url?: string;
49
51
  [key: string]: unknown;
50
52
  }
51
53
 
@@ -71,5 +73,7 @@ export interface PoiItemNormalized {
71
73
  profilMediumImageUrl?: string;
72
74
  profilThumbImageUrl?: string;
73
75
  profilMarkerImageUrl?: string;
76
+ email?: string;
77
+ url?: string;
74
78
  [key: string]: unknown;
75
79
  }
@@ -7,7 +7,8 @@ import type {
7
7
  LinkEventsRef,
8
8
  ParentsMap,
9
9
  PostalAddress,
10
- DateValue
10
+ DateValue,
11
+ SocialNetwork
11
12
  } from "./common.js";
12
13
  import type EJSONType from "../../EJSONType.js";
13
14
 
@@ -61,6 +62,9 @@ export interface ProjectItemJson {
61
62
  profilMediumImageUrl?: string;
62
63
  profilThumbImageUrl?: string;
63
64
  profilMarkerImageUrl?: string;
65
+ socialNetwork?: SocialNetwork;
66
+ email?: string;
67
+ url?: string;
64
68
  [key: string]: unknown;
65
69
  }
66
70
 
@@ -87,5 +91,8 @@ export interface ProjectItemNormalized {
87
91
  profilMediumImageUrl?: string;
88
92
  profilThumbImageUrl?: string;
89
93
  profilMarkerImageUrl?: string;
94
+ socialNetwork?: SocialNetwork;
95
+ email?: string;
96
+ url?: string;
90
97
  [key: string]: unknown;
91
98
  }
@@ -9,7 +9,8 @@ import type {
9
9
  LinkFollowsUserRef,
10
10
  LinkFollowersUserRef,
11
11
  PostalAddress,
12
- DateValue
12
+ DateValue,
13
+ SocialNetwork
13
14
  } from "./common.js";
14
15
  import type EJSONType from "../../EJSONType.js";
15
16
 
@@ -68,6 +69,10 @@ export interface UserItemJson {
68
69
  profilBannerUrl?: string;
69
70
  profilRealBannerUrl?: string;
70
71
  preferences?: UserPreferences;
72
+ socialNetwork?: SocialNetwork;
73
+ fixe?: string;
74
+ mobile?: string;
75
+ url?: string;
71
76
  [key: string]: unknown;
72
77
  }
73
78
 
@@ -99,5 +104,9 @@ export interface UserItemNormalized {
99
104
  profilBannerUrl?: string;
100
105
  profilRealBannerUrl?: string;
101
106
  preferences?: UserPreferences;
107
+ socialNetwork?: SocialNetwork;
108
+ fixe?: string;
109
+ mobile?: string;
110
+ url?: string;
102
111
  [key: string]: unknown;
103
112
  }
@@ -78,4 +78,7 @@ export interface OpeningHourSpan {
78
78
  export interface OpeningHoursEntry {
79
79
  dayOfWeek: DayOfWeek;
80
80
  hours: OpeningHourSpan[];
81
- }
81
+ }
82
+
83
+ // Réexport de SocialNetworkPayload comme SocialNetwork pour les types serverDataType
84
+ export type { SocialNetworkPayload as SocialNetwork } from "../../types/payloads.js";
@@ -13,17 +13,7 @@ export declare class User extends BaseEntity<UserItemNormalized> {
13
13
  static UPDATE_BLOCKS: Map<"UPDATE_BLOCK_DESCRIPTION" | "UPDATE_BLOCK_INFO" | "UPDATE_BLOCK_SOCIAL" | "UPDATE_BLOCK_LOCALITY" | "UPDATE_BLOCK_SLUG" | "PROFIL_IMAGE", "updateImageProfil" | "updateDescription" | "updateSocial" | "updateLocality" | "updateInfo" | "updateSlug">;
14
14
  defaultFields: Record<string, any>;
15
15
  removeFields: string[];
16
- transforms: {
17
- github: (val: any, full: any) => any;
18
- gitlab: (val: any, full: any) => any;
19
- facebook: (val: any, full: any) => any;
20
- twitter: (val: any, full: any) => any;
21
- instagram: (val: any, full: any) => any;
22
- diaspora: (val: any, full: any) => any;
23
- mastodon: (val: any, full: any) => any;
24
- telegram: (val: any, full: any) => any;
25
- signal: (val: any, full: any) => any;
26
- };
16
+ transforms: Record<string, (val: any, full: any) => any>;
27
17
  /**
28
18
  * Crée une instance de `User`.
29
19
  *
@@ -38,6 +38,8 @@ export interface EventItemJson {
38
38
  profilThumbImageUrl?: string;
39
39
  profilMarkerImageUrl?: string;
40
40
  timeZone?: string;
41
+ email?: string;
42
+ url?: string;
41
43
  [key: string]: unknown;
42
44
  }
43
45
  export interface EventItemNormalized {
@@ -67,6 +69,8 @@ export interface EventItemNormalized {
67
69
  profilThumbImageUrl?: string;
68
70
  profilMarkerImageUrl?: string;
69
71
  timeZone?: string;
72
+ email?: string;
73
+ url?: string;
70
74
  [key: string]: unknown;
71
75
  }
72
76
  export {};
@@ -1,4 +1,4 @@
1
- import type { GeoCoordinates, GeoPosition, IdObject, LinkMemberOfRef, LinkMemberRef, LinkProjectRef, LinkEventsRef, OpeningHoursEntry, ParentsMap, PostalAddress, DateValue } from "./common.js";
1
+ import type { GeoCoordinates, GeoPosition, IdObject, LinkMemberOfRef, LinkMemberRef, LinkProjectRef, LinkEventsRef, OpeningHoursEntry, ParentsMap, PostalAddress, DateValue, SocialNetwork } from "./common.js";
2
2
  import type EJSONType from "../../EJSONType.js";
3
3
  type ObjectIDCtor = typeof EJSONType["ObjectID"];
4
4
  type ObjectID = InstanceType<ObjectIDCtor>;
@@ -38,6 +38,8 @@ export interface OrganizationItemJson {
38
38
  profilThumbImageUrl?: string;
39
39
  profilMarkerImageUrl?: string;
40
40
  email?: string;
41
+ url?: string;
42
+ socialNetwork?: SocialNetwork;
41
43
  [key: string]: unknown;
42
44
  }
43
45
  export interface OrganizationItemNormalized {
@@ -65,6 +67,8 @@ export interface OrganizationItemNormalized {
65
67
  profilThumbImageUrl?: string;
66
68
  profilMarkerImageUrl?: string;
67
69
  email?: string;
70
+ url?: string;
71
+ socialNetwork?: SocialNetwork;
68
72
  [key: string]: unknown;
69
73
  }
70
74
  export {};
@@ -28,6 +28,8 @@ export interface PoiItemJson {
28
28
  profilMediumImageUrl?: string;
29
29
  profilThumbImageUrl?: string;
30
30
  profilMarkerImageUrl?: string;
31
+ email?: string;
32
+ url?: string;
31
33
  [key: string]: unknown;
32
34
  }
33
35
  export interface PoiItemNormalized {
@@ -52,6 +54,8 @@ export interface PoiItemNormalized {
52
54
  profilMediumImageUrl?: string;
53
55
  profilThumbImageUrl?: string;
54
56
  profilMarkerImageUrl?: string;
57
+ email?: string;
58
+ url?: string;
55
59
  [key: string]: unknown;
56
60
  }
57
61
  export {};
@@ -1,4 +1,4 @@
1
- import type { GeoCoordinates, GeoPosition, IdObject, LinkContributorsRef, LinkProjectRef, LinkEventsRef, ParentsMap, PostalAddress, DateValue } from "./common.js";
1
+ import type { GeoCoordinates, GeoPosition, IdObject, LinkContributorsRef, LinkProjectRef, LinkEventsRef, ParentsMap, PostalAddress, DateValue, SocialNetwork } from "./common.js";
2
2
  import type EJSONType from "../../EJSONType.js";
3
3
  type ObjectIDCtor = typeof EJSONType["ObjectID"];
4
4
  type ObjectID = InstanceType<ObjectIDCtor>;
@@ -35,6 +35,9 @@ export interface ProjectItemJson {
35
35
  profilMediumImageUrl?: string;
36
36
  profilThumbImageUrl?: string;
37
37
  profilMarkerImageUrl?: string;
38
+ socialNetwork?: SocialNetwork;
39
+ email?: string;
40
+ url?: string;
38
41
  [key: string]: unknown;
39
42
  }
40
43
  export interface ProjectItemNormalized {
@@ -60,6 +63,9 @@ export interface ProjectItemNormalized {
60
63
  profilMediumImageUrl?: string;
61
64
  profilThumbImageUrl?: string;
62
65
  profilMarkerImageUrl?: string;
66
+ socialNetwork?: SocialNetwork;
67
+ email?: string;
68
+ url?: string;
63
69
  [key: string]: unknown;
64
70
  }
65
71
  export {};
@@ -1,4 +1,4 @@
1
- import type { GeoCoordinates, GeoPosition, IdObject, LinkMemberOfUserRef, LinkProjectRef, LinkEventsRef, LinkfriendsRef, LinkFollowsUserRef, LinkFollowersUserRef, PostalAddress, DateValue } from "./common.js";
1
+ import type { GeoCoordinates, GeoPosition, IdObject, LinkMemberOfUserRef, LinkProjectRef, LinkEventsRef, LinkfriendsRef, LinkFollowsUserRef, LinkFollowersUserRef, PostalAddress, DateValue, SocialNetwork } from "./common.js";
2
2
  import type EJSONType from "../../EJSONType.js";
3
3
  type ObjectIDCtor = typeof EJSONType["ObjectID"];
4
4
  type ObjectID = InstanceType<ObjectIDCtor>;
@@ -51,6 +51,10 @@ export interface UserItemJson {
51
51
  profilBannerUrl?: string;
52
52
  profilRealBannerUrl?: string;
53
53
  preferences?: UserPreferences;
54
+ socialNetwork?: SocialNetwork;
55
+ fixe?: string;
56
+ mobile?: string;
57
+ url?: string;
54
58
  [key: string]: unknown;
55
59
  }
56
60
  export interface UserItemNormalized {
@@ -81,6 +85,10 @@ export interface UserItemNormalized {
81
85
  profilBannerUrl?: string;
82
86
  profilRealBannerUrl?: string;
83
87
  preferences?: UserPreferences;
88
+ socialNetwork?: SocialNetwork;
89
+ fixe?: string;
90
+ mobile?: string;
91
+ url?: string;
84
92
  [key: string]: unknown;
85
93
  }
86
94
  export {};
@@ -70,3 +70,4 @@ export interface OpeningHoursEntry {
70
70
  dayOfWeek: DayOfWeek;
71
71
  hours: OpeningHourSpan[];
72
72
  }
73
+ export type { SocialNetworkPayload as SocialNetwork } from "../../types/payloads.js";