@communecter/cocolight-api-client 1.0.121 → 1.0.123

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.
Files changed (52) hide show
  1. package/dist/203.cocolight-api-client.cjs +1 -0
  2. package/dist/278.cocolight-api-client.browser.js +1 -0
  3. package/dist/278.cocolight-api-client.cjs +1 -0
  4. package/dist/278.cocolight-api-client.mjs.js +1 -0
  5. package/dist/401.cocolight-api-client.mjs.js +1 -1
  6. package/dist/407.cocolight-api-client.browser.js +1 -0
  7. package/dist/407.cocolight-api-client.mjs.js +1 -0
  8. package/dist/499.cocolight-api-client.browser.js +1 -0
  9. package/dist/499.cocolight-api-client.cjs +1 -0
  10. package/dist/499.cocolight-api-client.mjs.js +1 -0
  11. package/dist/556.cocolight-api-client.browser.js +1 -0
  12. package/dist/556.cocolight-api-client.cjs +1 -0
  13. package/dist/556.cocolight-api-client.mjs.js +1 -0
  14. package/dist/588.cocolight-api-client.mjs.js +1 -1
  15. package/dist/593.cocolight-api-client.mjs.js +1 -1
  16. package/dist/839.cocolight-api-client.mjs.js +1 -1
  17. package/dist/85.cocolight-api-client.browser.js +1 -0
  18. package/dist/85.cocolight-api-client.cjs +1 -0
  19. package/dist/85.cocolight-api-client.mjs.js +1 -0
  20. package/dist/906.cocolight-api-client.browser.js +1 -0
  21. package/dist/906.cocolight-api-client.cjs +1 -0
  22. package/dist/906.cocolight-api-client.mjs.js +1 -0
  23. package/dist/cocolight-api-client.browser.js +3 -3
  24. package/dist/cocolight-api-client.cjs +1 -1
  25. package/dist/cocolight-api-client.mjs.js +1 -1
  26. package/dist/cocolight-api-client.vite.mjs.js +1 -1
  27. package/dist/cocolight-api-client.vite.mjs.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/Api.ts +21 -2
  30. package/src/api/BaseEntity.ts +145 -4
  31. package/src/api/EndpointApi.ts +125 -1
  32. package/src/api/EndpointApi.types.ts +210 -1
  33. package/src/api/EntityRegistry.ts +11 -3
  34. package/src/api/Form.ts +60 -0
  35. package/src/api/User.ts +2 -0
  36. package/src/api/UserApi.ts +3 -2
  37. package/src/api/serverDataType/Form.ts +56 -0
  38. package/src/endpoints.module.ts +1 -1
  39. package/src/index.ts +3 -1
  40. package/src/types/entities.ts +3 -2
  41. package/types/Api.d.ts +7 -0
  42. package/types/api/BaseEntity.d.ts +99 -3
  43. package/types/api/EndpointApi.d.ts +77 -1
  44. package/types/api/EndpointApi.types.d.ts +194 -1
  45. package/types/api/EntityRegistry.d.ts +1 -1
  46. package/types/api/Form.d.ts +23 -0
  47. package/types/api/Organization.d.ts +1 -1
  48. package/types/api/User.d.ts +1 -0
  49. package/types/api/serverDataType/Form.d.ts +51 -0
  50. package/types/endpoints.module.d.ts +2994 -168
  51. package/types/index.d.ts +3 -1
  52. package/types/types/entities.d.ts +3 -2
package/src/index.ts CHANGED
@@ -73,6 +73,7 @@ export type { Badge } from "./api/Badge.js";
73
73
  export type { News } from "./api/News.js";
74
74
  export type { Comment } from "./api/Comment.js";
75
75
  export type { Answer } from "./api/Answer.js";
76
+ export type { Form } from "./api/Form.js";
76
77
 
77
78
  // Types ServerData (données normalisées reçues du serveur)
78
79
  export type * from "./api/serverDataType/User.js";
@@ -89,12 +90,13 @@ export type * from "./api/serverDataType/Poi.js";
89
90
  export type * from "./api/serverDataType/News.js";
90
91
  export type * from "./api/serverDataType/Comment.js";
91
92
  export type * from "./api/serverDataType/Answer.js";
93
+ export type * from "./api/serverDataType/Form.js";
92
94
  export type * from "./api/serverDataType/common.js";
93
95
  export type * from "./api/serverDataType/Country.js";
94
96
  export type * from "./api/serverDataType/Zone.js";
