@communecter/cocolight-api-client 1.0.77 → 1.0.79
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/cocolight-api-client.browser.js +3 -3
- package/dist/cocolight-api-client.cjs +1 -1
- package/dist/cocolight-api-client.mjs.js +1 -1
- package/dist/cocolight-api-client.vite.mjs.js +1 -1
- package/dist/cocolight-api-client.vite.mjs.js.map +1 -1
- package/package.json +1 -1
- package/src/api/BaseEntity.ts +7 -6
- package/src/api/EndpointApi.ts +17 -1
- package/src/api/EndpointApi.types.ts +14 -0
- package/src/api/User.ts +664 -1
- package/src/api/serverDataType/common.ts +1 -0
- package/src/endpoints.module.ts +1 -1
- package/types/api/BaseEntity.d.ts +3 -2
- package/types/api/EndpointApi.d.ts +11 -1
- package/types/api/EndpointApi.types.d.ts +12 -0
- package/types/api/User.d.ts +360 -0
- package/types/api/serverDataType/common.d.ts +1 -0
- package/types/endpoints.module.d.ts +356 -0
package/package.json
CHANGED
package/src/api/BaseEntity.ts
CHANGED
|
@@ -230,6 +230,8 @@ type LinkFilters = Record<string, FilterValue>;
|
|
|
230
230
|
interface MinimalUserLink {
|
|
231
231
|
toBeValidated?: boolean;
|
|
232
232
|
isInviting?: boolean;
|
|
233
|
+
isAdminInviting?: boolean;
|
|
234
|
+
isAdminPending?: boolean;
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
// Types pour linkEntitiesFromServerData
|
|
@@ -2231,9 +2233,8 @@ export class BaseEntity<TServerData = any> {
|
|
|
2231
2233
|
* - `connectTypeConnect` : valeur envoyée pour `connect()`
|
|
2232
2234
|
* - `connectTypeDisconnect` : valeur envoyée pour `disconnect()`
|
|
2233
2235
|
* @throws {ApiError} - Si le type d'entité est inconnu.
|
|
2234
|
-
* @protected
|
|
2235
2236
|
*/
|
|
2236
|
-
|
|
2237
|
+
_getLinkMeta(): LinkMeta {
|
|
2237
2238
|
const map = {
|
|
2238
2239
|
organizations: {
|
|
2239
2240
|
linkType: "memberOf",
|
|
@@ -2407,7 +2408,7 @@ export class BaseEntity<TServerData = any> {
|
|
|
2407
2408
|
}
|
|
2408
2409
|
|
|
2409
2410
|
// Invitation reçue → accepte automatiquement
|
|
2410
|
-
if (userLink.isInviting) {
|
|
2411
|
+
if (userLink.isInviting || userLink.isAdminInviting) {
|
|
2411
2412
|
return this._acceptLinkRequest();
|
|
2412
2413
|
}
|
|
2413
2414
|
|
|
@@ -2444,7 +2445,7 @@ export class BaseEntity<TServerData = any> {
|
|
|
2444
2445
|
|
|
2445
2446
|
const userLink = this._getLinkFromConnectedUser();
|
|
2446
2447
|
|
|
2447
|
-
if (userLink && userLink.isInviting) {
|
|
2448
|
+
if (userLink && (userLink.isInviting || userLink.isAdminInviting)) {
|
|
2448
2449
|
const t = this.getEntityType();
|
|
2449
2450
|
|
|
2450
2451
|
// 1) Garde runtime pour exclure les types non pris en charge par LinkValidateData
|
|
@@ -3383,8 +3384,8 @@ export class BaseEntity<TServerData = any> {
|
|
|
3383
3384
|
*/
|
|
3384
3385
|
protected _validateUserLink(userLink: MinimalUserLink | null | undefined): boolean {
|
|
3385
3386
|
if (!userLink) return false;
|
|
3386
|
-
const { toBeValidated, isInviting } = userLink;
|
|
3387
|
-
return !toBeValidated && !isInviting;
|
|
3387
|
+
const { toBeValidated, isInviting, isAdminInviting, isAdminPending } = userLink;
|
|
3388
|
+
return !toBeValidated && !isInviting && !isAdminInviting && !isAdminPending;
|
|
3388
3389
|
}
|
|
3389
3390
|
|
|
3390
3391
|
/**
|
package/src/api/EndpointApi.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ApiAuthenticationError } from "../error.js";
|
|
3
3
|
|
|
4
4
|
import type ApiClient from "../ApiClient.js";
|
|
5
|
-
import type { PersonRegisterData, AuthenticateUrlData, RefreshTokenUrlData, PasswordRecoveryData, ServerExchangeTokenData, ChangePasswordData, DeleteAccountData, UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, UpdateBlockSlugData, CheckData, ProfilImageData, ProfilBannerData, GetElementsAboutData, MulticonnectData, GetNewsData, GetNewsByIdData, AddNewsData, AddImageNewsData, AddFileNewsData, DeleteNewsData, UpdateNewsData, ShareNewsData, GetCommentsData, AddCommentsData, DeleteCommentsData, UpdateCommentsData, SearchTagsData, ShowVoteData, GlobalAutocompleteData, CityAutocompleteData, CityAutocompleteByCountryData, SuggestionInputData, GetProjectsNoAdminData, GetProjectsAdminData, GetPoisNoAdminData, GetPoisAdminData, GetOrganizationsNoAdminData, GetOrganizationsAdminData, GetMembersNoAdminData, GetMembersAdminData, GetFriendsAdminData, GetSubscriptionsData, GetSubscriptionsAdminData, GetSubscribersData, GetSubscribersAdminData, GetContributorsNoAdminData, GetContributorsAdminData, GetBadgesData, GetBadgesFiltersData, ConnectData, DisconnectData, GetElementsKeyData, GetFavorisData, DeleteFavorisData, AddFavorisData, AddOrganizationData, AddProjectData, AddPoiData, AddEventData, DeletePoiData, DeleteEventData, DeleteElementData, AddImageElementData, LinkValidateData, SearchMemberAutocompleteData, GetNotificationsData, GetNotificationsCountData, NotificationUpdateData, MarkNotificationAsReadData, ActivitypubSearchData, ActivitypubLinkData, ActivitypubGetCommunityData, GetBadgeData, AddBadgesData, AssignBadgesData, GetEventsData, ShareEventsData, InviteEventData, FollowData, GetCostumJsonData, GlobalAutocompleteCostumData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestDatesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetGalleryData, GetAttendeesNoAdminData, GetAttendeesAdminData, CoformAnswersSearchData, CoformAnswersByIdData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData } from "./EndpointApi.types.js";
|
|
5
|
+
import type { PersonRegisterData, AuthenticateUrlData, RefreshTokenUrlData, PasswordRecoveryData, ServerExchangeTokenData, ChangePasswordData, DeleteAccountData, UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, UpdateBlockSlugData, CheckData, ProfilImageData, ProfilBannerData, GetElementsAboutData, MulticonnectData, GetNewsData, GetNewsByIdData, AddNewsData, AddImageNewsData, AddFileNewsData, DeleteNewsData, UpdateNewsData, ShareNewsData, GetCommentsData, AddCommentsData, DeleteCommentsData, UpdateCommentsData, SearchTagsData, ShowVoteData, GlobalAutocompleteData, CityAutocompleteData, CityAutocompleteByCountryData, SuggestionInputData, GetProjectsNoAdminData, GetProjectsAdminData, GetPoisNoAdminData, GetPoisAdminData, GetOrganizationsNoAdminData, GetOrganizationsAdminData, GetMembersNoAdminData, GetMembersAdminData, GetFriendsAdminData, GetSubscriptionsData, GetSubscriptionsAdminData, GetSubscribersData, GetSubscribersAdminData, GetContributorsNoAdminData, GetContributorsAdminData, GetBadgesData, GetBadgesFiltersData, ConnectData, DisconnectData, GetElementsKeyData, GetFavorisData, DeleteFavorisData, AddFavorisData, AddOrganizationData, AddProjectData, AddPoiData, AddEventData, DeletePoiData, DeleteEventData, DeleteElementData, AddImageElementData, LinkValidateData, SearchMemberAutocompleteData, GetNotificationsData, GetNotificationsCountData, NotificationUpdateData, MarkNotificationAsReadData, ActivitypubSearchData, ActivitypubLinkData, ActivitypubGetCommunityData, GetBadgeData, AddBadgesData, AssignBadgesData, GetEventsData, ShareEventsData, InviteEventData, FollowData, GetCostumJsonData, GlobalAutocompleteCostumData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestDatesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetGalleryData, GetAttendeesNoAdminData, GetAttendeesAdminData, CoformAnswersSearchData, CoformAnswersByIdData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DemoteAdminData } from "./EndpointApi.types.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Classe EndpointApi générée automatiquement depuis endpoints-copie.json
|
|
@@ -1704,6 +1704,22 @@ export class EndpointApi {
|
|
|
1704
1704
|
return this.callIsConnected("DELETE_DOCUMENT_BY_CONTEXT", data);
|
|
1705
1705
|
}
|
|
1706
1706
|
|
|
1707
|
+
/**
|
|
1708
|
+
* Rétirer les droits d’administrateur d’un membre : Rétirer les droits d’administrateur d’un membre d’une organisation ou d’un projet
|
|
1709
|
+
* Constant : DEMOTE_ADMIN
|
|
1710
|
+
* @param data - Données envoyées à l'API
|
|
1711
|
+
* @returns Les données de réponse.
|
|
1712
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1713
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1714
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1715
|
+
*/
|
|
1716
|
+
async demoteAdmin(data: DemoteAdminData): Promise<any> {
|
|
1717
|
+
if (!data || typeof data !== "object") {
|
|
1718
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1719
|
+
}
|
|
1720
|
+
return this.callIsConnected("DEMOTE_ADMIN", data);
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1707
1723
|
}
|
|
1708
1724
|
|
|
1709
1725
|
export default EndpointApi;
|
|
@@ -4899,3 +4899,17 @@ export interface DeleteDocumentByContextData {
|
|
|
4899
4899
|
};
|
|
4900
4900
|
[k: string]: unknown;
|
|
4901
4901
|
}
|
|
4902
|
+
|
|
4903
|
+
|
|
4904
|
+
export interface DemoteAdminData {
|
|
4905
|
+
parentId: string;
|
|
4906
|
+
/**
|
|
4907
|
+
* Type de contexte de l’entité
|
|
4908
|
+
*/
|
|
4909
|
+
parentType: "organizations" | "projects";
|
|
4910
|
+
childId: string;
|
|
4911
|
+
childType: "citoyens";
|
|
4912
|
+
connect: "members" | "contributors";
|
|
4913
|
+
isAdmin: false;
|
|
4914
|
+
[k: string]: unknown;
|
|
4915
|
+
}
|