@communecter/cocolight-api-client 1.0.130 → 1.0.131
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 +2 -2
- 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/Action.ts +531 -4
- package/src/api/BaseEntity.ts +22 -0
- package/src/api/EndpointApi.ts +81 -1
- package/src/api/EndpointApi.types.ts +73 -0
- package/src/api/Organization.ts +3 -1
- package/src/api/Project.ts +14 -0
- package/src/endpoints.module.ts +166 -159
- package/types/api/Action.d.ts +275 -2
- package/types/api/BaseEntity.d.ts +17 -0
- package/types/api/EndpointApi.d.ts +51 -1
- package/types/api/EndpointApi.types.d.ts +63 -0
- package/types/api/Project.d.ts +8 -0
- package/types/endpoints.module.d.ts +1117 -0
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, GetCoformByIdData, CoformUploadAnswerFileData, CoformGetAnswerFilesData, SaveCoformAnswerData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DeleteDocumentByIdData, DemoteAdminData, CostumFilterCoformData, GetCountriesData, SearchZonesData, CoformAnswersByFormsData, GenerateAnswerFromFormData, FundingEnvelopeData, CoremuOperationData, CostumProjectActionRequestNewData, LinkDiscourseAccountData, UnlinkDiscourseAccountData, DiscourseProfileData, DiscourseCheckEmailData, DiscourseDismissLinkData, LinkMediawikiAccountData, UnlinkMediawikiAccountData, GetMediawikiContributionsData, AddClassifiedData } 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, GetCoformByIdData, CoformUploadAnswerFileData, CoformGetAnswerFilesData, SaveCoformAnswerData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DeleteDocumentByIdData, DemoteAdminData, CostumFilterCoformData, GetCountriesData, SearchZonesData, CoformAnswersByFormsData, GenerateAnswerFromFormData, FundingEnvelopeData, CoremuOperationData, CostumProjectActionRequestNewData, CostumProjectActionRequestSetStatusData, CostumProjectActionRequestSetDateData, CostumProjectActionRequestSetContributorsData, CostumProjectActionRequestCancelData, CostumProjectActionRequestArchiveData, LinkDiscourseAccountData, UnlinkDiscourseAccountData, DiscourseProfileData, DiscourseCheckEmailData, DiscourseDismissLinkData, LinkMediawikiAccountData, UnlinkMediawikiAccountData, GetMediawikiContributionsData, AddClassifiedData } from "./EndpointApi.types.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Classe EndpointApi générée automatiquement depuis endpoints-copie.json
|
|
@@ -1920,6 +1920,86 @@ export class EndpointApi {
|
|
|
1920
1920
|
return this.callIsConnected("COSTUM_PROJECT_ACTION_REQUEST_NEW", data);
|
|
1921
1921
|
}
|
|
1922
1922
|
|
|
1923
|
+
/**
|
|
1924
|
+
* Change le statut d'une action (avec logique métier) : Change le status d'une action via l'endpoint dédié backend. Ajoute une entrée à updateStatus[], gère les tags (discuter/totest/next), auto-injecte startDate/endDate selon le status, gère tracking, envoie une notification Rocket.Chat au parent. NE PAS confondre avec UPDATE_PATH_VALUE qui bypass toute cette logique.
|
|
1925
|
+
* Constant : COSTUM_PROJECT_ACTION_REQUEST_SET_STATUS
|
|
1926
|
+
* @param data - Données envoyées à l'API
|
|
1927
|
+
* @returns Les données de réponse.
|
|
1928
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1929
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1930
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1931
|
+
*/
|
|
1932
|
+
async costumProjectActionRequestSetStatus(data: CostumProjectActionRequestSetStatusData): Promise<any> {
|
|
1933
|
+
if (!data || typeof data !== "object") {
|
|
1934
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1935
|
+
}
|
|
1936
|
+
return this.callIsConnected("COSTUM_PROJECT_ACTION_REQUEST_SET_STATUS", data);
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
/**
|
|
1940
|
+
* Met à jour les dates d'une action : Met à jour startDate et/ou endDate d'une action via l'endpoint dédié. Supporte nativement l'effacement (envoyer chaîne vide → $unset). Parser de date robuste côté backend.
|
|
1941
|
+
* Constant : COSTUM_PROJECT_ACTION_REQUEST_SET_DATE
|
|
1942
|
+
* @param data - Données envoyées à l'API
|
|
1943
|
+
* @returns Les données de réponse.
|
|
1944
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1945
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1946
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1947
|
+
*/
|
|
1948
|
+
async costumProjectActionRequestSetDate(data: CostumProjectActionRequestSetDateData): Promise<any> {
|
|
1949
|
+
if (!data || typeof data !== "object") {
|
|
1950
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1951
|
+
}
|
|
1952
|
+
return this.callIsConnected("COSTUM_PROJECT_ACTION_REQUEST_SET_DATE", data);
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
/**
|
|
1956
|
+
* Définit les contributeurs d'une action : Modifie links.contributors d'une action via 3 modes : (A) `contributors` array de userIds = remplace toute la liste ; (B) `contributor` + `participate=1` = ajoute un user ; (C) `contributor` + `participate=0` = retire un user. Valide les bornes `min`/`max` côté backend. Émet `.set-contributors{parentId}` et `.cd-int-contributors` aux clients socket.
|
|
1957
|
+
* Constant : COSTUM_PROJECT_ACTION_REQUEST_SET_CONTRIBUTORS
|
|
1958
|
+
* @param data - Données envoyées à l'API
|
|
1959
|
+
* @returns Les données de réponse.
|
|
1960
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1961
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1962
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1963
|
+
*/
|
|
1964
|
+
async costumProjectActionRequestSetContributors(data: CostumProjectActionRequestSetContributorsData): Promise<any> {
|
|
1965
|
+
if (!data || typeof data !== "object") {
|
|
1966
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1967
|
+
}
|
|
1968
|
+
return this.callIsConnected("COSTUM_PROJECT_ACTION_REQUEST_SET_CONTRIBUTORS", data);
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
/**
|
|
1972
|
+
* Annule une action : Annule une action : status=closed + unset tracking + retire le tag 'totest'.
|
|
1973
|
+
* Constant : COSTUM_PROJECT_ACTION_REQUEST_CANCEL
|
|
1974
|
+
* @param data - Données envoyées à l'API
|
|
1975
|
+
* @returns Les données de réponse.
|
|
1976
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1977
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1978
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1979
|
+
*/
|
|
1980
|
+
async costumProjectActionRequestCancel(data: CostumProjectActionRequestCancelData): Promise<any> {
|
|
1981
|
+
if (!data || typeof data !== "object") {
|
|
1982
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1983
|
+
}
|
|
1984
|
+
return this.callIsConnected("COSTUM_PROJECT_ACTION_REQUEST_CANCEL", data);
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* Archive une action : Archive une action : status=disabled + unset tracking.
|
|
1989
|
+
* Constant : COSTUM_PROJECT_ACTION_REQUEST_ARCHIVE
|
|
1990
|
+
* @param data - Données envoyées à l'API
|
|
1991
|
+
* @returns Les données de réponse.
|
|
1992
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1993
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1994
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1995
|
+
*/
|
|
1996
|
+
async costumProjectActionRequestArchive(data: CostumProjectActionRequestArchiveData): Promise<any> {
|
|
1997
|
+
if (!data || typeof data !== "object") {
|
|
1998
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1999
|
+
}
|
|
2000
|
+
return this.callIsConnected("COSTUM_PROJECT_ACTION_REQUEST_ARCHIVE", data);
|
|
2001
|
+
}
|
|
2002
|
+
|
|
1923
2003
|
/**
|
|
1924
2004
|
* Interoperabilité Discourse Lié un compte : Lier un compte Discourse
|
|
1925
2005
|
* Constant : LINK_DISCOURSE_ACCOUNT
|
|
@@ -5620,6 +5620,79 @@ export interface CostumProjectActionRequestNewData {
|
|
|
5620
5620
|
}
|
|
5621
5621
|
|
|
5622
5622
|
|
|
5623
|
+
export interface CostumProjectActionRequestSetStatusData {
|
|
5624
|
+
/**
|
|
5625
|
+
* ID de l'action
|
|
5626
|
+
*/
|
|
5627
|
+
id: string;
|
|
5628
|
+
/**
|
|
5629
|
+
* Nouveau statut. Triggers backend : 'done' set endDate=now, 'tracking' set startDate=now+tracking:true, 'discuter'/'next'/'totest' ajoutent un tag et forcent status='todo', 'todo' unset startDate/endDate, 'closed' purge les tags discuter/totest/next, 'disabled' unset tracking.
|
|
5630
|
+
*/
|
|
5631
|
+
status: "todo" | "done" | "tracking" | "discuter" | "next" | "totest" | "disabled" | "closed";
|
|
5632
|
+
/**
|
|
5633
|
+
* Optionnel : userId qui effectue le changement (utilisé pour updateStatus[].author et notification RC). Par défaut session userId.
|
|
5634
|
+
*/
|
|
5635
|
+
user?: string;
|
|
5636
|
+
[k: string]: unknown;
|
|
5637
|
+
}
|
|
5638
|
+
|
|
5639
|
+
|
|
5640
|
+
export interface CostumProjectActionRequestSetDateData {
|
|
5641
|
+
/**
|
|
5642
|
+
* ID de l'action
|
|
5643
|
+
*/
|
|
5644
|
+
id: string;
|
|
5645
|
+
/**
|
|
5646
|
+
* Date de début ISO 8601, ou chaîne vide pour effacer ($unset)
|
|
5647
|
+
*/
|
|
5648
|
+
startDate?: string;
|
|
5649
|
+
/**
|
|
5650
|
+
* Date de fin ISO 8601, ou chaîne vide pour effacer ($unset)
|
|
5651
|
+
*/
|
|
5652
|
+
endDate?: string;
|
|
5653
|
+
[k: string]: unknown;
|
|
5654
|
+
}
|
|
5655
|
+
|
|
5656
|
+
|
|
5657
|
+
export interface CostumProjectActionRequestSetContributorsData {
|
|
5658
|
+
/**
|
|
5659
|
+
* ID de l'action (côté backend lu via $_POST['action'], pas 'id')
|
|
5660
|
+
*/
|
|
5661
|
+
action: string;
|
|
5662
|
+
/**
|
|
5663
|
+
* Mode A : remplace la liste complète des contributeurs par cet array de userIds.
|
|
5664
|
+
*/
|
|
5665
|
+
contributors?: string[];
|
|
5666
|
+
/**
|
|
5667
|
+
* Mode B/C : userId à ajouter (participate=1) ou retirer (participate=0).
|
|
5668
|
+
*/
|
|
5669
|
+
contributor?: string;
|
|
5670
|
+
/**
|
|
5671
|
+
* Mode B/C : 1=join, 0=quit. Couplé avec `contributor`.
|
|
5672
|
+
*/
|
|
5673
|
+
participate?: 0 | 1;
|
|
5674
|
+
[k: string]: unknown;
|
|
5675
|
+
}
|
|
5676
|
+
|
|
5677
|
+
|
|
5678
|
+
export interface CostumProjectActionRequestCancelData {
|
|
5679
|
+
/**
|
|
5680
|
+
* ID de l'action à annuler
|
|
5681
|
+
*/
|
|
5682
|
+
id: string;
|
|
5683
|
+
[k: string]: unknown;
|
|
5684
|
+
}
|
|
5685
|
+
|
|
5686
|
+
|
|
5687
|
+
export interface CostumProjectActionRequestArchiveData {
|
|
5688
|
+
/**
|
|
5689
|
+
* ID de l'action à archiver
|
|
5690
|
+
*/
|
|
5691
|
+
id: string;
|
|
5692
|
+
[k: string]: unknown;
|
|
5693
|
+
}
|
|
5694
|
+
|
|
5695
|
+
|
|
5623
5696
|
export interface LinkDiscourseAccountData {
|
|
5624
5697
|
/**
|
|
5625
5698
|
* Nom d'utilisateur du compte Discourse
|
package/src/api/Organization.ts
CHANGED
|
@@ -478,12 +478,14 @@ export class Organization extends BaseEntity<OrganizationItemNormalized> {
|
|
|
478
478
|
throw new ApiError("L'organisation n'a pas d'ID, impossible de mettre à jour les horaires d'ouverture.", 400);
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
|
|
481
|
+
const result = await this.endpointApi.updatePathValue({
|
|
482
482
|
id: this.id,
|
|
483
483
|
collection: "organizations",
|
|
484
484
|
path: "openingHours",
|
|
485
485
|
value: hours as unknown as { [k: string]: unknown }
|
|
486
486
|
});
|
|
487
|
+
await this._refreshIfDirect();
|
|
488
|
+
return result;
|
|
487
489
|
}
|
|
488
490
|
|
|
489
491
|
/**
|
package/src/api/Project.ts
CHANGED
|
@@ -362,6 +362,20 @@ export class Project extends BaseEntity<ProjectItemNormalized> {
|
|
|
362
362
|
return super.news(newsData);
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Vérifie qu'un milestoneId existe dans `serverData.oceco.milestones[]`.
|
|
367
|
+
* Sert à valider une référence avant d'attacher une entité (Action) à un milestone.
|
|
368
|
+
*
|
|
369
|
+
* @param milestoneId - L'ID du milestone à chercher.
|
|
370
|
+
* @returns `true` si trouvé, `false` sinon (y compris si oceco/milestones absents).
|
|
371
|
+
*/
|
|
372
|
+
hasMilestone(milestoneId: string): boolean {
|
|
373
|
+
if (typeof milestoneId !== "string" || milestoneId.length === 0) return false;
|
|
374
|
+
const milestones = (this.serverData.oceco as { milestones?: Array<{ milestoneId?: string }> } | undefined)?.milestones;
|
|
375
|
+
if (!Array.isArray(milestones)) return false;
|
|
376
|
+
return milestones.some(m => m?.milestoneId === milestoneId);
|
|
377
|
+
}
|
|
378
|
+
|
|
365
379
|
/**
|
|
366
380
|
* {@inheritDoc BaseEntity#action}
|
|
367
381
|
*
|