95
97
 
96
98
  // Types utilitaires
97
- export type { PaginatorPage, PaginatorState } from "./api/BaseEntity.js";
99
+ export type { PaginatorPage, PaginatorState, FundingEnvelopeResult } from "./api/BaseEntity.js";
98
100
 
99
101
  // Types de réponses, payloads, entités, et transforms
100
102
  export type * from "./types/index.js";
@@ -4,6 +4,7 @@ import type { Answer } from "../api/Answer.js";
4
4
  import type { Badge } from "../api/Badge.js";
5
5
  import type { Comment } from "../api/Comment.js";
6
6
  import type { Event } from "../api/Event.js";
7
+ import type { Form } from "../api/Form.js";
7
8
  import type { News } from "../api/News.js";
8
9
  import type { Organization } from "../api/Organization.js";
9
10
  import type { Poi } from "../api/Poi.js";
@@ -13,7 +14,7 @@ import type { User } from "../api/User.js";
13
14
  /**
14
15
  * Union type for all possible entity types
15
16
  */
16
- export type EntityTypes = User | Organization | Project | Event | Poi | Badge | News | Comment | Answer;
17
+ export type EntityTypes = User | Organization | Project | Event | Poi | Badge | News | Comment | Answer | Form;
17
18
 
18
19
  /**
19
20
  * Type union représentant les entités pouvant être retournées par une recherche.
@@ -33,7 +34,7 @@ export type EntityData =
33
34
  /**
34
35
  * Types de collection possibles
35
36
  */
36
- export type CollectionType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "badges" | "comments" | "answers";
37
+ export type CollectionType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "badges" | "comments" | "answers" | "forms";
37
38
 
38
39
  /**
39
40
  * Types pour les références entre entités
package/types/Api.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Answer } from "./api/Answer.js";
2
2
  import EndpointApi from "./api/EndpointApi.js";
3
3
  import { Event } from "./api/Event.js";
4
+ import { Form } from "./api/Form.js";
4
5
  import { Organization } from "./api/Organization.js";
5
6
  import { Poi } from "./api/Poi.js";
6
7
  import { Project } from "./api/Project.js";
@@ -58,6 +59,12 @@ export default class Api {
58
59
  answer(answerData: {
59
60
  id: string;
60
61
  }): Promise<Answer>;
62
+ /**
63
+ * Creates a new Form instance and optionally retrieves form data.
64
+ */
65
+ form(formData: {
66
+ id: string;
67
+ }): Promise<Form>;
61
68
  /**
62
69
  * Retourne une entité à partir d'un slug.
63
70
  */
@@ -1,4 +1,4 @@
1
- import type { UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, GetNewsData, GetGalleryData, GlobalAutocompleteCostumData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestDatesData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetOrganizationsAdminData, GetOrganizationsNoAdminData, GetProjectsAdminData, GetProjectsNoAdminData, GetPoisAdminData, GetPoisNoAdminData, GetSubscribersData, GetBadgesData, CoformAnswersSearchData, SearchMemberAutocompleteData, GetEventsData, CostumFilterCoformData, GetCountriesData, SearchZonesData } from "./EndpointApi.types.js";
1
+ import type { UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, GetNewsData, GetGalleryData, GlobalAutocompleteCostumData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestDatesData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetOrganizationsAdminData, GetOrganizationsNoAdminData, GetProjectsAdminData, GetProjectsNoAdminData, GetPoisAdminData, GetPoisNoAdminData, GetSubscribersData, GetBadgesData, CoformAnswersSearchData, SearchMemberAutocompleteData, GetEventsData, CostumFilterCoformData, GetCountriesData, SearchZonesData, CoformAnswersByFormsData, FundingEnvelopeData } from "./EndpointApi.types.js";
2
2
  import type { TransformsMap } from "../types/entities.js";
3
3
  import type { CountryItem } from "./serverDataType/Country.js";
4
4
  import type { ZoneItemNormalized } from "./serverDataType/Zone.js";
@@ -43,7 +43,8 @@ type News = import("./News.js").News;
43
43
  type Badge = import("./Badge.js").Badge;
44
44
  type Comment = import("./Comment.js").Comment;
45
45
  type Answer = import("./Answer.js").Answer;
