@communecter/cocolight-api-client 1.0.142 → 1.0.144
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 +1 -1
- 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/ApiClient.ts +2 -2
- package/src/api/BaseEntity.ts +12 -0
- package/src/api/EndpointApi.ts +80 -1
- package/src/api/EndpointApi.types.ts +305 -0
- package/src/api/Form.ts +43 -1
- package/src/api/Organization.ts +77 -8
- package/src/api/Poi.ts +101 -1
- package/src/api/Project.ts +10 -7
- package/src/api/User.ts +54 -0
- package/src/api/serverDataType/Form.ts +21 -0
- package/src/endpoints.module.ts +225 -106
- package/types/api/EndpointApi.d.ts +50 -1
- package/types/api/EndpointApi.types.d.ts +295 -0
- package/types/api/Form.d.ts +28 -1
- package/types/api/Organization.d.ts +38 -0
- package/types/api/Poi.d.ts +36 -0
- package/types/api/User.d.ts +15 -1
- package/types/api/serverDataType/Form.d.ts +20 -0
- package/types/endpoints.module.d.ts +7140 -1106
package/package.json
CHANGED
package/src/ApiClient.ts
CHANGED
|
@@ -1658,14 +1658,14 @@ export default class ApiClient extends EventEmitter {
|
|
|
1658
1658
|
/**
|
|
1659
1659
|
* Liste des champs de date à normaliser.
|
|
1660
1660
|
*/
|
|
1661
|
-
private _dateFields = ["modified", "created", "updated", "birthDate", "lastLoginDate", "startDate", "endDate", "date", "issuedOn"];
|
|
1661
|
+
private _dateFields = ["modified", "created", "updated", "birthDate", "lastLoginDate", "startDate", "endDate", "date", "issuedOn", "equip_maj_date", "inst_date_creation", "inst_enqu_date"];
|
|
1662
1662
|
|
|
1663
1663
|
/**
|
|
1664
1664
|
* Liste des champs numériques à normaliser (le backend les renvoie en string
|
|
1665
1665
|
* via x-www-form-urlencoded ; sans cette coercion, JSON.stringify diff
|
|
1666
1666
|
* produit des faux positifs dans `hasChanges()`).
|
|
1667
1667
|
*/
|
|
1668
|
-
private _numberFields = ["buildingSurfaceArea", "siteSurfaceArea", "credits", "min", "max", "timeSpent"];
|
|
1668
|
+
private _numberFields = ["buildingSurfaceArea", "siteSurfaceArea", "credits", "min", "max", "timeSpent", "equip_surf", "equip_larg", "equip_long"];
|
|
1669
1669
|
|
|
1670
1670
|
/**
|
|
1671
1671
|
* Normalise récursivement un objet, un tableau ou une valeur simple.
|
package/src/api/BaseEntity.ts
CHANGED
|
@@ -1504,6 +1504,18 @@ export class BaseEntity<TServerData = any> {
|
|
|
1504
1504
|
normalized = { ...normalized, value: "" };
|
|
1505
1505
|
}
|
|
1506
1506
|
|
|
1507
|
+
// R7 — value: [] (array vide) en $set simple (sans arrayForm/pull) → on envoie "".
|
|
1508
|
+
// Raison : en form-urlencoded un array vide n'émet AUCUN paramètre `value`, donc le
|
|
1509
|
+
// backend fait `$_POST["value"]` (accès direct) → "Undefined index: value" / 500.
|
|
1510
|
+
// Et de toute façon le backend traite un array vide comme un effacement
|
|
1511
|
+
// (`!empty([])` === false → `$unset`). On envoie donc "" (sans setType) → $unset.
|
|
1512
|
+
if (Array.isArray(normalized.value) && normalized.value.length === 0
|
|
1513
|
+
&& !normalized.arrayForm && !normalized.pull) {
|
|
1514
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1515
|
+
const { setType, ...rest } = normalized;
|
|
1516
|
+
normalized = { ...rest, value: "" };
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1507
1519
|
return normalized;
|
|
1508
1520
|
}
|
|
1509
1521
|
|
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, NavigatorGettlData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestDatesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetGalleryData, GetAttendeesNoAdminData, GetAttendeesAdminData, CoformAnswersSearchData, CoformAnswersByIdData, GetCoformByIdData, CoformUploadAnswerFileData, CoformGetAnswerFilesData, SaveCoformAnswerData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DeleteDocumentByIdData, DemoteAdminData, CostumFilterCoformData, CostumFilterCoformByPathData, 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";
|
|
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, GetUserEligiblePlacesData, 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, NavigatorGettlData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestDatesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetGalleryData, GetAttendeesNoAdminData, GetAttendeesAdminData, CoformAnswersSearchData, CoformAnswersByIdData, GetCoformByIdData, CoformUploadAnswerFileData, CoformGetAnswerFilesData, GetCoformCatalogsData, SaveCoformAnswerData, GetCoformAnswerHistoryData, GetCoformMultievalDataData, GetCoformCommontableContributorsData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DeleteDocumentByIdData, DemoteAdminData, CostumFilterCoformData, CostumFilterCoformByPathData, 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
|
|
@@ -747,6 +747,22 @@ export class EndpointApi {
|
|
|
747
747
|
return this.callIsConnected("GET_ORGANIZATIONS_ADMIN", data);
|
|
748
748
|
}
|
|
749
749
|
|
|
750
|
+
/**
|
|
751
|
+
* Récupérer les lieux éligibles d'un utilisateur : Récupère les organisations memberOf de l'utilisateur filtrées par filters arbitraires (tags, etc.) et notSourceKey configurables. Utilisé par la vue collaborative coform/place pour pré-filtrer côté serveur les lieux éligibles à un formulaire.
|
|
752
|
+
* Constant : GET_USER_ELIGIBLE_PLACES
|
|
753
|
+
* @param data - Données envoyées à l'API
|
|
754
|
+
* @returns Les données de réponse.
|
|
755
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
756
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
757
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
758
|
+
*/
|
|
759
|
+
async getUserEligiblePlaces(data: GetUserEligiblePlacesData): Promise<any> {
|
|
760
|
+
if (!data || typeof data !== "object") {
|
|
761
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
762
|
+
}
|
|
763
|
+
return this.callIsConnected("GET_USER_ELIGIBLE_PLACES", data);
|
|
764
|
+
}
|
|
765
|
+
|
|
750
766
|
/**
|
|
751
767
|
* Récupérer les membres non administrables : Récupère les membres d’une organisation sans droits d’admin.
|
|
752
768
|
* Constant : GET_MEMBERS_NO_ADMIN
|
|
@@ -1702,6 +1718,21 @@ export class EndpointApi {
|
|
|
1702
1718
|
return this.callIsConnected("COFORM_GET_ANSWER_FILES", data);
|
|
1703
1719
|
}
|
|
1704
1720
|
|
|
1721
|
+
/**
|
|
1722
|
+
* Récupérer les catalogues collaboratifs commonTable d'un formulaire : Pour les inputs de type tpls.forms.evaluation.commonTableV2, retourne en un seul appel le catalogue agrégé des criterias (besoins/solutions) déclarées par tous les répondants pour chaque inputKey demandé, avec un compteur de répondants par criteriaId.
|
|
1723
|
+
* Constant : GET_COFORM_CATALOGS
|
|
1724
|
+
* @param data - Données envoyées à l'API
|
|
1725
|
+
* @returns Les données de réponse.
|
|
1726
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1727
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1728
|
+
*/
|
|
1729
|
+
async getCoformCatalogs(data: GetCoformCatalogsData): Promise<any> {
|
|
1730
|
+
if (!data || typeof data !== "object") {
|
|
1731
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1732
|
+
}
|
|
1733
|
+
return this.call("GET_COFORM_CATALOGS", data);
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1705
1736
|
/**
|
|
1706
1737
|
* Sauvegarder une réponse de formulaire CoForm : Enregistre ou met à jour les réponses d'un utilisateur pour un formulaire CoForm
|
|
1707
1738
|
* Constant : SAVE_COFORM_ANSWER
|
|
@@ -1718,6 +1749,54 @@ export class EndpointApi {
|
|
|
1718
1749
|
return this.callIsConnected("SAVE_COFORM_ANSWER", data);
|
|
1719
1750
|
}
|
|
1720
1751
|
|
|
1752
|
+
/**
|
|
1753
|
+
* Récupérer l'historique des modifications d'une réponse coform : Retourne l'historique des modifications (create + update) d'une réponse coform partagée, depuis la collection answerChanges. Trié du plus récent au plus ancien, limité à 200 entrées. Auth: l'utilisateur doit être propriétaire OU autorisé via canAdminAnswer (admin du parent du form, admin/membre du finder selon membersCanEditSharedAnswer, ou form publicCanEditSharedAnswer).
|
|
1754
|
+
* Constant : GET_COFORM_ANSWER_HISTORY
|
|
1755
|
+
* @param data - Données envoyées à l'API
|
|
1756
|
+
* @returns Les données de réponse.
|
|
1757
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1758
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1759
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1760
|
+
*/
|
|
1761
|
+
async getCoformAnswerHistory(data: GetCoformAnswerHistoryData): Promise<any> {
|
|
1762
|
+
if (!data || typeof data !== "object") {
|
|
1763
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1764
|
+
}
|
|
1765
|
+
return this.callIsConnected("GET_COFORM_ANSWER_HISTORY", data);
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
/**
|
|
1769
|
+
* Récupérer les données agrégées d'évaluation multiple (radar) d'une réponse coform : Pour une réponse coform partagée comportant des inputs radioNew avec activeMultieval=true, retourne les datasets agrégés (1 par utilisateur contributeur) pour chaque step. Lecture tolérante : priorité au format canonical `value`, fallback sur le format legacy `answer` '{idx}_{slug}'. Auth : owner OU canAdminAnswer.
|
|
1770
|
+
* Constant : GET_COFORM_MULTIEVAL_DATA
|
|
1771
|
+
* @param data - Données envoyées à l'API
|
|
1772
|
+
* @returns Les données de réponse.
|
|
1773
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1774
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1775
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1776
|
+
*/
|
|
1777
|
+
async getCoformMultievalData(data: GetCoformMultievalDataData): Promise<any> {
|
|
1778
|
+
if (!data || typeof data !== "object") {
|
|
1779
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1780
|
+
}
|
|
1781
|
+
return this.callIsConnected("GET_COFORM_MULTIEVAL_DATA", data);
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
/**
|
|
1785
|
+
* Récupérer les contributeurs d'une ligne de commonTable : Pour un input commonTable et une liste de criteriaIds (= une ligne du tableau, qui peut agréger plusieurs criterias dédupés via groupKey côté React), retourne la liste des contributions individuelles avec l'auteur, sa solution, sa satisfaction et sa note.
|
|
1786
|
+
* Constant : GET_COFORM_COMMONTABLE_CONTRIBUTORS
|
|
1787
|
+
* @param data - Données envoyées à l'API
|
|
1788
|
+
* @returns Les données de réponse.
|
|
1789
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1790
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1791
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1792
|
+
*/
|
|
1793
|
+
async getCoformCommontableContributors(data: GetCoformCommontableContributorsData): Promise<any> {
|
|
1794
|
+
if (!data || typeof data !== "object") {
|
|
1795
|
+
throw new TypeError("Le paramètre data doit être un objet.");
|
|
1796
|
+
}
|
|
1797
|
+
return this.callIsConnected("GET_COFORM_COMMONTABLE_CONTRIBUTORS", data);
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1721
1800
|
/**
|
|
1722
1801
|
* Voter sur un élément (commentaire ou news) : Permet de voter sur un commentaire ou une news en spécifiant un statut de vote
|
|
1723
1802
|
* Constant : ADD_VOTE
|
|
@@ -1644,6 +1644,86 @@ export interface GetOrganizationsAdminData {
|
|
|
1644
1644
|
}
|
|
1645
1645
|
|
|
1646
1646
|
|
|
1647
|
+
export interface GetUserEligiblePlacesData {
|
|
1648
|
+
/**
|
|
1649
|
+
* Nom ou terme recherché
|
|
1650
|
+
*/
|
|
1651
|
+
name?: string;
|
|
1652
|
+
/**
|
|
1653
|
+
* Types d'entités à inclure dans la recherche
|
|
1654
|
+
*/
|
|
1655
|
+
searchType: string[];
|
|
1656
|
+
/**
|
|
1657
|
+
* Index minimum pour la pagination
|
|
1658
|
+
*/
|
|
1659
|
+
indexMin: number;
|
|
1660
|
+
/**
|
|
1661
|
+
* Index de fin global pour la pagination
|
|
1662
|
+
*/
|
|
1663
|
+
indexMax?: number;
|
|
1664
|
+
/**
|
|
1665
|
+
* Nombre d'éléments à récupérer (limite de pagination)
|
|
1666
|
+
*/
|
|
1667
|
+
indexStep: number;
|
|
1668
|
+
/**
|
|
1669
|
+
* Configuration des plages de résultats pour chaque type de recherche
|
|
1670
|
+
*/
|
|
1671
|
+
ranges?: {
|
|
1672
|
+
/**
|
|
1673
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
1674
|
+
* via the `patternProperty` "^[^\s]+$".
|
|
1675
|
+
*/
|
|
1676
|
+
[k: string]: {
|
|
1677
|
+
indexMin: number;
|
|
1678
|
+
indexMax: number;
|
|
1679
|
+
};
|
|
1680
|
+
};
|
|
1681
|
+
searchBy?: "ALL";
|
|
1682
|
+
/**
|
|
1683
|
+
* Type initial de la recherche, vide par défaut
|
|
1684
|
+
*/
|
|
1685
|
+
initType?: string;
|
|
1686
|
+
/**
|
|
1687
|
+
* Indique si les types doivent être comptés dans les résultats
|
|
1688
|
+
*/
|
|
1689
|
+
count?: boolean;
|
|
1690
|
+
/**
|
|
1691
|
+
* Liste des types à compter dans les résultats
|
|
1692
|
+
*/
|
|
1693
|
+
countType?: string[];
|
|
1694
|
+
/**
|
|
1695
|
+
* true = désactive le filtrage automatique par sourceKey du contexte (cf. SearchNew.php). Configurable dynamiquement selon la config du finder du formulaire.
|
|
1696
|
+
*/
|
|
1697
|
+
notSourceKey: boolean;
|
|
1698
|
+
/**
|
|
1699
|
+
* Filtres MongoDB arbitraires : tags, source.key, links.members.{id}, etc. Les valeurs peuvent être une string (match exact), un tableau (any-of), ou un objet ($exists/$in/$ne/etc).
|
|
1700
|
+
*/
|
|
1701
|
+
filters: {
|
|
1702
|
+
[k: string]: unknown;
|
|
1703
|
+
};
|
|
1704
|
+
/**
|
|
1705
|
+
* Localité vide ou spécifique
|
|
1706
|
+
*/
|
|
1707
|
+
locality?: string;
|
|
1708
|
+
/**
|
|
1709
|
+
* Indique si la recherche doit s'étendre au Fediverse
|
|
1710
|
+
*/
|
|
1711
|
+
fediverse?: boolean;
|
|
1712
|
+
pathParams?: {
|
|
1713
|
+
/**
|
|
1714
|
+
* Type d'entité
|
|
1715
|
+
*/
|
|
1716
|
+
type: "citoyens" | "organizations";
|
|
1717
|
+
/**
|
|
1718
|
+
* ID de l'utilisateur ou de l'entité
|
|
1719
|
+
*/
|
|
1720
|
+
id: string;
|
|
1721
|
+
[k: string]: unknown;
|
|
1722
|
+
};
|
|
1723
|
+
[k: string]: unknown;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
|
|
1647
1727
|
export interface GetMembersNoAdminData {
|
|
1648
1728
|
/**
|
|
1649
1729
|
* Nom ou terme recherché
|
|
@@ -3281,6 +3361,171 @@ export interface AddPoiData {
|
|
|
3281
3361
|
streetAddress?: string;
|
|
3282
3362
|
};
|
|
3283
3363
|
scope?: "";
|
|
3364
|
+
/**
|
|
3365
|
+
* Catégorie du POI
|
|
3366
|
+
*/
|
|
3367
|
+
categorie?: string;
|
|
3368
|
+
/**
|
|
3369
|
+
* Type d'équipement
|
|
3370
|
+
*/
|
|
3371
|
+
equip_type_name?: string;
|
|
3372
|
+
/**
|
|
3373
|
+
* Nom de l'institution associée
|
|
3374
|
+
*/
|
|
3375
|
+
inst_nom?: string;
|
|
3376
|
+
/**
|
|
3377
|
+
* Accessibilité handicapé
|
|
3378
|
+
*/
|
|
3379
|
+
inst_acc_handi_bool?: boolean;
|
|
3380
|
+
/**
|
|
3381
|
+
* Transport
|
|
3382
|
+
*/
|
|
3383
|
+
inst_trans_bool?: boolean;
|
|
3384
|
+
/**
|
|
3385
|
+
* Famille du type d'équipement
|
|
3386
|
+
*/
|
|
3387
|
+
equip_type_famille?: string;
|
|
3388
|
+
/**
|
|
3389
|
+
* Date de création de l'institution
|
|
3390
|
+
*/
|
|
3391
|
+
inst_date_creation?: string;
|
|
3392
|
+
/**
|
|
3393
|
+
* Date de l'enquête
|
|
3394
|
+
*/
|
|
3395
|
+
inst_enqu_date?: string;
|
|
3396
|
+
/**
|
|
3397
|
+
* Date de mise à jour
|
|
3398
|
+
*/
|
|
3399
|
+
equip_maj_date?: string;
|
|
3400
|
+
/**
|
|
3401
|
+
* Nature de l'équipement
|
|
3402
|
+
*/
|
|
3403
|
+
equip_nature?: string;
|
|
3404
|
+
/**
|
|
3405
|
+
* Type de sol
|
|
3406
|
+
*/
|
|
3407
|
+
equip_sol?: string;
|
|
3408
|
+
/**
|
|
3409
|
+
* Surface
|
|
3410
|
+
*/
|
|
3411
|
+
equip_surf?: number;
|
|
3412
|
+
/**
|
|
3413
|
+
* Éclairage
|
|
3414
|
+
*/
|
|
3415
|
+
equip_eclair?: boolean;
|
|
3416
|
+
/**
|
|
3417
|
+
* Nom de l'APS
|
|
3418
|
+
*/
|
|
3419
|
+
aps_name?: string[];
|
|
3420
|
+
/**
|
|
3421
|
+
* Accessibilité libre
|
|
3422
|
+
*/
|
|
3423
|
+
equip_acc_libre?: boolean;
|
|
3424
|
+
/**
|
|
3425
|
+
* Type d'accessibilité handicapé
|
|
3426
|
+
*/
|
|
3427
|
+
inst_acc_handi_type?: string;
|
|
3428
|
+
/**
|
|
3429
|
+
* Type de transport
|
|
3430
|
+
*/
|
|
3431
|
+
inst_trans_type?: string;
|
|
3432
|
+
/**
|
|
3433
|
+
* Participation
|
|
3434
|
+
*/
|
|
3435
|
+
inst_part_bool?: boolean;
|
|
3436
|
+
/**
|
|
3437
|
+
* Type de participation
|
|
3438
|
+
*/
|
|
3439
|
+
inst_part_type?: string[];
|
|
3440
|
+
/**
|
|
3441
|
+
* Nom du propriétaire de l'équipement
|
|
3442
|
+
*/
|
|
3443
|
+
equip_prop_nom?: string;
|
|
3444
|
+
/**
|
|
3445
|
+
* Type du propriétaire de l'équipement
|
|
3446
|
+
*/
|
|
3447
|
+
equip_prop_type?: string;
|
|
3448
|
+
/**
|
|
3449
|
+
* Type de gestion de l'équipement
|
|
3450
|
+
*/
|
|
3451
|
+
equip_gest_type?: string;
|
|
3452
|
+
/**
|
|
3453
|
+
* Accessibilité pour personnes à mobilité réduite
|
|
3454
|
+
*/
|
|
3455
|
+
equip_pmr_acc?: boolean;
|
|
3456
|
+
/**
|
|
3457
|
+
* Chemin pour personnes à mobilité réduite
|
|
3458
|
+
*/
|
|
3459
|
+
equip_pmr_chem?: boolean;
|
|
3460
|
+
/**
|
|
3461
|
+
* Douche pour personnes à mobilité réduite
|
|
3462
|
+
*/
|
|
3463
|
+
equip_pmr_douche?: boolean;
|
|
3464
|
+
/**
|
|
3465
|
+
* Sanitaire pour personnes à mobilité réduite
|
|
3466
|
+
*/
|
|
3467
|
+
equip_pmr_sanit?: boolean;
|
|
3468
|
+
/**
|
|
3469
|
+
* Tribune pour personnes à mobilité réduite
|
|
3470
|
+
*/
|
|
3471
|
+
equip_pmr_trib?: boolean;
|
|
3472
|
+
/**
|
|
3473
|
+
* Vestiaire pour personnes à mobilité réduite
|
|
3474
|
+
*/
|
|
3475
|
+
equip_pmr_vest?: boolean;
|
|
3476
|
+
/**
|
|
3477
|
+
* Aire de repos pour personnes à mobilité réduite
|
|
3478
|
+
*/
|
|
3479
|
+
equip_pshs_aire?: boolean;
|
|
3480
|
+
/**
|
|
3481
|
+
* Chemin pour personnes à mobilité réduite
|
|
3482
|
+
*/
|
|
3483
|
+
equip_pshs_chem?: boolean;
|
|
3484
|
+
/**
|
|
3485
|
+
* Sanitaire pour personnes à mobilité réduite
|
|
3486
|
+
*/
|
|
3487
|
+
equip_pshs_sanit?: boolean;
|
|
3488
|
+
/**
|
|
3489
|
+
* Tribune pour personnes à mobilité réduite
|
|
3490
|
+
*/
|
|
3491
|
+
equip_pshs_trib?: boolean;
|
|
3492
|
+
/**
|
|
3493
|
+
* Vestiaire pour personnes à mobilité réduite
|
|
3494
|
+
*/
|
|
3495
|
+
equip_pshs_vest?: boolean;
|
|
3496
|
+
/**
|
|
3497
|
+
* Signalisation pour personnes à mobilité réduite
|
|
3498
|
+
*/
|
|
3499
|
+
equip_pshs_sign?: boolean;
|
|
3500
|
+
/**
|
|
3501
|
+
* Largeur de l'équipement
|
|
3502
|
+
*/
|
|
3503
|
+
equip_larg?: number;
|
|
3504
|
+
/**
|
|
3505
|
+
* Longueur de l'équipement
|
|
3506
|
+
*/
|
|
3507
|
+
equip_long?: number;
|
|
3508
|
+
/**
|
|
3509
|
+
* Douche
|
|
3510
|
+
*/
|
|
3511
|
+
equip_douche?: boolean;
|
|
3512
|
+
/**
|
|
3513
|
+
* Type de localisation de l'équipement
|
|
3514
|
+
*/
|
|
3515
|
+
equip_loc_type?: string[];
|
|
3516
|
+
/**
|
|
3517
|
+
* Utilisateur de l'équipement
|
|
3518
|
+
*/
|
|
3519
|
+
equip_utilisateur?: string[];
|
|
3520
|
+
/**
|
|
3521
|
+
* Source d'insertion (costum)
|
|
3522
|
+
*/
|
|
3523
|
+
source?: {
|
|
3524
|
+
insertOrign?: string;
|
|
3525
|
+
keys?: string[];
|
|
3526
|
+
key?: string;
|
|
3527
|
+
[k: string]: unknown;
|
|
3528
|
+
};
|
|
3284
3529
|
[k: string]: unknown;
|
|
3285
3530
|
}
|
|
3286
3531
|
|
|
@@ -5460,6 +5705,14 @@ export interface GetCoformByIdData {
|
|
|
5460
5705
|
* ID du formulaire parent à récupérer
|
|
5461
5706
|
*/
|
|
5462
5707
|
parentFormId: string;
|
|
5708
|
+
/**
|
|
5709
|
+
* Optionnel : ID d'un élément (lieu) pour la vue collaborative par lieu. Avec elementType, l'access info pointe sur la réponse partagée du lieu plutôt que sur la réponse personnelle du user.
|
|
5710
|
+
*/
|
|
5711
|
+
elementId?: string;
|
|
5712
|
+
/**
|
|
5713
|
+
* Type de l'élément (collection MongoDB). Requis si elementId fourni.
|
|
5714
|
+
*/
|
|
5715
|
+
elementType?: "organizations" | "projects" | "events" | "poi" | "citoyens";
|
|
5463
5716
|
[k: string]: unknown;
|
|
5464
5717
|
}
|
|
5465
5718
|
|
|
@@ -5528,6 +5781,19 @@ export interface CoformGetAnswerFilesData {
|
|
|
5528
5781
|
}
|
|
5529
5782
|
|
|
5530
5783
|
|
|
5784
|
+
export interface GetCoformCatalogsData {
|
|
5785
|
+
/**
|
|
5786
|
+
* ID du formulaire parent
|
|
5787
|
+
*/
|
|
5788
|
+
formId: string;
|
|
5789
|
+
/**
|
|
5790
|
+
* Tableau JSON sérialisé des fieldKey des inputs commonTable concernés. Ex: ["abc123","def456"]
|
|
5791
|
+
*/
|
|
5792
|
+
inputKeys: string;
|
|
5793
|
+
[k: string]: unknown;
|
|
5794
|
+
}
|
|
5795
|
+
|
|
5796
|
+
|
|
5531
5797
|
export interface SaveCoformAnswerData {
|
|
5532
5798
|
/**
|
|
5533
5799
|
* ID du formulaire parent
|
|
@@ -5553,6 +5819,45 @@ export interface SaveCoformAnswerData {
|
|
|
5553
5819
|
}
|
|
5554
5820
|
|
|
5555
5821
|
|
|
5822
|
+
export interface GetCoformAnswerHistoryData {
|
|
5823
|
+
/**
|
|
5824
|
+
* ID de la réponse dont on veut l'historique
|
|
5825
|
+
*/
|
|
5826
|
+
answerId: string;
|
|
5827
|
+
[k: string]: unknown;
|
|
5828
|
+
}
|
|
5829
|
+
|
|
5830
|
+
|
|
5831
|
+
export interface GetCoformMultievalDataData {
|
|
5832
|
+
/**
|
|
5833
|
+
* ID de la réponse
|
|
5834
|
+
*/
|
|
5835
|
+
answerId: string;
|
|
5836
|
+
/**
|
|
5837
|
+
* Optionnel : si fourni, ne retourne que la step spécifiée. Sinon, toutes les steps avec multi-eval.
|
|
5838
|
+
*/
|
|
5839
|
+
stepKey?: string;
|
|
5840
|
+
[k: string]: unknown;
|
|
5841
|
+
}
|
|
5842
|
+
|
|
5843
|
+
|
|
5844
|
+
export interface GetCoformCommontableContributorsData {
|
|
5845
|
+
/**
|
|
5846
|
+
* ID du formulaire parent
|
|
5847
|
+
*/
|
|
5848
|
+
formId: string;
|
|
5849
|
+
/**
|
|
5850
|
+
* Clé originale de l'input commonTable (sans préfixe yesOrNo)
|
|
5851
|
+
*/
|
|
5852
|
+
inputKey: string;
|
|
5853
|
+
/**
|
|
5854
|
+
* Tableau JSON sérialisé des criteriaIds correspondant à la ligne agrégée (commonTable peut dédupliquer plusieurs criterias sous un même usage côté React). Ex: ["criteria1778265370227"]
|
|
5855
|
+
*/
|
|
5856
|
+
criteriaIds: string;
|
|
5857
|
+
[k: string]: unknown;
|
|
5858
|
+
}
|
|
5859
|
+
|
|
5860
|
+
|
|
5556
5861
|
export interface AddVoteData {
|
|
5557
5862
|
/**
|
|
5558
5863
|
* ID de l'élément (commentaire ou news) sur lequel voter
|
package/src/api/Form.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ApiError } from "../error.js";
|
|
|
4
4
|
import type { Answer } from "./Answer.js";
|
|
5
5
|
import type { PaginatorPage, PaginatorState } from "./BaseEntity.js";
|
|
6
6
|
import type { CoformAnswersSearchData } from "./EndpointApi.types.js";
|
|
7
|
-
import type { FormItemNormalized } from "./serverDataType/Form.js";
|
|
7
|
+
import type { CoformCommonTableContributor, FormItemNormalized } from "./serverDataType/Form.js";
|
|
8
8
|
|
|
9
9
|
export class Form extends BaseEntity<FormItemNormalized> {
|
|
10
10
|
static override entityType = "forms";
|
|
@@ -157,4 +157,46 @@ export class Form extends BaseEntity<FormItemNormalized> {
|
|
|
157
157
|
const entity = await this.entity("answers", payload);
|
|
158
158
|
return entity as Answer;
|
|
159
159
|
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Récupère la liste des contributeurs d'une table commune (commonTable) de CE formulaire.
|
|
163
|
+
*
|
|
164
|
+
* Pour un input `commonTable` et une ligne du tableau (un ou plusieurs `criteriaIds`
|
|
165
|
+
* dédupés côté React via `groupKey`), retourne les contributions individuelles
|
|
166
|
+
* (auteur, solution, satisfaction, note).
|
|
167
|
+
*
|
|
168
|
+
* Constant : GET_COFORM_COMMONTABLE_CONTRIBUTORS
|
|
169
|
+
* (POST /survey/coform/getcommontablecontributors, auth bearer).
|
|
170
|
+
*
|
|
171
|
+
* @param params.inputKey - Clé originale de l'input commonTable (sans préfixe yesOrNo).
|
|
172
|
+
* @param params.criteriaIds - criteriaIds de la ligne agrégée : tableau `string[]`
|
|
173
|
+
* (sérialisé automatiquement) ou string JSON déjà sérialisée.
|
|
174
|
+
* @returns La liste des contributions (une entrée par contribution).
|
|
175
|
+
* @throws {ApiError} si le Form n'a pas d'id.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* const form = await org.form({ id: "6925e2b05dd63b02ca70d6d9" });
|
|
179
|
+
* const contributors = await form.getCommonTableContributors({
|
|
180
|
+
* inputKey: "usagesEtSolutions",
|
|
181
|
+
* criteriaIds: ["criteria1778265370227"],
|
|
182
|
+
* });
|
|
183
|
+
*/
|
|
184
|
+
async getCommonTableContributors(
|
|
185
|
+
params: { inputKey: string; criteriaIds: string | string[] }
|
|
186
|
+
): Promise<CoformCommonTableContributor[]> {
|
|
187
|
+
const formId = this.id;
|
|
188
|
+
if (!formId) throw new ApiError("Form sans id, impossible de récupérer les contributeurs.", 400);
|
|
189
|
+
|
|
190
|
+
const criteriaIds = Array.isArray(params.criteriaIds)
|
|
191
|
+
? JSON.stringify(params.criteriaIds)
|
|
192
|
+
: params.criteriaIds;
|
|
193
|
+
|
|
194
|
+
const res = (await this.endpointApi.getCoformCommontableContributors({
|
|
195
|
+
formId,
|
|
196
|
+
inputKey: params.inputKey,
|
|
197
|
+
criteriaIds
|
|
198
|
+
})) as { data?: { contributors?: CoformCommonTableContributor[] } };
|
|
199
|
+
|
|
200
|
+
return res?.data?.contributors ?? [];
|
|
201
|
+
}
|
|
160
202
|
}
|
package/src/api/Organization.ts
CHANGED
|
@@ -173,13 +173,16 @@ export class Organization extends BaseEntity<OrganizationItemNormalized> {
|
|
|
173
173
|
if (rawAnswers && typeof rawAnswers === "object") {
|
|
174
174
|
const linkedAnswers: Record<string, unknown[]> = {};
|
|
175
175
|
for (const [formId, docs] of Object.entries(rawAnswers)) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
176
|
+
// Le backend renvoie tantôt un tableau `[doc, ...]`, tantôt une map indexée
|
|
177
|
+
// par id `{ answerId: doc }`. On normalise vers un tableau dans les deux cas.
|
|
178
|
+
const list = Array.isArray(docs)
|
|
179
|
+
? docs
|
|
180
|
+
: (docs && typeof docs === "object" ? Object.values(docs) : []);
|
|
181
|
+
linkedAnswers[formId] = list.map((doc) =>
|
|
182
|
+
doc && typeof doc === "object"
|
|
183
|
+
? this._linkEntity("answers", { ...(doc as Record<string, unknown>), collection: "answers" })
|
|
184
|
+
: doc
|
|
185
|
+
);
|
|
183
186
|
}
|
|
184
187
|
(data as Record<string, unknown>).answers = linkedAnswers;
|
|
185
188
|
}
|
|
@@ -448,9 +451,75 @@ export class Organization extends BaseEntity<OrganizationItemNormalized> {
|
|
|
448
451
|
return paginator.next() as Promise<PaginatorPage<User | Organization>>;
|
|
449
452
|
}
|
|
450
453
|
|
|
454
|
+
/**
|
|
455
|
+
* Récupère les organisations dont **cette** organisation est membre
|
|
456
|
+
* (lien montant : réseau, fédération, collectif… dont l'orga fait partie).
|
|
457
|
+
*
|
|
458
|
+
* C'est le miroir de {@link Organization#getMembers} : `getMembers()` liste
|
|
459
|
+
* *qui* est membre de cette orga, tandis que `getMemberOf()` liste *les orgas
|
|
460
|
+
* dont cette orga est elle-même membre*.
|
|
461
|
+
*
|
|
462
|
+
* Contrairement à {@link BaseEntity#getOrganizations} (désactivée ici car pensée
|
|
463
|
+
* pour un citoyen via `GET_ORGANIZATIONS_*`), on passe par la recherche réseau
|
|
464
|
+
* globale `searchCostum` : on cible `searchType: ["organizations"]` et on filtre
|
|
465
|
+
* sur `links.members.{thisOrgId}`. Seules les adhésions **confirmées** sont
|
|
466
|
+
* retournées (les liens `toBeValidated` et `isInviting` sont exclus).
|
|
467
|
+
*
|
|
468
|
+
* La pagination (`hasNext`/`next()`) et la restauration via `restoredState`
|
|
469
|
+
* fonctionnent comme pour `searchCostum` : le filtre membership est conservé
|
|
470
|
+
* d'une page à l'autre.
|
|
471
|
+
*
|
|
472
|
+
* @param data - Paramètres de recherche/pagination additionnels (`name`, `indexStep`,
|
|
473
|
+
* `sortBy`, `locality`, `filters` complémentaires…). Les `filters` fournis sont
|
|
474
|
+
* fusionnés avec le filtre membership, ce dernier restant prioritaire.
|
|
475
|
+
* @param options - Options. `restoredState` pour reprendre une pagination sérialisée.
|
|
476
|
+
* @returns Première page paginée d'organisations.
|
|
477
|
+
* @throws {ApiError} Si l'organisation n'a pas d'`id`.
|
|
478
|
+
*
|
|
479
|
+
* @example
|
|
480
|
+
* // Toutes les orgas dont cette orga est membre
|
|
481
|
+
* const page = await org.getMemberOf();
|
|
482
|
+
* console.log(page.results, page.count.total);
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* // Filtrer par nom + pagination plus large
|
|
486
|
+
* const page = await org.getMemberOf({ name: "réseau", indexStep: 50 });
|
|
487
|
+
* if (page.hasNext) await page.next();
|
|
488
|
+
*/
|
|
489
|
+
async getMemberOf(
|
|
490
|
+
data: Parameters<BaseEntity<OrganizationItemNormalized>["searchCostum"]>[0] = {},
|
|
491
|
+
options: { restoredState?: PaginatorState } = {}
|
|
492
|
+
): Promise<PaginatorPage<Organization>> {
|
|
493
|
+
if (!this.id) {
|
|
494
|
+
throw new ApiError("L'organisation n'est pas définie, impossible de récupérer ses adhésions", 400);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
const path = `links.members.${this.id}`;
|
|
498
|
+
const membershipFilters = {
|
|
499
|
+
[path]: { $exists: true },
|
|
500
|
+
[`${path}.toBeValidated`]: { $exists: false },
|
|
501
|
+
[`${path}.isInviting`]: { $exists: false }
|
|
502
|
+
};
|
|
503
|
+
const callerFilters = (data?.filters && typeof data.filters === "object") ? data.filters : {};
|
|
504
|
+
|
|
505
|
+
const orgParam: Parameters<typeof this.searchCostum>[0] = {
|
|
506
|
+
indexMin: 0,
|
|
507
|
+
indexStep: 20,
|
|
508
|
+
notSourceKey: true,
|
|
509
|
+
...data,
|
|
510
|
+
// Champs imposés (le caller ne peut pas casser la sémantique « adhésions »)
|
|
511
|
+
searchType: ["organizations"],
|
|
512
|
+
countType: ["organizations"],
|
|
513
|
+
count: true,
|
|
514
|
+
filters: { ...callerFilters, ...membershipFilters }
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
return this.searchCostum(orgParam, options) as Promise<PaginatorPage<Organization>>;
|
|
518
|
+
}
|
|
519
|
+
|
|
451
520
|
/**
|
|
452
521
|
* {@inheritDoc BaseEntity#getGallery}
|
|
453
|
-
*
|
|
522
|
+
*
|
|
454
523
|
* Récupère la galerie de l'organisation.
|
|
455
524
|
*/
|
|
456
525
|
override async getGallery(data: Parameters<BaseEntity<OrganizationItemNormalized>["getGallery"]>[0] = {}) {
|