46
- type AnyEntity = User | Organization | Project | Poi | EventEntity | Badge | News | Comment | Answer;
46
+ type Form = import("./Form.js").Form;
47
+ type AnyEntity = User | Organization | Project | Poi | EventEntity | Badge | News | Comment | Answer | Form;
47
48
  type ParentLike = BaseEntity<any> & {
48
49
  apiClient: ApiClient;
49
50
  userContext?: User | null;
@@ -63,6 +64,7 @@ interface Deps {
63
64
  News?: any;
64
65
  Comment?: any;
65
66
  Answer?: any;
67
+ Form?: any;
66
68
  }
67
69
  interface BaseEntityConfig {
68
70
  entityTag?: string;
@@ -77,6 +79,7 @@ interface EntityTypeMap {
77
79
  badges: Badge;
78
80
  comments: Comment;
79
81
  answers: Answer;
82
+ forms: Form;
80
83
  }
81
84
  type ReadableWithMeta = import("stream").Readable & {
82
85
  path?: string;
@@ -84,6 +87,17 @@ type ReadableWithMeta = import("stream").Readable & {
84
87
  };
85
88
  type UploadInput = File | Blob | Buffer | import("stream").Readable;
86
89
  type ValidatedUpload = File | Buffer | ReadableWithMeta;
90
+ export type FundingEnvelopeResult = {
91
+ contextData?: AnyEntity | object;
92
+ context?: AnyEntity | object;
93
+ links?: object;
94
+ form?: object;
95
+ paymentMethods?: object;
96
+ nopropProject?: AnyEntity[] | object;
97
+ projects?: AnyEntity[] | any[];
98
+ userOrga?: AnyEntity[] | object;
99
+ [k: string]: unknown;
100
+ };
87
101
  type PaginationCursor = {
88
102
  searchType?: string[];
89
103
  searchBy?: string;
@@ -1613,9 +1627,82 @@ export declare class BaseEntity<TServerData = any> {
1613
1627
  * @throws {Error}
1614
1628
  */
1615
1629
  costumEventRequestLoadContextTag(data?: Partial<Omit<CostumEventRequestLoadContextTagData, "pathParams">>): Promise<unknown>;
1630
+ /**
1631
+ * Recherche paginée des réponses CoForm liées à l'entité courante.
1632
+ * Injecte automatiquement le contexte (costumSlug, contextId, contextType) via `_withCostumContext`,
1633
+ * puis pagine via `_createPaginatorEngine`.
1634
+ *
1635
+ * `searchType` est pré-rempli à `["answers"]` si non fourni.
1636
+ * Les autres champs required (`indexStep`, `count`, `initType`, `fediverse`)
1637
+ * sont injectés automatiquement par AJV via les `default` du schema.
1638
+ *
1639
+ * @param data - Paramètres de recherche (partiels). Seuls `filters` et `fields` sont
1640
+ * généralement nécessaires côté appelant.
1641
+ * @param options - Options de pagination
1642
+ * @param options.restoredState - État de pagination à restaurer (pour reprendre une navigation)
1643
+ * @returns Première page paginée avec `results` (Answer[]), `count`, `hasNext`, `hasPrev`, etc.
1644
+ *
1645
+ * @example
1646
+ * const page = await organization.coformAnswersSearch({
1647
+ * filters: { form: "6927e9f0db22da724360303c" },
1648
+ * fields: ["vote", "voteCount", "user"],
1649
+ * sortBy: { created: -1 }
1650
+ * });
1651
+ * page.results; // Answer[]
1652
+ * page.count.total; // nombre total de résultats
1653
+ * page.hasNext; // true si une page suivante existe
1654
+ */
1616
1655
  coformAnswersSearch(data?: Partial<CoformAnswersSearchData>, options?: {
1617
1656
  restoredState?: PaginatorState;
1618
- }): Promise<PaginatorPage<any>>;
1657
+ }): Promise<PaginatorPage<Answer>>;
1658
+ /**
1659
+ * Récupère les réponses pour plusieurs formulaires CoForm.
1660
+ * Chaque entrée du résultat contient les `answers` liées en entités
1661
+ * et les `documents` associés.
1662
+ *
1663
+ * @param data - Paramètres de recherche
1664
+ * @param data.forms - Objet `{ [formId]: pathDeRecherche }` — au moins une entrée requise.
1665
+ * Chaque clé est un ObjectID de formulaire, chaque valeur est un chemin
1666
+ * dot-notation vers le champ answers (ex: `"answers.xxx.finderxxx.orgId"`).
1667
+ * @returns Tableau d'items par formulaire, avec `answers` transformées en entités
1668
+ * @throws {ApiError} Si `forms` est absent, vide, ou n'est pas un objet
1669
+ *
1670
+ * @example
1671
+ * const results = await organization.searchAnswersByForms({
1672
+ * forms: {
1673
+ * "646498a5f2b3d6423d74b7f6": "answers.formName.finderPath.orgId",
1674
+ * "645b300b6d70bb35426fc0e3": "answers.formName.finderPath.orgId"
1675
+ * }
1676
+ * });
1677
+ */
1678
+ searchAnswersByForms(data?: Partial<CoformAnswersByFormsData>): Promise<{
1679
+ answers: Answer[];
1680
+ documents: any[];
1681
+ [k: string]: unknown;
1682
+ }[]>;
1683
+ /**
1684
+ * Récupère les informations d'enveloppes de financement pour l'entité courante.
1685
+ * Injecte automatiquement le contexte (costumSlug, contextId, contextType) via `_withCostumContext`.
1686
+ *
1687
+ * Les champs `contextData`, `context`, `nopropProject`, `projects` et `userOrga`
1688
+ * de la réponse sont automatiquement liés en entités quand possible.
1689
+ *
1690
+ * @param data - Paramètres optionnels de recherche
1691
+ * @param data.action - Action à effectuer (`"getEnvelopeData"`, `"getFormData"`, etc.)
1692
+ * @param data.formId - ID du formulaire cible (pour `action: "getFormData"`)
1693
+ * @param data.financerId - ID du financeur pour filtrer
1694
+ * @param data.financerType - Type du financeur (ex: `"citoyens"`)
1695
+ * @param data.params - Paramètres supplémentaires (ex: `{ project: "all" }`)
1696
+ * @returns Données d'enveloppe avec entités liées
1697
+ *
1698
+ * @example
1699
+ * const envelope = await organization.fundingEnvelope({
1700
+ * action: "getEnvelopeData"
1701
+ * });
1702
+ * envelope.form; // données du formulaire
1703
+ * envelope.projects; // Project[] liés
1704
+ */
1705
+ fundingEnvelope(data?: Partial<Omit<FundingEnvelopeData, "contextId" | "contextType">>): Promise<FundingEnvelopeResult>;
1619
1706
  /**
1620
1707
  * Récupère les filtres disponibles basés sur les réponses CoForm de l'entité courante.
1621
1708
  * Utilise le contexte Communecter (costumSlug, contextId, contextType) de l'entité.
@@ -1665,6 +1752,15 @@ export declare class BaseEntity<TServerData = any> {
1665
1752
  * countries[0].countryCode; // "FR"
1666
1753
  */
1667
1754
  getCountries(data?: Partial<GetCountriesData>): Promise<CountryItem[]>;
1755
+ /**
1756
+ * Generer un nouveau identifiant unique pour un answers basé sur un formulaire donnée
1757
+ *
1758
+ * @param formId - Identifiant du formulaire pour lequel générer un nouvel ID d'answers
1759
+ * @returns Un nouvel answers avec le nouveau ID généré
1760
+ * @throws {ApiError} Si formId est absent ou invalide
1761
+ *
1762
+ */
1763
+ generateNewAnswerId(formId: string): Promise<any>;
1668
1764
  /**
1669
1765
  * ───────────────────────────────
1670
1766
  * Pagination restoration methods
@@ -1,5 +1,5 @@
1
1
  import type ApiClient from "../ApiClient.js";
2
- 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, CostumFilterCoformData, GetCountriesData, SearchZonesData } from "./EndpointApi.types.js";
2
+ 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 } from "./EndpointApi.types.js";
3
3
  /**
4
4
  * Classe EndpointApi générée automatiquement depuis endpoints-copie.json
5
5
  */
@@ -1009,6 +1009,45 @@ export declare class EndpointApi {
1009
1009
  * @throws {Error} - En cas d'erreur inattendue.
1010
1010
  */
1011
1011
  coformAnswersById(data: CoformAnswersByIdData): Promise<any>;
1012
+ /**
1013
+ * Récupérer un formulaire par son ID : Récupère les informations complètes d'un formulaire CoForm par son ID parent
1014
+ * Constant : GET_COFORM_BY_ID
1015
+ * @param data - Données envoyées à l'API
1016
+ * @returns Les données de réponse.
1017
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
1018
+ * @throws {Error} - En cas d'erreur inattendue.
1019
+ */
1020
+ getCoformById(data: GetCoformByIdData): Promise<any>;
1021
+ /**
1022
+ * Uploader un fichier de réponse CoForm : Endpoint de pré-upload CoForm (image/document). Si answerId est absent, l'endpoint crée un MongoId de réponse, réutilise la logique d'upload document existante et retourne answerId + docPath.
1023
+ * Constant : COFORM_UPLOAD_ANSWER_FILE
1024
+ * @param data - Données envoyées à l'API
1025
+ * @returns Les données de réponse.
1026
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
1027
+ * @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
1028
+ * @throws {Error} - En cas d'erreur inattendue.
1029
+ */
1030
+ coformUploadAnswerFile(data: CoformUploadAnswerFileData): Promise<any>;
1031
+ /**
1032
+ * Récupérer les fichiers d'une réponse CoForm : Récupère la liste des fichiers uploadés pour un input spécifique dans une réponse CoForm. Utilisé pour récupérer les fichiers de l'ancien système qui n'ont que 'updateDate' sans la clé 'files'.
1033
+ * Constant : COFORM_GET_ANSWER_FILES
1034
+ * @param data - Données envoyées à l'API
1035
+ * @returns Les données de réponse.
1036
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
1037
+ * @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
1038
+ * @throws {Error} - En cas d'erreur inattendue.
1039
+ */
1040
+ coformGetAnswerFiles(data: CoformGetAnswerFilesData): Promise<any>;
1041
+ /**
1042
+ * Sauvegarder une réponse de formulaire CoForm : Enregistre ou met à jour les réponses d'un utilisateur pour un formulaire CoForm
1043
+ * Constant : SAVE_COFORM_ANSWER
1044
+ * @param data - Données envoyées à l'API
1045
+ * @returns Les données de réponse.
1046
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
1047
+ * @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
1048
+ * @throws {Error} - En cas d'erreur inattendue.
1049
+ */
1050
+ saveCoformAnswer(data: SaveCoformAnswerData): Promise<any>;
1012
1051
  /**
1013
1052
  * Voter sur un élément (commentaire ou news) : Permet de voter sur un commentaire ou une news en spécifiant un statut de vote
1014
1053
  * Constant : ADD_VOTE
@@ -1049,6 +1088,16 @@ export declare class EndpointApi {
1049
1088
  * @throws {Error} - En cas d'erreur inattendue.
1050
1089
  */
1051
1090
  deleteDocumentByContext(data: DeleteDocumentByContextData): Promise<any>;
1091
+ /**
1092
+ * Supprimer un document par son ID : Supprime un document (fichier ou image) par son identifiant MongoDB
1093
+ * Constant : DELETE_DOCUMENT_BY_ID
1094
+ * @param data - Données envoyées à l'API
1095
+ * @returns Les données de réponse.
1096
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
1097
+ * @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
1098
+ * @throws {Error} - En cas d'erreur inattendue.
1099
+ */
1100
+ deleteDocumentById(data: DeleteDocumentByIdData): Promise<any>;
1052
1101
  /**
1053
1102
  * 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
1054
1103
  * Constant : DEMOTE_ADMIN
@@ -1086,5 +1135,32 @@ export declare class EndpointApi {
1086
1135
  * @throws {Error} - En cas d'erreur inattendue.
1087
1136
  */
1088
1137
  searchZones(data: SearchZonesData): Promise<any>;
1138
+ /**
1139
+ * Recuperer la liste des reponses pour plusieurs formulaires : Recuperer la liste des reponses pour plusieurs formulaires
1140
+ * Constant : COFORM_ANSWERS_BY_FORMS
1141
+ * @param data - Données envoyées à l'API
1142
+ * @returns Les données de réponse.
1143
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
1144
+ * @throws {Error} - En cas d'erreur inattendue.
1145
+ */
1146
+ coformAnswersByForms(data: CoformAnswersByFormsData): Promise<any>;
1147
+ /**
1148
+ * Generer une nouvelle reponse à partir d'un formulaire : Generer une nouvelle reponse à partir d'un formulaire
1149
+ * Constant : GENERATE_ANSWER_FROM_FORM
1150
+ * @param data - Données envoyées à l'API
1151
+ * @returns Les données de réponse.
1152
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
1153
+ * @throws {Error} - En cas d'erreur inattendue.
1154
+ */
1155
+ generateAnswerFromForm(data: GenerateAnswerFromFormData): Promise<any>;
1156
+ /**
1157
+ * Trouver les informations sur les enveloppes d’un formulaire : Trouver les informations sur les enveloppes d’un formulaire
1158
+ * Constant : FUNDING_ENVELOPE
1159
+ * @param data - Données envoyées à l'API
1160
+ * @returns Les données de réponse.
1161
+ * @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
1162
+ * @throws {Error} - En cas d'erreur inattendue.
1163
+ */
1164
+ fundingEnvelope(data: FundingEnvelopeData): Promise<any>;
1089
1165
  }
1090
1166
  export default EndpointApi;
@@ -2543,6 +2543,36 @@ export interface AddOrganizationData {
2543
2543
  float: true;
2544
2544
  [k: string]: unknown;
2545
2545
  };
2546
+ costum?: {
2547
+ bannerImageUrl?: string;
2548
+ bannerLogoUrl?: string;
2549
+ bannerText?: string;
2550
+ /**
2551
+ * Pour bien indiquer que l'orga est un commune transparente
2552
+ */
2553
+ transparentCommune?: boolean;
2554
+ /**
2555
+ * Pour bien indiquer que l'orga est un centre ville
2556
+ */
2557
+ cocity?: boolean;
2558
+ slug?: string;
2559
+ typeCocity?: string;
2560
+ [k: string]: unknown;
2561
+ };
2562
+ /**
2563
+ * Thématiques de l’organisation
2564
+ */
2565
+ thematic?: string[];
2566
+ /**
2567
+ * Dictionnaire de filières par thématique
2568
+ */
2569
+ filiere?: {
2570
+ [k: string]: {
2571
+ name: string;
2572
+ icon: string;
2573
+ tags: string[];
2574
+ };
2575
+ };
2546
2576
  address?: {
2547
2577
  "@type": "PostalAddress";
2548
2578
  addressCountry: string;
@@ -4441,6 +4471,100 @@ export interface CoformAnswersByIdData {
4441
4471
  * Liste des champs à retourner
4442
4472
  */
4443
4473
  fields?: string[];
4474
+ /**
4475
+ * ID du formulaire parent (utilisé pour calculer les droits d'édition côté serveur)
4476
+ */
4477
+ formId?: string;
4478
+ [k: string]: unknown;
4479
+ }
4480
+ export interface GetCoformByIdData {
4481
+ /**
4482
+ * ID du formulaire parent à récupérer
4483
+ */
4484
+ parentFormId: string;
4485
+ [k: string]: unknown;
4486
+ }
4487
+ export interface CoformUploadAnswerFileData {
4488
+ /**
4489
+ * ID du formulaire parent (pour contrôles d'accès).
4490
+ */
4491
+ formId: string;
4492
+ /**
4493
+ * ID de réponse existant. Si absent, un MongoId est généré côté serveur.
4494
+ */
4495
+ answerId?: string;
4496
+ /**
4497
+ * Type de document à uploader.
4498
+ */
4499
+ docType?: "image" | "file";
4500
+ /**
4501
+ * Clé de contenu (ex: slider pour images).
4502
+ */
4503
+ contentKey?: string;
4504
+ /**
4505
+ * Sous-clé optionnelle pour rattachement du document.
4506
+ */
4507
+ subKey?: string;
4508
+ /**
4509
+ * UUID client du fichier (compat fine-uploader).
4510
+ */
4511
+ qquuid: string;
4512
+ /**
4513
+ * Nom original du fichier.
4514
+ */
4515
+ qqfilename: string;
4516
+ /**
4517
+ * Taille du fichier en octets.
4518
+ */
4519
+ qqtotalfilesize: number;
4520
+ /**
4521
+ * Fichier binaire multipart.
4522
+ */
4523
+ qqfile: {
4524
+ [k: string]: unknown;
4525
+ };
4526
+ [k: string]: unknown;
4527
+ }
4528
+ export interface CoformGetAnswerFilesData {
4529
+ /**
4530
+ * ID de la réponse CoForm
4531
+ */
4532
+ answerId: string;
4533
+ /**
4534
+ * Clé d'identification de l'input (ex: formId.inputId)
4535
+ */
4536
+ subKey: string;
4537
+ /**
4538
+ * Clé de contenu utilisée lors de l'upload
4539
+ */
4540
+ contentKey?: string;
4541
+ /**
4542
+ * Type de document à récupérer
4543
+ */
4544
+ docType?: "image" | "file";
4545
+ [k: string]: unknown;
4546
+ }
4547
+ export interface SaveCoformAnswerData {
4548
+ /**
4549
+ * ID du formulaire parent
4550
+ */
4551
+ formId: string;
4552
+ /**
4553
+ * Réponses du formulaire sérialisées en JSON, organisées par subFormId > inputId > valeur
4554
+ */
4555
+ answers: string;
4556
+ /**
4557
+ * ID d'une réponse existante (pour mise à jour)
4558
+ */
4559
+ answerId?: string;
4560
+ /**
4561
+ * Options ajoutées dynamiquement sérialisées en JSON (pour multiCheckboxPlus avec addValue)
4562
+ */
4563
+ addedOptions?: string;
4564
+ /**
4565
+ * Links des champs Finder sérialisés en JSON (pour answer.links). Format: { "organizations": { "mongoId": { "name": "...", "type": "organizations" } } }
4566
+ */
4567
+ links?: string;
4444
4568
  [k: string]: unknown;
4445
4569
  }
4446
4570
  export interface AddVoteData {
@@ -4497,7 +4621,7 @@ export interface UpdatePathValueData {
4497
4621
  /**
4498
4622
  * Collection de l’entité
4499
4623
  */
4500
- collection: "citoyens" | "organizations" | "projects" | "events" | "poi";
4624
+ collection: "citoyens" | "organizations" | "projects" | "events" | "poi" | "answers" | "forms";
4501
4625
  /**
4502
4626
  * Chemin de la valeur à mettre à jour
4503
4627
  */
@@ -4538,6 +4662,16 @@ export interface DeleteDocumentByContextData {
4538
4662
  };
4539
4663
  [k: string]: unknown;
4540
4664
  }
4665
+ export interface DeleteDocumentByIdData {
4666
+ pathParams?: {
4667
+ /**
4668
+ * ID MongoDB du document à supprimer
4669
+ */
4670
+ id: string;
4671
+ [k: string]: unknown;
4672
+ };
4673
+ [k: string]: unknown;
4674
+ }
4541
4675
  export interface DemoteAdminData {
4542
4676
  parentId: string;
4543
4677
  /**
@@ -4621,3 +4755,62 @@ export interface SearchZonesData {
4621
4755
  costumType?: string;
4622
4756
  [k: string]: unknown;
4623
4757
  }
4758
+ export interface CoformAnswersByFormsData {
4759
+ /**
4760
+ * Liste des IDs de formulaires pour lesquels récupérer les réponses et le champ de recherche
4761
+ */
4762
+ forms?: {
4763
+ /**
4764
+ * This interface was referenced by `undefined`'s JSON-Schema definition
4765
+ * via the `patternProperty` "^[a-fA-F0-9]{24}$".
4766
+ */
4767
+ [k: string]: string;
4768
+ };
4769
+ [k: string]: unknown;
4770
+ }
4771
+ export interface GenerateAnswerFromFormData {
4772
+ action?: string;
4773
+ pathParams?: {
4774
+ /**
4775
+ * ID du formulaire pour lequel générer une nouvelle réponse
4776
+ */
4777
+ formId: string;
4778
+ [k: string]: unknown;
4779
+ };
4780
+ [k: string]: unknown;
4781
+ }
4782
+ export interface FundingEnvelopeData {
4783
+ /**
4784
+ * ID du contexte de l’entité
4785
+ */
4786
+ contextId: string;
4787
+ /**
4788
+ * Type de contexte de l’entité
4789
+ */
4790
+ contextType: string;
4791
+ /**
4792
+ * ID du formulaire pour lequel générer une nouvelle réponse
4793
+ */
4794
+ formId?: string;
4795
+ action?: string;
4796
+ /**
4797
+ * ID du projet
4798
+ */
4799
+ project?: string;
4800
+ /**
4801
+ * ID de la réponse
4802
+ */
4803
+ answer?: string;
4804
+ /**
4805
+ * ID du financeur
4806
+ */
4807
+ financerId?: string;
4808
+ financerType?: string;
4809
+ /**
4810
+ * Paramètres supplémentaires pour la recherche d’enveloppes
4811
+ */
4812
+ params?: {
4813
+ [k: string]: unknown;
4814
+ };
4815
+ [k: string]: unknown;
4816
+ }
@@ -1,5 +1,5 @@
1
1
  import type { CollectionType } from "../types/entities.js";
2
- export type EntityTag = "User" | "Organization" | "Project" | "Event" | "Poi" | "Badge" | "News" | "Comment" | "Answer";
2
+ export type EntityTag = "User" | "Organization" | "Project" | "Event" | "Poi" | "Badge" | "News" | "Comment" | "Answer" | "Form";
3
3
  export type CollectionKey = CollectionType;
4
4
  type BaseEntity = import("./BaseEntity.js").BaseEntity<any>;
5
5
  type ApiClient = import("../ApiClient.js").default;
@@ -0,0 +1,23 @@
1
+ import { BaseEntity } from "./BaseEntity.js";
2
+ import type { FormItemNormalized } from "./serverDataType/Form.js";
3
+ export declare class Form extends BaseEntity<FormItemNormalized> {
4
+ static entityType: string;
5
+ static entityTag: string;
6
+ static SCHEMA_CONSTANTS: string[];
7
+ static ADD_BLOCKS: Map<string, string>;
8
+ static UPDATE_BLOCKS: Map<string, string>;
9
+ defaultFields: Record<string, any>;
10
+ removeFields: string[];
11
+ /**
12
+ * Transforme les champs imbriqués en instances d'entités si nécessaire.
13
+ * @param data - Les données brutes du serveur.
14
+ * @returns Les données transformées.
15
+ * @protected
16
+ */
17
+ protected _transformServerData(data: FormItemNormalized): FormItemNormalized;
18
+ /**
19
+ * Rafraîchit les données du formulaire depuis l'API.
20
+ * Constant : GET_COFORM_BY_ID
21
+ */
22
+ get(): Promise<Record<string, any>>;
23
+ }
@@ -295,5 +295,5 @@ export declare class Organization extends BaseEntity<OrganizationItemNormalized>
295
295
  *
296
296
  * Cette méthode est redéfinie ici pour fournir des types spécifiques à l'entité Answer.
297
297
  */
298
- coformAnswersSearch(data: Parameters<BaseEntity<OrganizationItemNormalized>["coformAnswersSearch"]>[0]): Promise<PaginatorPage<any>>;
298
+ coformAnswersSearch(data: Parameters<BaseEntity<OrganizationItemNormalized>["coformAnswersSearch"]>[0]): Promise<PaginatorPage<import("./Answer.js").Answer>>;
299
299
  }
@@ -44,6 +44,7 @@ export declare class User extends BaseEntity<UserItemNormalized> {
44
44
  Badge: typeof import("./Badge.js").Badge;
45
45
  News: typeof import("./News.js").News;
46
46
  Comment: typeof import("./Comment.js").Comment;
47
+ Answer: typeof import("./Answer.js").Answer;
47
48
  });
48
49
  get slug(): any;
49
50
  get isMe(): boolean;
@@ -0,0 +1,51 @@
1
+ import { DateValue, IdObject, ParentsMap } from "./common.js";
2
+ import type EJSONType from "../../EJSONType.js";
3
+ type ObjectIDCtor = typeof EJSONType["ObjectID"];
4
+ type ObjectID = InstanceType<ObjectIDCtor>;
5
+ export interface FormSubFormInputField {
6
+ label?: string;
7
+ placeholder?: string;
8
+ info?: string;
9
+ type?: string;
10
+ positions?: Record<string, string>;
11
+ markdown?: boolean;
12
+ uploader?: Record<string, any>;
13
+ [key: string]: unknown;
14
+ }
15
+ export interface FormSubFormInputs {
16
+ name: string;
17
+ info?: string;
18
+ id: string;
19
+ formParent: string;
20
+ hasMultiEval?: boolean;
21
+ inputs: Record<string, FormSubFormInputField>;
22
+ [key: string]: unknown;
23
+ }
24
+ export interface FormItemJson {
25
+ _id: IdObject;
26
+ config?: string | null;
27
+ parent?: ParentsMap | null;
28
+ subForms?: string[] | null;
29
+ type: string;
30
+ created?: DateValue;
31
+ creator?: string;
32
+ params?: Record<string, unknown> | null;
33
+ updated?: DateValue;
34
+ inputs?: Record<string, FormSubFormInputs> | null;
35
+ [key: string]: unknown;
36
+ }
37
+ export interface FormItemNormalized {
38
+ id: string;
39
+ _id: ObjectID;
40
+ config?: string | null;
41
+ parent?: ParentsMap | null;
42
+ subForms?: string[] | null;
43
+ type: string;
44
+ created?: Date;
45
+ creator?: string;
46
+ params?: Record<string, unknown> | null;
47
+ updated?: Date;
48
+ inputs?: Record<string, FormSubFormInputs> | null;
49
+ [key: string]: unknown;
50
+ }
51
+ export {};