@communecter/cocolight-api-client 1.0.4 → 1.0.5
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={d:(t,r)=>{for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>m});const r=require("events"),i=require("ajv"),s=require("ajv-formats"),o=require("axios"),n=require("axios-retry"),p=require("ejson"),a=require("pino"),d={_looksLikeObjectID:e=>24===e.length&&/^[0-9a-f]*$/.test(e),ObjectID:class{constructor(e){if(e){if(e=e.toLowerCase(),!d._looksLikeObjectID(e))throw new Error("Invalid hexadecimal string for creating an ObjectID");this._str=e}}equals(e){return e instanceof d.ObjectID&&this.valueOf()===e.valueOf()}toString(){return`ObjectID("${this._str}")`}clone(){return new d.ObjectID(this._str)}typeName(){return"oid"}getTimestamp(){return Number.parseInt(this._str.substr(0,8),16)}valueOf(){return this._str}toJSONValue(){return this.valueOf()}toHexString(){return this.valueOf()}}},c=d,l=[{name:"Enregistrement d'un utilisateur",path:"/co2/person/register",constant:"PERSON_REGISTER",method:"POST",auth:"none",description:"Permet d’enregistrer un nouvel utilisateur avec ses informations personnelles.",contentType:"application/x-www-form-urlencoded",request:{type:"object",description:"Permet d’enregistrer un nouvel utilisateur avec ses informations personnelles.",properties:{name:{type:"string",description:"Nom complet de l'utilisateur"},username:{type:"string",description:"Pseudo ou identifiant unique"},email:{type:"string",format:"email",description:"Adresse email de l'utilisateur"},pwd:{type:"string",description:"Mot de passe"},app:{type:"string",description:"Nom de l'application"},pendingUserId:{type:"string",description:"ID d’un utilisateur en attente (facultatif)"},mode:{type:"string",description:"Mode d’enregistrement"},isInvitation:{type:"boolean",description:"Indique s’il s’agit d’une invitation (facultatif)"}},required:["name","username","email","pwd"],additionalProperties:!1},responses:{200:{oneOf:[{description:"Réponse en cas de succès lors de la création d'un utilisateur",type:"object",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},id:{type:"string"},person:{type:"object",properties:{name:{type:"string"},username:{type:"string"},pwd:{type:"string"},email:{type:"string",format:"email"},_id:{type:"string"}},required:["name","username","pwd","email","_id"]}},required:["result","msg","id","person"],additionalProperties:!1},{description:"Réponse en cas d'erreur lors de la création d'un utilisateur",type:"object",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"],additionalProperties:!1}]}}},{name:"Authentification",path:"/api/cocolight/authenticate",constant:"AUTHENTICATE_URL",method:"POST",auth:"none",description:"Permet de se connecter en utilisant une adresse email et un mot de passe.",contentType:"application/json",postActions:[{type:"setToken",path:"accessToken"},{type:"setRefreshToken",path:"refreshToken"},{type:"setUserId",path:"user.id"},{type:"emitEvent",event:"userLoggedIn",payloadPath:"user"}],request:{type:"object",description:"Permet de se connecter en utilisant une adresse email et un mot de passe.",properties:{email:{type:"string",format:"email",description:"Adresse email de l'utilisateur"},password:{type:"string",description:"Mot de passe de l'utilisateur"}},required:["email","password"],additionalProperties:!1},responses:{200:{type:"object",description:"Objet data renvoyé après une authentification réussie.",properties:{user:{type:"object",properties:{id:{type:"string",description:"Identifiant unique de l'utilisateur"},username:{type:"string",description:"Pseudo ou nom d'utilisateur"},email:{type:"string",format:"email",description:"Adresse email de l'utilisateur"},roles:{type:"object",properties:{betaTester:{type:"boolean"},standalonePageAccess:{type:"boolean"},superAdmin:{type:"boolean"}}},timezone:{type:"string",description:"Fuseau horaire de l'utilisateur"},lastLoginDate:{type:"integer",description:"Timestamp Unix du dernier login"},profilImageUrl:{anyOf:[{type:"string",format:"uri"},{type:"string",enum:[""]}],description:"URL de l'image de profil utilisateur, ou chaîne vide"}},required:["id","username","email","roles"],additionalProperties:!1},accessToken:{type:"string",description:"Token JWT d'accès"},refreshToken:{type:"string",description:"Token JWT pour rafraîchir l'access token"},status:{type:"integer",description:"Code de statut personnalisé renvoyé par l'API"}},required:["user","accessToken","refreshToken","status"],additionalProperties:!1},401:{type:"object",description:"Erreur d'authentification (identifiants incorrects)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Rafraîchir un token",path:"/api/cocolight/refreshtoken",constant:"REFRESH_TOKEN_URL",method:"POST",auth:"none",description:"Permet de rafraîchir un token d'accès expiré en utilisant un token de rafraîchissement.",contentType:"application/json",request:{type:"object",description:"Permet de rafraîchir un token d'accès expiré en utilisant un token de rafraîchissement.",properties:{refreshToken:{type:"string",description:"Token de rafraîchissement"}},required:["refreshToken"],additionalProperties:!1},responses:{200:{type:"object",description:"Objet data renvoyé après un rafraîchissement réussi.",properties:{token:{type:"string",description:"Token JWT d'accès"},refreshToken:{type:"string",description:"Token JWT pour rafraîchir l'access token"}},required:["token","refreshToken"],additionalProperties:!1},401:{type:"object",description:"Erreur de rafraîchissement (token invalide ou expiré)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Récupérer les informations utilisateur",path:"/api/cocolight/me",constant:"ME_INFO_URL",method:"POST",auth:"bearer",description:"Récupère les informations du profil utilisateur pour un token donné.",contentType:"application/json",responses:{200:{$defs:{dateObject:{description:"Peut être un objet { sec, usec } ou un timestamp entier (sec)",oneOf:[{type:"object",required:["sec","usec"],properties:{sec:{type:"number"},usec:{type:"number"}},additionalProperties:!1},{type:"integer"}]},_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1}},type:"object",description:"Schéma JSON pour les informations détaillées d'un utilisateur.",properties:{_id:{$ref:"#/$defs/_idObject"},username:{type:"string"},email:{type:"string",format:"email"},name:{type:"string"},slug:{type:"string"},collection:{type:"string"},modified:{$ref:"#/$defs/dateObject"},roles:{type:"object",properties:{betaTester:{type:"boolean"},standalonePageAccess:{type:"boolean"},superAdmin:{type:"boolean"}}},preferences:{type:"object",properties:{privateFields:{type:"array",items:{type:"string"}},publicFields:{type:"array",items:{type:"string"}},isOpenData:{type:"boolean"},badge:{type:"boolean"},sendMail:{oneOf:[{type:"object",properties:{source:{type:"array",items:{}}},required:["source"],additionalProperties:!1},{type:"boolean",const:!1}]},activitypub:{type:"boolean"},activitypubStarterClosed:{type:"boolean"},notifications:{type:"array",items:{}}},required:["isOpenData","sendMail"]},language:{type:"string"},profilImageUrl:{type:"string"},profilMarkerImageUrl:{type:"string",format:"uri-reference"},profilMediumImageUrl:{type:"string",format:"uri-reference"},profilThumbImageUrl:{type:"string",format:"uri-reference"},profilBannerUrl:{type:"string",format:"uri-reference"},profilRealBannerUrl:{type:"string",format:"uri-reference"},shortDescription:{type:"string"},description:{type:"string"},tags:{type:"array",items:{type:"string"}},birthDate:{type:"object",properties:{sec:{type:"integer"},usec:{type:"integer"}},required:["sec","usec"],additionalProperties:!1}},required:["_id","name","email","username","roles","collection","preferences","slug"]},401:{type:"object",description:"Erreur d'authentification (token invalide ou expiré)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Récupération de mot de passe",path:"/co2/person/sendemail",constant:"PASSWORD_RECOVERY",method:"POST",auth:"none",description:"Envoie un email pour récupérer le mot de passe.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{email:{type:"string",format:"email",description:"Adresse email de l'utilisateur"},type:{type:"string",description:"Type d'email envoyé",const:"password",default:"password"}},required:["email","type"],additionalProperties:!1},responses:{200:{oneOf:[{description:"Erreur: email non trouvé dans la base",type:"object",properties:{result:{type:"boolean",const:!1},errId:{type:"string",const:"UNKNOWN_ACCOUNT_ID"},msg:{type:"string"}},required:["result","errId","msg"],additionalProperties:!1},{description:"Succès: email de récupération envoyé",type:"object",properties:{result:{type:"boolean",const:!0},msg:{type:"string"}},required:["result","msg"],additionalProperties:!1}]}}},{name:"Échange de token avec un autre serveur",path:"/api/cocolight/exchangetoken",constant:"SERVER_EXCHANGE_TOKEN",method:"POST",auth:"bearer",description:"Permet de se connecter à un autre serveur Communecter en échangeant un token.",contentType:"application/json",request:{type:"object",properties:{serverUrl:{type:"string",description:"URL du serveur distant"}},required:["serverUrl"],additionalProperties:!1},responses:{200:{type:"object",description:"Objet data renvoyé après une authentification réussie.",properties:{user:{type:"object",properties:{id:{type:"string",description:"Identifiant unique de l'utilisateur"},username:{type:"string",description:"Pseudo ou nom d'utilisateur"},email:{type:"string",format:"email",description:"Adresse email de l'utilisateur"},roles:{type:"object",properties:{betaTester:{type:"boolean"},standalonePageAccess:{type:"boolean"},superAdmin:{type:"boolean"}}},timezone:{type:"string",description:"Fuseau horaire de l'utilisateur"},lastLoginDate:{type:"integer",description:"Timestamp Unix du dernier login"},profilImageUrl:{type:"string",format:"uri",description:"URL de l'image de profil utilisateur"}},required:["id","username","email","roles"],additionalProperties:!1},accessToken:{type:"string",description:"Token JWT d'accès"},refreshToken:{type:"string",description:"Token JWT pour rafraîchir l'access token"},status:{type:"integer",description:"Code de statut personnalisé renvoyé par l'API"}},required:["user","accessToken","refreshToken","status"],additionalProperties:!1},401:{type:"object",description:"Erreur d'authentification (token invalide ou expiré)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Changer le mot de passe",path:"/co2/person/changepassword",constant:"CHANGE_PASSWORD",method:"POST",auth:"bearer",description:"Permet de changer le mot de passe d'un utilisateur.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{mode:{type:"string",description:"Mode ou contexte du changement",const:"changePassword",default:"changePassword"},userId:{type:"string",description:"Identifiant de l'utilisateur",default:"@userId"},oldPassword:{type:"string",description:"Ancien mot de passe"},newPassword:{type:"string",description:"Nouveau mot de passe"},newPassword2:{type:"string",description:"Confirmation du nouveau mot de passe"},scope:{type:["string"],description:"Périmètre concerné",default:""}},required:["mode","userId","oldPassword","newPassword","newPassword2"],additionalProperties:!1},responses:{200:{oneOf:[{description:"Réponse en cas de succès lors du changement de mot de passe",type:"object",properties:{result:{type:"boolean",const:!0},msg:{type:"string"}},required:["result","msg"],additionalProperties:!1},{description:"Réponse en cas d'erreur lors du changement de mot de passe",type:"object",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"],additionalProperties:!1}]},401:{type:"object",description:"Erreur d'authentification (token invalide ou expiré)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Supprimer un compte",path:"/co2/element/delete/id/{id}/type/citoyens",constant:"DELETE_ACCOUNT",method:"POST",auth:"bearer",description:"Permet de supprimer un compte utilisateur.",contentType:"application/x-www-form-urlencoded",postActions:[{type:"resetSession"},{type:"emitEvent",event:"accountDeleted",path:null}],pathParams:{type:"object",properties:{id:{type:"string",description:"Identifiant de l'utilisateur à supprimer",default:"@userId"}},required:["id"],additionalProperties:!1},request:{type:"object",properties:{reason:{type:"string",description:"Raison de la suppression",default:""}},required:["reason"],additionalProperties:!1},responses:{200:{type:"object",description:"Réponse après la suppression du compte",properties:{result:{type:"boolean",const:!0},msg:{type:"string"}},required:["result","msg"],additionalProperties:!1},401:{type:"object",description:"Erreur d'authentification (token invalide ou expiré)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Mettre à jour les paramètres utilisateur",path:"/co2/element/updatesettings",constant:"UPDATE_SETTINGS",method:"POST",auth:"bearer",description:"Mise à jour des paramètres spécifiques d'un utilisateur.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{type:{type:"string"},value:{},typeEntity:{type:"string",default:"citoyens"},idEntity:{type:"string"}},required:["type","value","typeEntity","idEntity"],additionalProperties:!1,allOf:[{if:{properties:{typeEntity:{const:"citoyens"}}},then:{properties:{idEntity:{type:"string",default:"@userId"}}}},{if:{properties:{typeEntity:{const:"citoyens"},type:{enum:["birthDate","email","locality","phone","directory"]}}},then:{properties:{value:{type:"string",enum:["private","public","mask"]}}}},{if:{properties:{typeEntity:{const:"citoyens"},type:{enum:["activitypub","isOpenData"]}}},then:{properties:{value:{type:"boolean"}}}},{if:{properties:{typeEntity:{not:{const:"citoyens"}},type:{enum:["isOpenData","isOpenEdition","private","feedback"]}}},then:{properties:{value:{type:"boolean"}}}}]},responses:{200:{type:"object",description:"Réponse après la mise à jour des paramètres",properties:{result:{type:"boolean",const:!0},msg:{type:"string"}},required:["result","msg"],additionalProperties:!1},401:{type:"object",description:"Erreur d'authentification (token invalide ou expiré)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Mettre à jour la description d'un élément",path:"/co2/element/updateblock/",constant:"UPDATE_BLOCK_DESCRIPTION",constantCocolight:"UPDATE_BLOCK",method:"POST",auth:"bearer",description:"Permet de mettre à jour la description courte et complète d'un élément.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{block:{type:"string",const:"descriptions",default:"descriptions",description:"Nom du bloc à mettre à jour (doit être 'descriptions')"},typeElement:{type:"string",default:"citoyens",enum:["citoyens","projects","organizations"],description:"Type d'élément (citoyens, projects, organizations)"},id:{type:"string",description:"ID de l'élément concerné"},scope:{type:["string","null"],default:"",description:"Périmètre de mise à jour",$comment:"Non utilisé dans l'application Cocolight"},descMentions:{type:"string",description:"Mentions dans la description",default:"",$comment:"Non utilisé dans l'application Cocolight"},shortDescription:{type:"string",description:"Courte description"},description:{type:"string",description:"Description complète"}},required:["block","typeElement","id"],additionalProperties:!1,allOf:[{if:{properties:{typeElement:{const:"citoyens"}}},then:{properties:{id:{type:"string",default:"@userId"}}}},{anyOf:[{required:["description"],properties:{description:{not:{type:"null"}}}},{required:["shortDescription"],properties:{shortDescription:{not:{type:"null"}}}}]}]},responses:{200:{type:"object",description:"Réponse après la mise à jour de la description",properties:{result:{type:"boolean",const:!0},resultGoods:{type:"object",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},values:{type:"object",properties:{shortDescription:{type:["string","null"]},description:{type:["string","null"]}},additionalProperties:!0}},required:["result","msg"],additionalProperties:!0}},required:["result","resultGoods"],additionalProperties:!1},401:{type:"object",description:"Erreur d'authentification (token invalide ou expiré)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Mettre à jour les informations d'un élément",path:"/co2/element/updateblock/",constant:"UPDATE_BLOCK_INFO",constantCocolight:"UPDATE_BLOCK",method:"POST",auth:"bearer",description:"Permet de mettre à jour les informations générales d'un élément (nom, contacts, etc.).",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{block:{type:"string",const:"info",default:"info",description:"Nom du bloc à mettre à jour (doit être 'info')"},typeElement:{type:"string",default:"citoyens",enum:["citoyens","projects","organizations"],description:"Type d'élément (citoyens, projects, organizations)"},id:{type:"string",description:"ID de l'élément concerné"},scope:{type:"string",default:"",description:"Périmètre de mise à jour"}},required:["block","typeElement","id"],$defs:{sharedFields:{name:{type:"string",description:"Nom de l'entité"},url:{type:"string",format:"uri",description:"Lien vers le site ou la page publique"},email:{type:"string",format:"email",description:"Adresse email"},tags:{anyOf:[{type:"array",items:{type:"string"}},{type:"string",enum:[""]}],description:'Tags : "" pour effacer tous les tags, ou tableau de mots-clés.'}}},allOf:[{if:{properties:{typeElement:{const:"citoyens"}}},then:{properties:{block:{type:"string",const:"info",default:"info",description:"Nom du bloc à mettre à jour (doit être 'info')"},typeElement:{type:"string",default:"citoyens",enum:["citoyens","projects","organizations"],description:"Type d'élément (citoyens, projects, organizations)"},scope:{type:"string",default:"",description:"Périmètre de mise à jour"},id:{type:"string",description:"ID de l'élément concerné",default:"@userId"},name:{$ref:"#/$defs/sharedFields/name"},email:{$ref:"#/$defs/sharedFields/email"},url:{$ref:"#/$defs/sharedFields/url"},tags:{$ref:"#/$defs/sharedFields/tags"},birthDate:{type:"string",format:"date",description:"Date de naissance"},fixe:{type:"string",description:"Téléphone fixe"},mobile:{type:"string",description:"Téléphone mobile"}},anyOf:[{required:["name"],properties:{name:{not:{type:"null"}}}},{required:["birthDate"],properties:{birthDate:{not:{type:"null"}}}},{required:["fixe"],properties:{fixe:{not:{type:"null"}}}},{required:["mobile"],properties:{mobile:{not:{type:"null"}}}},{required:["url"],properties:{url:{not:{type:"null"}}}},{required:["tags"],properties:{tags:{not:{type:"null"}}}},{required:["email"],properties:{email:{not:{type:"null"}}}}],additionalProperties:!1}},{if:{properties:{typeElement:{const:"projects"}}},then:{properties:{block:{type:"string",const:"info",default:"info",description:"Nom du bloc à mettre à jour (doit être 'info')"},typeElement:{type:"string",default:"citoyens",enum:["citoyens","projects","organizations"],description:"Type d'élément (citoyens, projects, organizations)"},id:{type:"string",description:"ID de l'élément concerné"},scope:{type:"string",default:"",description:"Périmètre de mise à jour"},name:{$ref:"#/$defs/sharedFields/name"},email:{$ref:"#/$defs/sharedFields/email"},url:{$ref:"#/$defs/sharedFields/url"},tags:{$ref:"#/$defs/sharedFields/tags"},avancement:{type:"string",enum:["abandoned","concept","development","production","started","testing","idea","mature","qa","finished"],description:"État d'avancement du projet"},parent:{type:"object",patternProperties:{"^[a-fA-F0-9]{24}$":{type:"object",properties:{type:{type:"string",description:"Type d'entité parent"},name:{type:"string",description:"Nom de l'entité parent"}},required:["type","name"],additionalProperties:!1}},additionalProperties:!1,description:"Objet contenant les entités parentes (clé = ID). null signifie que les parents ne sont pas modifiés."}},anyOf:[{required:["name"],properties:{name:{not:{type:"null"}}}},{required:["url"],properties:{url:{not:{type:"null"}}}},{required:["tags"],properties:{tags:{not:{type:"null"}}}},{required:["email"],properties:{email:{not:{type:"null"}}}},{required:["avancement"],properties:{avancement:{not:{type:"null"}}}},{required:["parent"],properties:{parent:{not:{type:"null"}}}}],additionalProperties:!1}},{if:{properties:{typeElement:{const:"organizations"}}},then:{properties:{block:{type:"string",const:"info",default:"info",description:"Nom du bloc à mettre à jour (doit être 'info')"},typeElement:{type:"string",default:"citoyens",enum:["citoyens","projects","organizations"],description:"Type d'élément (citoyens, projects, organizations)"},id:{type:"string",description:"ID de l'élément concerné"},scope:{type:"string",default:"",description:"Périmètre de mise à jour"},name:{$ref:"#/$defs/sharedFields/name"},email:{$ref:"#/$defs/sharedFields/email"},url:{$ref:"#/$defs/sharedFields/url"},tags:{$ref:"#/$defs/sharedFields/tags"},type:{type:"string",enum:["NGO","Cooperative","LocalBusiness","GovernmentOrganizationautre"],description:"Type d'organisation (ex. association, entreprise)"}},anyOf:[{required:["name"],properties:{name:{not:{type:"null"}}}},{required:["url"],properties:{url:{not:{type:"null"}}}},{required:["tags"],properties:{tags:{not:{type:"null"}}}},{required:["email"],properties:{email:{not:{type:"null"}}}},{required:["type"],properties:{type:{not:{type:"null"}}}}],additionalProperties:!1}}]},responses:{200:{oneOf:[{type:"object",properties:{result:{type:"boolean",const:!0},resultGoods:{type:"object",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},values:{type:"object",description:"Contient les champs mis à jour",additionalProperties:!0,$comment:"Ce schéma n'est pas encore complet"}},required:["result","msg"],additionalProperties:!0}},required:["result","resultGoods"],additionalProperties:!1},{type:"object",properties:{resultErrors:{type:"object",properties:{result:{type:"boolean",const:!1},msg:{type:"string",description:"Message d'erreur"}},required:["result","msg"],additionalProperties:!0}},required:["resultErrors"],additionalProperties:!1}]},401:{type:"object",description:"Erreur d'authentification (token invalide ou expiré)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Mettre à jour les réseaux sociaux d'un élément",path:"/co2/element/updateblock/",constant:"UPDATE_BLOCK_SOCIAL",constantCocolight:"UPDATE_BLOCK",method:"POST",auth:"bearer",description:"Permet de mettre à jour les liens vers les réseaux sociaux d'un élément.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{block:{type:"string",const:"network",default:"network",description:"Nom du bloc à mettre à jour (doit être 'network')"},typeElement:{type:"string",default:"citoyens",enum:["citoyens","projects","organizations"],description:"Type d'élément (citoyens, projects, organizations)"},id:{type:"string",description:"ID de l'élément concerné"},scope:{type:"string",default:"",description:"Périmètre de mise à jour"},gitlab:{$ref:"#/$defs/socialField",description:"Compte Gitlab"},github:{$ref:"#/$defs/socialField",description:"Compte Github"},twitter:{$ref:"#/$defs/socialField",description:"Compte Twitter"},facebook:{$ref:"#/$defs/socialField",description:"Compte Facebook"},instagram:{$ref:"#/$defs/socialField",description:"Compte Instagram"},diaspora:{$ref:"#/$defs/socialField",description:"Compte Diaspora"},mastodon:{$ref:"#/$defs/socialField",description:"Compte Mastodon"},telegram:{$ref:"#/$defs/socialField",description:"Compte Telegram"},signal:{$ref:"#/$defs/socialField",description:"Compte Signal"}},required:["block","typeElement","id"],$defs:{socialField:{anyOf:[{type:"string",enum:[""],description:"Vide pour effacer le champ"},{type:"string",format:"uri",description:"URL du profil sur le réseau social"}]}},allOf:[{if:{properties:{typeElement:{const:"citoyens"}}},then:{properties:{id:{type:"string",default:"@userId"}}}},{anyOf:[{required:["gitlab"],properties:{gitlab:{not:{type:"null"}}}},{required:["github"],properties:{github:{not:{type:"null"}}}},{required:["twitter"],properties:{twitter:{not:{type:"null"}}}},{required:["facebook"],properties:{facebook:{not:{type:"null"}}}},{required:["instagram"],properties:{instagram:{not:{type:"null"}}}},{required:["diaspora"],properties:{diaspora:{not:{type:"null"}}}},{required:["mastodon"],properties:{mastodon:{not:{type:"null"}}}},{required:["telegram"],properties:{telegram:{not:{type:"null"}}}},{required:["signal"],properties:{signal:{not:{type:"null"}}}}]}]},responses:{200:{oneOf:[{type:"object",properties:{result:{type:"boolean",const:!0},resultGoods:{type:"object",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},values:{type:"object",description:"Contient les champs mis à jour",additionalProperties:!0,$comment:"Ce schéma n'est pas encore complet"}},required:["result","msg"],additionalProperties:!0}},required:["result","resultGoods"],additionalProperties:!1},{type:"object",properties:{resultErrors:{type:"object",properties:{result:{type:"boolean",const:!1},msg:{type:"string",description:"Message d'erreur"}},required:["result","msg"],additionalProperties:!0}},required:["resultErrors"],additionalProperties:!1}]},401:{type:"object",description:"Erreur d'authentification (token invalide ou expiré)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Mettre à jour les localités d'un élément",path:"/co2/element/updateblock/",constant:"UPDATE_BLOCK_LOCALITY",constantCocolight:"UPDATE_BLOCK",method:"POST",auth:"bearer",description:"Permet de mettre à jour l'adresse et les informations géographiques d'un élément.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{block:{type:"string",const:"localities",default:"localities",description:"Nom du bloc à mettre à jour (doit être 'localities')"},typeElement:{type:"string",default:"citoyens",enum:["citoyens","projects","organizations"],description:"Type d'élément"},id:{type:"string",description:"ID de l'élément concerné"},scope:{type:"string",default:"",description:"Périmètre de mise à jour"},geo:{type:"object",description:"Coordonnées géographiques",properties:{"@type":{type:"string",const:"GeoCoordinates"},latitude:{type:["string","number"]},longitude:{type:["string","number"]}},required:["latitude","longitude"],additionalProperties:!1},geoPosition:{type:"object",description:"Position géographique GeoJSON",properties:{type:{type:"string",const:"Point",description:"Type GeoJSON (doit être 'Point')"},coordinates:{type:"array",items:{type:"number"},minItems:2,maxItems:2,description:"Tableau contenant [longitude, latitude]"},float:{type:"boolean",const:!0,default:!0,description:"Indicateur pour forcer la conversion en float côté serveur"}},required:["type","coordinates","float"],additionalProperties:!0},address:{type:"object",properties:{"@type":{type:"string",const:"PostalAddress"},addressCountry:{type:"string"},codeInsee:{type:"string"},addressLocality:{type:"string"},localityId:{type:"string"},level1:{type:"string"},level1Name:{type:"string"},level3:{type:"string",description:"ID du département. Peut être vide pour les pays étrangers.",minLength:0},level3Name:{type:"string",description:"Nom du département. Peut être vide pour les pays étrangers.",minLength:0},level4:{type:"string",description:"ID de la commune. Peut être vide pour les pays étrangers.",minLength:0},level4Name:{type:"string",description:"Nom de la commune. Peut être vide pour les pays étrangers.",minLength:0},postalCode:{type:"string"},streetAddress:{type:"string"}},required:["@type","addressCountry","codeInsee","addressLocality","localityId","level1","level1Name"],additionalProperties:!1,$comment:"Certains champs comme level3/level4 peuvent être vides selon le pays (ex : Maurice)"}},required:["block","typeElement","id","address"],allOf:[{if:{properties:{typeElement:{const:"citoyens"}}},then:{properties:{id:{type:"string",default:"@userId"}}}}]},responses:{200:{oneOf:[{type:"object",properties:{result:{type:"boolean",const:!0},resultGoods:{type:"object",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},values:{type:"object",description:"Contient les champs mis à jour",additionalProperties:!0,$comment:"Ce schéma n'est pas encore complet"}},required:["result","msg"],additionalProperties:!0}},required:["result","resultGoods"],additionalProperties:!1},{type:"object",properties:{resultErrors:{type:"object",properties:{result:{type:"boolean",const:!1},msg:{type:"string",description:"Message d'erreur"}},required:["result","msg"],additionalProperties:!0}},required:["resultErrors"],additionalProperties:!1}]},401:{type:"object",description:"Erreur d'authentification (token invalide ou expiré)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Mettre à jour le slug d'un élément",path:"/co2/element/updateblock/",constant:"UPDATE_BLOCK_SLUG",constantCocolight:"UPDATE_BLOCK",method:"POST",auth:"bearer",description:"Permet de mettre à jour le slug pour une URL simplifiée.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{block:{type:"string",const:"info",default:"info",description:"Nom du bloc à mettre à jour (doit être 'info')"},typeElement:{type:"string",default:"citoyens",enum:["citoyens","projects","organizations"],description:"Type d'élément (citoyens, projects, organizations)"},id:{type:"string",description:"ID de l'élément concerné"},scope:{type:"string",default:"",$comment:"Non utilisé dans l'application Cocolight"},slug:{type:"string",description:"Slug simplifié pour URL",pattern:"^[a-zA-Z0-9]+$",minLength:3,maxLength:100}},required:["block","typeElement","id","slug"],allOf:[{if:{properties:{typeElement:{const:"citoyens"}}},then:{properties:{id:{type:"string",default:"@userId"}}}}]},responses:{200:{description:"Réponse après la mise à jour de l'élément",oneOf:[{type:"object",properties:{result:{type:"boolean",const:!0},resultGoods:{type:"object",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},values:{type:"object",description:"Contient les champs mis à jour",additionalProperties:!0,properties:{slug:{type:"string"}}}},required:["result","msg"],additionalProperties:!0}},required:["result","resultGoods"],additionalProperties:!1},{type:"object",properties:{resultErrors:{type:"object",properties:{result:{type:"boolean",const:!1},msg:{type:"string",description:"Message d'erreur"}},required:["result","msg"],additionalProperties:!0}},required:["resultErrors"],additionalProperties:!1}]},401:{type:"object",description:"Erreur d'authentification (token invalide ou expiré)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Vérifier l'état d'une URL",path:"/co2/slug/check",constant:"CHECK",method:"POST",auth:"bearer",description:"Vérifie si une URL (slug) est valide ou disponible.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{block:{type:"string",const:"info",default:"info",description:"Nom du bloc"},id:{type:"string",description:"ID de l'élément"},type:{type:"string",enum:["citoyens","projects","organizations"],default:"citoyens",description:"Type d'élément"},slug:{type:"string",description:"Slug à vérifier",pattern:"^[a-zA-Z0-9]+$",minLength:3,maxLength:100}},required:["block","type","id","slug"],allOf:[{if:{properties:{type:{const:"citoyens"}}},then:{properties:{id:{type:"string",default:"@userId"}}}}],additionalProperties:!1},responses:{200:{oneOf:[{description:"Slug valide ou disponible",type:"object",properties:{result:{type:"boolean",const:!0},domaineName:{type:"string"}},required:["result","domaineName"],additionalProperties:!1},{description:"Slug non valide ou non disponible",type:"object",properties:{result:{type:"boolean",const:!1},domaineName:{type:"string"}},required:["result","domaineName"],additionalProperties:!1}]},401:{type:"object",description:"Erreur d'authentification (token invalide ou expiré)",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Mettre à jour l'image de profil",path:"/co2/document/upload-save/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/profil_avatar/contentKey/profil/docType/image",method:"POST",constant:"PROFIL_IMAGE",constantCocolight:["PROFIL_IMAGE","UPDATE_PDP"],auth:"bearer",description:"Permet de mettre à jour l'image de profil d'un utilisateur ou d'une entité.",contentType:"multipart/form-data",pathParams:{type:"object",properties:{folder:{type:"string",enum:["citoyens","projects","organizations"],default:"citoyens",description:"Type d'entité"},ownerId:{type:"string",description:"ID de l'utilisateur ou de l'entité"}},required:["folder","ownerId"],allOf:[{if:{properties:{folder:{const:"citoyens"}}},then:{properties:{ownerId:{default:"@userId"}}}}],additionalProperties:!1},request:{type:"object",properties:{profil_avatar:{$comment:"Ce champ est un fichier binaire non validé par AJV",description:"Fichier image de profil au format binaire"}},required:["profil_avatar"],additionalProperties:!1},responses:{200:{description:"Réponse après l'enregistrement de l'image de profil",oneOf:[{type:"object",properties:{resultUpload:{type:"boolean",const:!0},success:{type:"boolean",const:!0},name:{type:"string",description:"Nom du fichier enregistré"},docPath:{type:"string",description:"Chemin du fichier sur le serveur"},size:{type:"integer",description:"Taille du fichier en octets"},result:{type:"boolean",const:!0},msg:{type:"string",description:"Message de confirmation"},id:{type:"object",properties:{$id:{type:"string",description:"ID du document enregistré"}},required:["$id"],additionalProperties:!1},src:{type:"object",description:"Informations sur les images générées",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},changes:{type:"object",properties:{profilImageUrl:{type:"string",format:"uri-reference"},profilMediumImageUrl:{type:"string",format:"uri-reference"},profilThumbImageUrl:{type:"string",format:"uri-reference"},profilMarkerImageUrl:{type:"string",format:"uri-reference"}},required:["profilImageUrl","profilMediumImageUrl","profilThumbImageUrl","profilMarkerImageUrl"],additionalProperties:!1}},required:["result","msg","changes"],additionalProperties:!1},survey:{type:["boolean","null"],description:"Peut être à false ou null selon les cas"}},required:["resultUpload","success","name","docPath","size","result","msg","id","src"],additionalProperties:!1},{type:"object",description:"Réponse en cas d'échec de l'upload",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"],additionalProperties:!1}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Obtenir les éléments liés",path:"/co2/element/about/type/{type}/id/{id}/json/true",constant:"GET_ELEMENTS_ABOUT",method:"POST",auth:"none",description:"Récupère les informations détaillées d'un élément et de ses éléments liés.",contentType:"application/x-www-form-urlencoded",pathParams:{type:"object",properties:{type:{type:"string",enum:["citoyens","projects","organizations"],default:"citoyens",description:"Type d'entité"},id:{type:"string",description:"ID de l'utilisateur ou de l'entité"}},required:["type","id"],allOf:[{if:{properties:{type:{const:"citoyens"}}},then:{properties:{id:{default:"@userId"}}}}],additionalProperties:!1},request:{type:"object",properties:{tpl:{type:"string",default:"ficheInfoElement",const:"ficheInfoElement",description:"Template utilisé (ex: ficheInfoElement)"}},required:["tpl"],additionalProperties:!1},responses:{200:{$defs:{dateObject:{description:"Peut être un objet { sec, usec } ou un timestamp entier (sec)",oneOf:[{type:"object",required:["sec","usec"],properties:{sec:{type:"number"},usec:{type:"number"}},additionalProperties:!1},{type:"integer"}]},_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1}},oneOf:[{type:"object",description:"Schéma JSON pour les informations détaillées d'un utilisateur.",properties:{_id:{$ref:"#/$defs/_idObject"},username:{type:"string"},email:{type:"string",format:"email"},name:{type:"string"},slug:{type:"string"},collection:{type:"string",enum:["citoyens"]},modified:{$ref:"#/$defs/dateObject"},created:{$ref:"#/$defs/dateObject"},roles:{type:"object",properties:{betaTester:{type:"boolean"},standalonePageAccess:{type:"boolean"},superAdmin:{type:"boolean"}}},preferences:{type:"object",properties:{privateFields:{type:"array",items:{type:"string"}},publicFields:{type:"array",items:{type:"string"}},isOpenData:{type:"boolean"},badge:{type:"boolean"},sendMail:{oneOf:[{type:"object",properties:{source:{type:"array",items:{}}},required:["source"],additionalProperties:!1},{type:"boolean",const:!1}]},activitypub:{type:"boolean"},activitypubStarterClosed:{type:"boolean"},notifications:{type:"array",items:{}}},required:["isOpenData","sendMail"]},language:{type:"string"},profilImageUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}]},profilMarkerImageUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}]},profilMediumImageUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}]},profilThumbImageUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}]},profilBannerUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}]},profilRealBannerUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}]},shortDescription:{type:"string"},description:{type:"string"},tags:{type:"array",items:{type:"string"}},birthDate:{type:"object",properties:{sec:{type:"integer"},usec:{type:"integer"}},required:["sec","usec"],additionalProperties:!1}},required:["_id","name","username","roles","collection","preferences","slug"]},{description:"Schéma JSON pour les informations détaillées d'un projet",type:"object",properties:{_id:{$ref:"#/$defs/_idObject"},collection:{type:"string",enum:["projects"]},created:{$ref:"#/$defs/dateObject"},creator:{type:"string"},modified:{$ref:"#/$defs/dateObject"},name:{type:"string"},parent:{type:"object",patternProperties:{"^[0-9a-fA-F]{24}$":{type:"object",properties:{type:{type:"string"},name:{type:"string"},_id:{$ref:"#/$defs/_idObject"},slug:{type:"string"},profilThumbImageUrl:{type:"string"}},required:["type","name"],additionalProperties:!0}},additionalProperties:!1},preferences:{type:"object",properties:{isOpenData:{anyOf:[{type:"boolean"},{type:"string",enum:["true","false"]}]},isOpenEdition:{anyOf:[{type:"boolean"},{type:"string",enum:["true","false"]}]},crowdfunding:{anyOf:[{type:"boolean"},{type:"string",enum:["true","false"]}]},private:{anyOf:[{type:"boolean"},{type:"string",enum:["true","false"]}]}},required:["isOpenData","isOpenEdition"]},slug:{type:"string"},updated:{$ref:"#/$defs/dateObject"},links:{type:"object",$comment:"Ce schéma n'est pas encore complet"},profilImageUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}]},profilThumbImageUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}]},profilMarkerImageUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}]},profilMediumImageUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}]},typeSig:{type:"string"},type:{type:"string"}},required:["_id","collection","created","creator","modified","name","parent","preferences","slug","typeSig","type","updated"]},{description:"Schéma JSON pour les informations détaillées d'une organisation",type:"object",properties:{_id:{$ref:"#/$defs/_idObject"},collection:{type:"string",enum:["organizations"]},created:{$ref:"#/$defs/dateObject"},creator:{type:"string"},modified:{$ref:"#/$defs/dateObject"},name:{type:"string"},preferences:{type:"object",properties:{isOpenData:{anyOf:[{type:"boolean"},{type:"string",enum:["true","false"]}]},isOpenEdition:{anyOf:[{type:"boolean"},{type:"string",enum:["true","false"]}]}},required:["isOpenData","isOpenEdition"]},slug:{type:"string"},type:{type:"string"},updated:{$ref:"#/$defs/dateObject"},links:{type:"object",$comment:"Ce schéma n'est pas encore complet"},profilImageUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}],description:"URL de l'image de profil (vide ou URI)."},profilThumbImageUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}],description:"URL de l'image miniature (vide ou URI)."},profilMarkerImageUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}],description:"URL de l'image pour le marqueur (vide ou URI)."},profilMediumImageUrl:{anyOf:[{type:"string",enum:[""]},{type:"string",format:"uri-reference"}],description:"URL de l'image de taille moyenne (vide ou URI)."}},required:["_id","collection","modified","name","preferences","slug","type","updated"]}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Gérer des connexions multiples",path:"/co2/link/multiconnect",constant:"MULTICONNECT",method:"POST",auth:"bearer",description:"Permet d’inviter ou de connecter plusieurs utilisateurs en même temps à une entité.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{parentId:{type:"string",description:"ID de l'entité parente"},parentType:{type:"string",enum:["citoyens","projects","organizations"],default:"citoyens",description:"Type de l'entité parente"},listInvite:{type:"object",description:"Liste des citoyens invités",patternProperties:{"^(citoyens|projects|organizations)$":{type:"object",patternProperties:{"^[0-9a-fA-F]{24}$":{type:"object",properties:{name:{type:"string",description:"Nom de l'invité"}},required:["name"],additionalProperties:!1}},additionalProperties:!1}},additionalProperties:!1}},required:["parentId","parentType","listInvite"],allOf:[{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{parentId:{type:"string",default:"@userId"}}}}],additionalProperties:!1},responses:{200:{$defs:{_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1}},oneOf:[{type:"object",properties:{citoyens:{type:"array",items:{oneOf:[{type:"object",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},newElement:{type:"object",properties:{_id:{$ref:"#/$defs/_idObject"},name:{type:"string"},profilThumbImageUrl:{type:"string"},id:{type:"string"},isInviting:{type:"boolean"}},required:["_id","name","profilThumbImageUrl","id","isInviting"],additionalProperties:!0},newElementType:{type:"string",const:"citoyens"}},required:["result","msg","newElement","newElementType"]},{type:"object",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"],additionalProperties:!1}]}}},required:["citoyens"],additionalProperties:!1}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Récupérer les actualités",path:"/news/co/get/type/{type}/id/{id}/isLive/{isLive}/json/{json}",constant:"GET_NEWS",constantCocolight:"GET_NEWS",method:"POST",auth:"none",description:"Récupère la liste d’actualités selon plusieurs critères.",contentType:"application/x-www-form-urlencoded",pathParams:{type:"object",properties:{isLive:{type:"boolean",default:!0,description:"Indique si l'actualité est en direct"},type:{type:"string",enum:["citoyens","projects","organizations"],default:"citoyens",description:"Type d'actualité (ex: 'citoyens', 'projects', 'organizations')"},id:{type:"string",description:"ID de l'élément (ex: ID d'un utilisateur, d'un projet ou d'une organisation)"},json:{type:"boolean",default:!0,description:"Indique si la réponse doit être au format JSON"}},required:["isLive","type","id","json"],allOf:[{if:{properties:{type:{const:"citoyens"}}},then:{properties:{id:{default:"@userId"}}}}],additionalProperties:!1},request:{type:"object",properties:{dateLimit:{type:"integer",default:0,description:"Limite de date timestamp ou 0"},search:{type:"object",properties:{name:{type:"string",default:"",description:"Nom ou terme recherché"}},required:["name"],additionalProperties:!1},indexStep:{type:"integer",default:12,description:"Nombre de résultats par page"}},required:["dateLimit","indexStep"],additionalProperties:!1},responses:{200:{$defs:{NewsSchema:{type:"object",properties:{_id:{$ref:"#/$defs/_idObject"},type:{type:"string",const:"news"},text:{type:"string"},author:{$ref:"#/$defs/user"},date:{$ref:"#/$defs/dateObject"},collection:{type:"string",const:"news"},sharedBy:{type:"array",items:{$ref:"#/$defs/sharedUser"}},target:{$ref:"#/$defs/user"},created:{$ref:"#/$defs/dateObject"},markdownActive:{type:"boolean"},scope:{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!0},updated:{$ref:"#/$defs/dateObject"},comment:{type:["string","null"]},typeSig:{type:"string",const:"news"},lastAuthorShare:{$ref:"#/$defs/sharedUser"},media:{type:"object",description:"Optionnel. Contient les informations de média associées à la news.",additionalProperties:!0},mediaImg:{type:"object",description:"Optionnel. Contient les images associées à la news.",additionalProperties:!0},mentions:{type:"array",description:"Optionnel. Liste des personnes mentionnées.",items:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},avatar:{type:"string"},type:{type:"string"},value:{type:"string"},count:{type:"string"}},required:["id","name","slug","avatar","type","value","count"],additionalProperties:!0}},tags:{type:"array",description:"Optionnel. Liste de tags associés à la news.",items:{type:"string"}},vote:{type:"object",description:"Optionnel. Votes associés à la news.",additionalProperties:{type:"object",properties:{status:{type:"string"},date:{$ref:"#/$defs/dateObject"}},required:["status","date"],additionalProperties:!1}},voteCount:{type:"object",description:"Optionnel. Compteurs de votes.",additionalProperties:{type:"number"}}},required:["_id","type","text","author","date","collection","sharedBy","target","created","markdownActive","scope","updated","comment","typeSig","lastAuthorShare"],additionalProperties:!0},dateObject:{description:"Peut être un objet { sec, usec } ou un timestamp entier (sec)",oneOf:[{type:"object",required:["sec","usec"],properties:{sec:{type:"number"},usec:{type:"number"}},additionalProperties:!1},{type:"integer"}]},_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1},user:{type:"object",properties:{id:{type:"string"},name:{type:"string"},type:{type:"string"},profilThumbImageUrl:{type:"string",format:"uri-reference"},geo:{type:"object",properties:{"@type":{type:"string",const:"GeoCoordinates"},latitude:{type:"string"},longitude:{type:"string"}},required:["@type","latitude","longitude"],additionalProperties:!1}},required:["id","name","type"],additionalProperties:!0},sharedUser:{allOf:[{$ref:"#/$defs/user"},{type:"object",properties:{updated:{$ref:"#/$defs/dateObject"},comment:{type:["string","null"]}},required:["updated","comment"]}]}},oneOf:[{type:"object",description:"Réponse renvoyée lorsqu'aucune actualité n'est disponible",properties:{type:{type:"string",enum:["citoyens","projects","organizations"]},endStream:{type:"boolean",const:!0},news:{type:"array",minItems:0,maxItems:0},limitDate:{type:"boolean",const:!1}},required:["type","endStream","news","limitDate"]},{type:"object",description:"Réponse renvoyée lorsqu'une ou plusieurs actualités sont disponibles",properties:{type:{type:"string",enum:["citoyens","projects","organizations"]},endStream:{type:"boolean"},news:{type:"object",description:"Contient plusieurs objets news. Chaque clé est un identifiant dynamique (par exemple, un ObjectID Mongo) et chaque valeur doit respecter la structure définie par NewsCommonSchema.",patternProperties:{"^[a-f0-9]{24}$":{$ref:"#/$defs/NewsSchema"}},additionalProperties:!1},limitDate:{type:"object"}},required:["type","endStream","news","limitDate"]}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Récupérer des actualités par IDs",path:"/news/co/getbyids",constant:"GET_NEWS_BY_ID",method:"POST",auth:"none",description:"Récupère des actualités à partir d’une liste d’identifiants.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{ids:{type:"array",items:{type:"string"},description:"Liste des IDs d’actualités à récupérer"}},required:["ids"],additionalProperties:!1},responses:{200:{$defs:{NewsSchema:{type:"object",properties:{_id:{$ref:"#/$defs/_idObject"},type:{type:"string",const:"news"},text:{type:"string"},author:{$ref:"#/$defs/user"},date:{$ref:"#/$defs/dateObject"},collection:{type:"string",const:"news"},sharedBy:{type:"array",items:{$ref:"#/$defs/sharedUser"}},target:{$ref:"#/$defs/user"},created:{$ref:"#/$defs/dateObject"},markdownActive:{type:"boolean"},scope:{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!0},updated:{$ref:"#/$defs/dateObject"},comment:{type:["string","null"]},typeSig:{type:"string",const:"news"},lastAuthorShare:{$ref:"#/$defs/sharedUser"},media:{type:"object",description:"Optionnel. Contient les informations de média associées à la news.",additionalProperties:!0},mediaImg:{type:"object",description:"Optionnel. Contient les images associées à la news.",additionalProperties:!0},mentions:{type:"array",description:"Optionnel. Liste des personnes mentionnées.",items:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},avatar:{type:"string"},type:{type:"string"},value:{type:"string"},count:{type:"string"}},required:["id","name","slug","avatar","type","value","count"],additionalProperties:!0}},tags:{type:"array",description:"Optionnel. Liste de tags associés à la news.",items:{type:"string"}},vote:{type:"object",description:"Optionnel. Votes associés à la news.",additionalProperties:{type:"object",properties:{status:{type:"string"},date:{$ref:"#/$defs/dateObject"}},required:["status","date"],additionalProperties:!1}},voteCount:{type:"object",description:"Optionnel. Compteurs de votes.",additionalProperties:{type:"number"}}},required:["_id","type","text","author","date","collection","sharedBy","target","created","markdownActive","scope","updated","comment","typeSig","lastAuthorShare"],additionalProperties:!0},dateObject:{description:"Peut être un objet { sec, usec } ou un timestamp entier (sec)",oneOf:[{type:"object",required:["sec","usec"],properties:{sec:{type:"number"},usec:{type:"number"}},additionalProperties:!1},{type:"integer"}]},_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1},user:{type:"object",properties:{id:{type:"string"},name:{type:"string"},type:{type:"string"},profilThumbImageUrl:{type:"string",format:"uri-reference"},geo:{type:"object",properties:{"@type":{type:"string",const:"GeoCoordinates"},latitude:{type:"string"},longitude:{type:"string"}},required:["@type","latitude","longitude"],additionalProperties:!1}},required:["id","name","type"],additionalProperties:!0},sharedUser:{allOf:[{$ref:"#/$defs/user"},{type:"object",properties:{updated:{$ref:"#/$defs/dateObject"},comment:{type:["string","null"]}},required:["updated","comment"]}]}},type:"array",items:{$ref:"#/$defs/NewsSchema"},description:"Liste d'actualités correspondant aux IDs fournis"}}},{name:"Ajouter une actualité",path:"/news/co/save",constant:"ADD_NEWS",method:"POST",auth:"bearer",description:"Ajoute une nouvelle actualité.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{text:{type:"string",description:"Contenu de l’actualité"},scope:{type:"string",description:"Portée de l'actualité (ex: public, privé...)",enum:["public","private","restricted"],default:"public"},markdownActive:{type:"boolean",default:!0,description:"Markdown activé (true/false)"},parentId:{type:"string",description:"ID de l'entité parente"},parentType:{type:"string",enum:["citoyens","projects","organizations"],default:"citoyens",description:"Type de l'entité parente"},type:{type:"string",const:"news",default:"news",description:"Type de l'objet, toujours 'news'."},json:{type:"boolean",const:!0,default:!0,description:"Indique que la réponse est au format JSON."},tags:{anyOf:[{type:"array",items:{type:"string"}},{type:"string",enum:[""]}],description:'Tags : "" pour effacer tous les tags, ou tableau de mots-clés.'},mediaImg:{type:"object",description:"Optionnel. Informations sur les images associées à la news.",properties:{countImages:{type:"number",description:"Nombre d'images."},images:{type:"array",description:"Liste des identifiants ou chemins d'images.",items:{type:"string"}}},required:["countImages","images"],additionalProperties:!1},mediaFile:{type:"object",description:"Optionnel. Informations sur les fichiers associés à la news.",properties:{countFiles:{type:"number",description:"Nombre de fichiers."},files:{type:"array",description:"Liste des identifiants ou chemins de fichiers.",items:{type:"string"}}},required:["countFiles","files"],additionalProperties:!1},mentions:{type:"object",description:"Liste des mentions sous forme d'objet avec des clés dynamiques représentant l'indice de la mention.",patternProperties:{"^[0-9]+$":{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"},count:{type:"number"}},required:["id","name","slug","type","value","count"],additionalProperties:!1}},additionalProperties:!1}},required:["scope","markdownActive","parentId","parentType","type","json"],anyOf:[{required:["text"]},{required:["mediaImg"]},{required:["mediaFile"]}],allOf:[{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{parentId:{type:"string",default:"@userId"}}}}],additionalProperties:!1},responses:{200:{$defs:{NewsSchema:{type:"object",properties:{_id:{$ref:"#/$defs/_idObject"},type:{type:"string",const:"news"},text:{type:"string"},author:{$ref:"#/$defs/user"},date:{$ref:"#/$defs/dateObject"},collection:{type:"string",const:"news"},sharedBy:{type:"array",items:{$ref:"#/$defs/sharedUser"}},target:{$ref:"#/$defs/user"},created:{$ref:"#/$defs/dateObject"},markdownActive:{type:"boolean"},scope:{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!0},updated:{$ref:"#/$defs/dateObject"},comment:{type:["string","null"]},typeSig:{type:"string",const:"news"},lastAuthorShare:{$ref:"#/$defs/sharedUser"},media:{type:"object",description:"Optionnel. Contient les informations de média associées à la news.",additionalProperties:!0},mediaImg:{type:"object",description:"Optionnel. Contient les images associées à la news.",additionalProperties:!0},mentions:{type:"array",description:"Optionnel. Liste des personnes mentionnées.",items:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},avatar:{type:"string"},type:{type:"string"},value:{type:"string"},count:{type:"string"}},required:["id","name","slug","avatar","type","value","count"],additionalProperties:!0}},tags:{type:"array",description:"Optionnel. Liste de tags associés à la news.",items:{type:"string"}},vote:{type:"object",description:"Optionnel. Votes associés à la news.",additionalProperties:{type:"object",properties:{status:{type:"string"},date:{$ref:"#/$defs/dateObject"}},required:["status","date"],additionalProperties:!1}},voteCount:{type:"object",description:"Optionnel. Compteurs de votes.",additionalProperties:{type:"number"}}},required:["_id","type","text","author","date","collection","sharedBy","target","created","markdownActive","scope","updated","comment","typeSig","lastAuthorShare"],additionalProperties:!0},dateObject:{description:"Peut être un objet { sec, usec } ou un timestamp entier (sec)",oneOf:[{type:"object",required:["sec","usec"],properties:{sec:{type:"number"},usec:{type:"number"}},additionalProperties:!1},{type:"integer"}]},_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1},user:{type:"object",properties:{id:{type:"string"},name:{type:"string"},type:{type:"string"},profilThumbImageUrl:{type:"string",format:"uri-reference"},geo:{type:"object",properties:{"@type":{type:"string",const:"GeoCoordinates"},latitude:{type:"string"},longitude:{type:"string"}},required:["@type","latitude","longitude"],additionalProperties:!1}},required:["id","name"],additionalProperties:!0},sharedUser:{allOf:[{$ref:"#/$defs/user"},{type:"object",properties:{updated:{$ref:"#/$defs/dateObject"},comment:{type:["string","null"]}},required:["updated","comment"]}]}},oneOf:[{type:"object",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},id:{type:"object",properties:{$id:{type:"string"}},required:["$id"],additionalProperties:!1},object:{$comment:"dans object.author il y a pas type il y a que typeSig",$ref:"#/$defs/NewsSchema"}},required:["result","msg","id","object"],additionalProperties:!1},{type:"object",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"],additionalProperties:!1}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Ajouter une image à une actualité",path:"/co2/document/uploadSave/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/newsImage/docType/image/contentKey/slider",constant:"ADD_IMAGE_NEWS",constantCocolight:"ADD_IMAGE_NEWS",method:"POST",auth:"bearer",description:"Ajoute une images à une actualité.",contentType:"multipart/form-data",pathParams:{type:"object",properties:{folder:{type:"string",enum:["citoyens","projects","organizations"],default:"citoyens",description:"Type de l'entité parente (ex: 'citoyens', 'projects', 'organizations')"},ownerId:{type:"string",description:"ID de l'utilisateur ou de l'entité parente"}},required:["folder","ownerId"],allOf:[{if:{properties:{folder:{const:"citoyens"}}},then:{properties:{ownerId:{default:"@userId"}}}}],additionalProperties:!1},request:{type:"object",properties:{newsImage:{$comment:"Ce champ est un fichier binaire non validé par AJV",description:"Fichier image à télécharger"}},required:["newsImage"],additionalProperties:!1},responses:{200:{oneOf:[{type:"object",description:"Réponse en cas de succès de l'upload",properties:{resultUpload:{type:"boolean",const:!0,description:"Indique si le téléchargement a abouti."},success:{type:"boolean",const:!0,description:"Indique le succès de l'opération."},name:{type:"string",description:"Nom du document."},docPath:{type:"string",description:"Chemin d'accès au document."},size:{type:"number",description:"Taille du document en octets."},result:{type:"boolean",const:!0,description:"Résultat de l'opération."},msg:{type:"string",description:"Message de confirmation."},id:{type:"object",description:"Identifiant du document sous forme d'objet.",properties:{$id:{type:"string",description:"ID du document (généralement un ObjectID MongoDB)."}},required:["$id"],additionalProperties:!1}},required:["resultUpload","success","name","docPath","size","result","msg","id"]},{type:"object",description:"Réponse en cas d'échec de l'upload",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"],additionalProperties:!1}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Ajouter un fichier à une actualité",path:"/co2/document/uploadSave/dir/communecter/folder/{folder}/ownerId/{ownerId}}/input/newsFile/docType/file",constant:"ADD_FILE_NEWS",constantCocolight:"ADD_FILE_NEWS",method:"POST",auth:"bearer",description:"Ajoute un fichier à une actualité.",contentType:"multipart/form-data",pathParams:{type:"object",properties:{folder:{type:"string",enum:["citoyens","projects","organizations"],default:"citoyens",description:"Type de l'entité parente (ex: 'citoyens', 'projects', 'organizations')"},ownerId:{type:"string",description:"ID de l'utilisateur ou de l'entité parente"}},required:["folder","ownerId"],allOf:[{if:{properties:{folder:{const:"citoyens"}}},then:{properties:{ownerId:{default:"@userId"}}}}],additionalProperties:!1},request:{type:"object",properties:{newsFile:{$comment:"Ce champ est un fichier binaire non validé par AJV",description:"Fichier image à télécharger"}},required:["newsFile"],additionalProperties:!1},responses:{200:{oneOf:[{type:"object",description:"Réponse en cas de succès de l'upload",properties:{resultUpload:{type:"boolean",const:!0,description:"Indique si le téléchargement a abouti."},success:{type:"boolean",const:!0,description:"Indique le succès de l'opération."},name:{type:"string",description:"Nom du document."},docPath:{type:"string",description:"Chemin d'accès au document."},size:{type:"number",description:"Taille du document en octets."},result:{type:"boolean",const:!0,description:"Résultat de l'opération."},msg:{type:"string",description:"Message de confirmation"},id:{type:"object",description:"Identifiant du document sous forme d'objet.",properties:{$id:{type:"string",description:"ID du document (généralement un ObjectID MongoDB)."}},required:["$id"],additionalProperties:!1}},required:["resultUpload","success","name","docPath","size","result","msg","id"]},{type:"object",description:"Réponse en cas d'échec de l'upload",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"],additionalProperties:!1}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Supprimer une actualité",path:"/news/co/delete/id/{id}",constant:"DELETE_NEWS",constantCocolight:"DELETE_NEWS",method:"POST",auth:"bearer",description:"Supprime une actualité existante.",contentType:"application/x-www-form-urlencoded",pathParams:{type:"object",properties:{id:{type:"string",description:"ID de l'actualité à supprimer"}},required:["id"],additionalProperties:!1},request:{type:"object",properties:{isLive:{type:"boolean",default:!1}},required:["isLive"],additionalProperties:!1},responses:{200:{oneOf:[{type:"object",description:"Réponse en cas de succès de la suppression",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},type:{type:"string",const:"news"},commentsDeleted:{type:"number",description:"Nombre de commentaires supprimés",$comment:"bizarre même si il y a des commentaires ce champs reste à 0"}},required:["result","msg","type","commentsDeleted"],additionalProperties:!1},{type:"object",description:"Réponse en cas d'échec de la suppression",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"]}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Mettre à jour une actualité",path:"/news/co/update",constant:"UPDATE_NEWS",method:"POST",auth:"bearer",description:"Met à jour le contenu d’une actualité existante.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{idNews:{type:"string",description:"ID de l'actualité à mettre à jour"},text:{type:"string",description:"Contenu de l’actualité"},scope:{type:"string",description:"Portée de l'actualité (ex: public, privé...)",enum:["public","private","restricted"],default:"public"},markdownActive:{type:"boolean",default:!0,description:"Markdown activé (true/false)"},parentId:{type:"string",description:"ID de l'entité parente"},parentType:{type:"string",enum:["citoyens","projects","organizations"],default:"citoyens",description:"Type de l'entité parente"},type:{type:"string",const:"news",default:"news",description:"Type de l'objet, toujours 'news'."},tags:{anyOf:[{type:"array",items:{type:"string"}},{type:"string",enum:[""]}],description:'Tags : "" pour effacer tous les tags, ou tableau de mots-clés.'},mediaImg:{type:"object",description:"Optionnel. Informations sur les images associées à la news.",properties:{countImages:{type:"number",description:"Nombre d'images."},images:{type:"array",description:"Liste des identifiants ou chemins d'images.",items:{type:"string"}}},required:["countImages","images"],additionalProperties:!1},mediaFile:{type:"object",description:"Optionnel. Informations sur les fichiers associés à la news.",properties:{countFiles:{type:"number",description:"Nombre de fichiers."},files:{type:"array",description:"Liste des identifiants ou chemins de fichiers.",items:{type:"string"}}},required:["countFiles","files"],additionalProperties:!1},mentions:{type:"object",description:"Liste des mentions sous forme d'objet avec des clés dynamiques représentant l'indice de la mention.",patternProperties:{"^[0-9]+$":{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"},count:{type:"number"}},required:["id","name","slug","type","value","count"],additionalProperties:!1}},additionalProperties:!1}},required:["idNews","scope","markdownActive","parentId","parentType","type"],anyOf:[{required:["text"]},{required:["mediaImg"]},{required:["mediaFile"]}],allOf:[{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{parentId:{type:"string",default:"@userId"}}}}],additionalProperties:!1},responses:{200:{$defs:{NewsSchema:{type:"object",properties:{_id:{$ref:"#/$defs/_idObject"},type:{type:"string",const:"news"},text:{type:"string"},author:{$ref:"#/$defs/user"},date:{$ref:"#/$defs/dateObject"},collection:{type:"string",const:"news"},sharedBy:{type:"array",items:{$ref:"#/$defs/sharedUser"}},target:{$ref:"#/$defs/user"},created:{$ref:"#/$defs/dateObject"},markdownActive:{type:"boolean"},scope:{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!0},updated:{$ref:"#/$defs/dateObject"},comment:{type:["string","null"]},typeSig:{type:"string",const:"news"},lastAuthorShare:{$ref:"#/$defs/sharedUser"},media:{type:"object",description:"Optionnel. Contient les informations de média associées à la news.",additionalProperties:!0},mediaImg:{type:"object",description:"Optionnel. Contient les images associées à la news.",additionalProperties:!0},mentions:{type:"array",description:"Optionnel. Liste des personnes mentionnées.",items:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},avatar:{type:"string"},type:{type:"string"},value:{type:"string"},count:{type:"string"}},required:["id","name","slug","avatar","type","value","count"],additionalProperties:!0}},tags:{type:"array",description:"Optionnel. Liste de tags associés à la news.",items:{type:"string"}},vote:{type:"object",description:"Optionnel. Votes associés à la news.",additionalProperties:{type:"object",properties:{status:{type:"string"},date:{$ref:"#/$defs/dateObject"}},required:["status","date"],additionalProperties:!1}},voteCount:{type:"object",description:"Optionnel. Compteurs de votes.",additionalProperties:{type:"number"}}},required:["_id","type","text","author","date","collection","sharedBy","target","created","markdownActive","scope","updated","comment","typeSig","lastAuthorShare"],additionalProperties:!0},dateObject:{description:"Peut être un objet { sec, usec } ou un timestamp entier (sec)",oneOf:[{type:"object",required:["sec","usec"],properties:{sec:{type:"number"},usec:{type:"number"}},additionalProperties:!1},{type:"integer"}]},_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1},user:{type:"object",properties:{id:{type:"string"},name:{type:"string"},type:{type:"string"},profilThumbImageUrl:{type:"string",format:"uri-reference"},geo:{type:"object",properties:{"@type":{type:"string",const:"GeoCoordinates"},latitude:{type:"string"},longitude:{type:"string"}},required:["@type","latitude","longitude"],additionalProperties:!1}},required:["id","name"],additionalProperties:!0},sharedUser:{allOf:[{$ref:"#/$defs/user"},{type:"object",properties:{updated:{$ref:"#/$defs/dateObject"},comment:{type:["string","null"]}},required:["updated","comment"]}]}},oneOf:[{type:"object",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},object:{$comment:"dans object.author il y a pas type il y a que typeSig",$ref:"#/$defs/NewsSchema"}},required:["result","msg","object"],additionalProperties:!1},{type:"object",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"],additionalProperties:!1}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Partager une actualité",path:"/news/co/share",constant:"SHARE_NEWS",constantCocolight:"SHARE_NEWS",method:"POST",auth:"bearer",description:"Partage une actualité avec une entité ou un utilisateur.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{parentId:{type:"string",description:"ID de l'actualité à partager"},parentType:{type:"string",const:"news",default:"news",description:"Type de l'objet, toujours 'news'."},childId:{type:"string",description:"ID de l'entité partageante"},childType:{type:"string",enum:["citoyens","projects","organizations"],default:"citoyens",description:"Type de l'entité partageante"},connectType:{type:"string",const:"share",default:"share",description:"Type de connexion, toujours 'share'."},comment:{type:"string",description:"Commentaire de partage"}},required:["parentId","parentType","childId","childType","connectType"],allOf:[{if:{properties:{childType:{const:"citoyens"}}},then:{properties:{childId:{type:"string",default:"@userId"}}}}],additionalProperties:!1},responses:{200:{$defs:{user:{type:"object",properties:{id:{type:"string"},name:{type:"string"},type:{type:"string"},profilThumbImageUrl:{type:"string",format:"uri-reference"},geo:{type:"object",properties:{"@type":{type:"string",const:"GeoCoordinates"},latitude:{type:"string"},longitude:{type:"string"}},required:["@type","latitude","longitude"],additionalProperties:!1}},required:["id","name"],additionalProperties:!0},sharedUser:{allOf:[{$ref:"#/$defs/user"},{type:"object",properties:{updated:{$ref:"#/$defs/dateObject"},comment:{type:["string","null"]}},required:["updated","comment"]}]},dateObject:{description:"Peut être un objet { sec, usec } ou un timestamp entier (sec)",oneOf:[{type:"object",required:["sec","usec"],properties:{sec:{type:"number"},usec:{type:"number"}},additionalProperties:!1},{type:"integer"}]},_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1}},oneOf:[{type:"object",description:"Réponse en cas de succès du partage",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},data:{type:"object",required:["_id","type","verb","target","author","object","scope","created","sharedBy","collection","icon","updated","typeSig","lastAuthorShare"],properties:{_id:{$ref:"#/$defs/_idObject"},type:{type:"string",const:"activityStream"},verb:{type:"string",const:"share"},target:{$ref:"#/$defs/user"},author:{$ref:"#/$defs/user"},object:{type:"object",required:["id","type","authorName","authorId","_id","text","author","date","collection","sharedBy","target","created","markdownActive","scope","updated","typeSig","lastAuthorShare"],properties:{id:{type:"string"},type:{type:"string",const:"news"},authorName:{type:"string"},authorId:{type:"string"},_id:{$ref:"#/$defs/_idObject"},text:{type:"string"},author:{$ref:"#/$defs/user"},date:{$ref:"#/$defs/dateObject"},collection:{type:"string",const:"news"},sharedBy:{type:"array",items:{$ref:"#/$defs/sharedUser"}},target:{$ref:"#/$defs/user"},created:{$ref:"#/$defs/dateObject"},markdownActive:{type:"boolean"},scope:{type:"object",properties:{type:{type:"string"}}},updated:{$ref:"#/$defs/dateObject"},comment:{type:["string","null"]},typeSig:{type:"string"},lastAuthorShare:{$ref:"#/$defs/sharedUser"}}},scope:{type:"object",properties:{type:{type:"string"}}},created:{$ref:"#/$defs/dateObject"},sharedBy:{type:"array",items:{$ref:"#/$defs/sharedUser"}},collection:{type:"string",const:"news"},icon:{type:"string"},imageBackground:{type:["string","null"]},name:{type:["string","null"]},updated:{$ref:"#/$defs/dateObject"},comment:{type:["string","null"]},typeSig:{type:"string"},lastAuthorShare:{$ref:"#/$defs/sharedUser"}}},idNews:{type:"string"}},required:["result","msg","data","idNews"],additionalProperties:!1},{type:"object",description:"Réponse en cas d'échec du partage",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"]}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Récupérer les commentaires",path:"/co2/comment/index/type/{type}/id/{id}/json/true",constant:"GET_COMMENTS",method:"POST",auth:"none",description:"Récupère les commentaires d’un élément.",contentType:"application/x-www-form-urlencoded",pathParams:{type:"object",properties:{type:{type:"string",enum:["news"],default:"news",description:"Type de l'élément"},id:{type:"string",description:"ID de l'élément dont on veut récupérer les commentaires"}},required:["type","id"],additionalProperties:!1},responses:{200:{$defs:{dateObject:{description:"Peut être un objet { sec, usec } ou un timestamp entier (sec)",oneOf:[{type:"object",required:["sec","usec"],properties:{sec:{type:"number"},usec:{type:"number"}},additionalProperties:!1},{type:"integer"}]},_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1},author:{type:"object",required:["id","name","typeSig"],properties:{id:{type:"string"},name:{type:"string"},username:{type:"string"},email:{type:"string",format:"email"},tags:{type:["array","null"]},profilImageUrl:{type:"string",format:"uri-reference"},profilThumbImageUrl:{type:"string",format:"uri-reference"},profilMarkerImageUrl:{type:"string",format:"uri-reference"},address:{type:"object"},preferences:{type:"object",required:["isOpenData","sendMail"],properties:{privateFields:{type:"array",items:{type:"string"}},publicFields:{type:"array",items:{type:"string"}},isOpenData:{type:"boolean"},badge:{type:"boolean"},sendMail:{type:"boolean"},activitypub:{type:"boolean"}}},typeSig:{type:"string"}}},views:{type:"object",patternProperties:{"^[a-f0-9]{24}$":{type:"object",required:["date"],properties:{date:{$ref:"#/$defs/dateObject"}}}},additionalProperties:!1},comment:{type:"object",required:["_id","contextId","contextType","parentId","text","created","author","collection","status","views","postedDate","argval","replies"],properties:{_id:{$ref:"#/$defs/_idObject"},contextId:{type:"string"},contextType:{type:"string"},parentId:{type:"string"},text:{type:"string"},created:{$ref:"#/$defs/dateObject"},author:{$ref:"#/$defs/author"},collection:{type:"string",enum:["comments"]},tags:{type:["array","null"]},status:{type:"string"},views:{$ref:"#/$defs/views"},postedDate:{$ref:"#/$defs/dateObject"},argval:{type:"string"},replies:{anyOf:[{type:"object",patternProperties:{"^[a-f0-9]{24}$":{$ref:"#/$defs/comment"}},additionalProperties:!1},{type:"array",maxItems:0}]}}}},oneOf:[{description:"Réponse sans commentaires",type:"array",minItems:0,maxItems:0},{description:"Réponse avec commentaires",type:"object",patternProperties:{"^[a-f0-9]{24}$":{$ref:"#/$defs/comment"}},additionalProperties:!1}]}}},{name:"Ajouter un commentaire",path:"/co2/comment/save",constant:"ADD_COMMENTS",method:"POST",auth:"bearer",description:"Ajoute un commentaire à une actualité ou autre contexte.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{parentCommentId:{type:"string",description:"ID du commentaire parent (null si pas de parent)",default:""},text:{type:"string",description:"Contenu du commentaire"},contextId:{type:"string",description:"ID de l'élément auquel le commentaire est associé"},contextType:{type:"string",enum:["news"],default:"news",description:"Type de l'élément auquel le commentaire est associé"},argval:{type:"string",description:"Valeur de l'argument (optionnel)",default:""},path:{type:"string",description:"Chemin de l'élément (optionnel)",default:""},mentions:{type:"array",items:{type:"object",properties:{id:{type:"string",description:"ID de l'utilisateur mentionné"},name:{type:"string",description:"Nom de l'utilisateur mentionné"},slug:{type:"string",description:"Slug de l'utilisateur mentionné"},type:{type:"string",description:"Type de l'utilisateur mentionné"},value:{type:"string",description:"Valeur de la mention"},count:{type:"number",description:"Nombre de fois que l'utilisateur est mentionné"}},required:["id","name","slug","type","value","count"],additionalProperties:!1}}},required:["text","contextId","contextType"],additionalProperties:!1},responses:{200:{$defs:{dateObject:{description:"Peut être un objet { sec, usec } ou un timestamp entier (sec)",oneOf:[{type:"object",required:["sec","usec"],properties:{sec:{type:"number"},usec:{type:"number"}},additionalProperties:!1},{type:"integer"}]},_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1},author:{type:"object",required:["id","name"],properties:{id:{type:"string"},name:{type:"string"},username:{type:"string"},email:{type:"string",format:"email"},tags:{type:["array","null"]},profilImageUrl:{type:"string"},profilThumbImageUrl:{type:"string"},profilMarkerImageUrl:{type:"string"},address:{type:"object"},preferences:{type:"object",required:["isOpenData","sendMail"],properties:{privateFields:{type:"array",items:{type:"string"}},publicFields:{type:"array",items:{type:"string"}},isOpenData:{type:"boolean"},badge:{type:"boolean"},sendMail:{type:"boolean"},activitypub:{type:"boolean"}}},typeSig:{type:"string"}}},views:{type:"object",patternProperties:{"^[a-f0-9]{24}$":{type:"object",required:["date"],properties:{date:{$ref:"#/$defs/dateObject"}}}},additionalProperties:!1},comment:{type:"object",required:["_id","contextId","contextType","parentId","text","created","author","collection","status","views","postedDate","argval"],properties:{_id:{$ref:"#/$defs/_idObject"},contextId:{type:"string"},contextType:{type:"string"},parentId:{type:["string","null"]},text:{type:"string"},created:{$ref:"#/$defs/dateObject"},author:{$ref:"#/$defs/author"},collection:{type:"string",enum:["comments"]},tags:{type:["array","null"]},status:{type:"string"},views:{$ref:"#/$defs/views"},postedDate:{$ref:"#/$defs/dateObject"},argval:{type:"string"}}}},oneOf:[{type:"object",description:"Réponse en cas de succès de l'ajout du commentaire",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},id:{$ref:"#/$defs/_idObject"},newComment:{$ref:"#/$defs/comment"},time:{type:"integer"}},required:["result","msg","id","newComment","time"],additionalProperties:!1},{type:"object",description:"Réponse en cas d'échec de l'ajout du commentaire",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"]}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Supprimer un commentaire",path:"/co2/comment/delete/id/{id}",constant:"DELETE_COMMENTS",method:"POST",auth:"bearer",description:"Supprime un commentaire existant.",contentType:"application/x-www-form-urlencoded",pathParams:{type:"object",properties:{id:{type:"string",description:"ID du commentaire à supprimer"}},required:["id"],additionalProperties:!1},responses:{200:{$defs:{_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1}},oneOf:[{type:"object",description:"Réponse en cas de succès de la suppression du commentaire",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},elt:{type:"object",properties:{_id:{$ref:"#/$defs/_idObject"},contextId:{type:"string"},contextType:{type:"string"},parentId:{type:["string","null"]}}}},required:["result","msg","elt"],additionalProperties:!1},{type:"object",description:"Réponse en cas d'échec de la suppression du commentaire",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"]}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Mettre à jour un commentaire",path:"/co2/comment/update",constant:"UPDATE_COMMENTS",method:"POST",auth:"bearer",description:"Met à jour le contenu d’un commentaire.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{id:{type:"string",description:"ID du commentaire à mettre à jour"},params:{type:"object",properties:{text:{type:"string",description:"Nouveau texte du commentaire"},mentions:{type:"array",items:{type:"object",properties:{id:{type:"string",description:"ID de l'utilisateur mentionné"},name:{type:"string",description:"Nom de l'utilisateur mentionné"},slug:{type:"string",description:"Slug de l'utilisateur mentionné"},type:{type:"string",description:"Type de l'utilisateur mentionné"},value:{type:"string",description:"Valeur de la mention"},count:{type:"number",description:"Nombre de fois que l'utilisateur est mentionné"}},required:["id","name","slug","type","value","count"],additionalProperties:!1}}},required:["text"]}},required:["id","params"],additionalProperties:!1},responses:{200:{oneOf:[{type:"object",description:"Réponse en cas de succès de la mise à jour du commentaire",properties:{result:{type:"boolean",const:!0},msg:{type:"string"},comment:{type:"object",properties:{ok:{type:"number"},nModified:{type:"number"},n:{type:"number"},err:{type:["string","null"]},errmsg:{type:["string","null"]},updatedExisting:{type:"boolean"}},required:["ok","nModified","n","err","errmsg","updatedExisting"],additionalProperties:!1}},required:["result","msg","comment"],additionalProperties:!1},{type:"object",description:"Réponse en cas d'échec de la mise à jour du commentaire",properties:{result:{type:"boolean",const:!1},msg:{type:"string"}},required:["result","msg"]}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Rechercher des tags",path:"/api/tags/search?q={q}",constant:"SEARCH_TAGS",method:"POST",auth:"none",description:"Recherche des tags correspondant à un mot-clé.",contentType:"application/x-www-form-urlencoded",pathParams:{type:"object",properties:{q:{type:"string",description:"Mot-clé de recherche"}},required:["q"],additionalProperties:!1},responses:{200:{$defs:{_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1}},oneOf:[{type:"array",description:"Réponse sans résultat : contient un seul objet avec uniquement le champ 'tag' correspondant au terme recherché.",minItems:1,maxItems:1,items:{type:"object",required:["tag"],properties:{tag:{type:"string",description:"Terme recherché"}},additionalProperties:!1}},{type:"array",description:"Réponse avec résultats : contient plusieurs objets avec les champs '_id', 'tag' et 'field_length'.",minItems:1,items:{type:"object",required:["_id","tag","field_length"],properties:{_id:{$ref:"#/$defs/_idObject"},tag:{type:"string"},field_length:{type:"integer",minimum:0}},additionalProperties:!1}}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Afficher les votes d'une actualité",path:"/co2/action/list/type/{type}/id/{id}/actionType/vote/json/true",constant:"SHOW_VOTE",method:"POST",auth:"none",description:"Récupère la liste des votes (like, love, etc.) sur une actualité.",contentType:"application/x-www-form-urlencoded",pathParams:{type:"object",properties:{type:{type:"string",enum:["news"],default:"news",description:"Type de l'élément"},id:{type:"string",description:"ID de l'élément dont on veut récupérer les votes"}},required:["type","id"],additionalProperties:!1},responses:{200:{$defs:{_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1},dateObject:{description:"Peut être un objet { sec, usec } ou un timestamp entier (sec)",oneOf:[{type:"object",required:["sec","usec"],properties:{sec:{type:"number"},usec:{type:"number"}},additionalProperties:!1},{type:"integer"}]}},oneOf:[{type:"object",required:["_id","vote","voteCount"],properties:{_id:{$ref:"#/$defs/_idObject"},vote:{type:"object",description:"Votes individuels, indexés par identifiant utilisateur",patternProperties:{"^[a-f0-9]{24}$":{type:"object",required:["status","date","_id","name","slug"],properties:{status:{type:"string",enum:["love","bothered","scared","like","enjoy","sad","support","glad"]},date:{$ref:"#/$defs/dateObject"},_id:{$ref:"#/$defs/_idObject"},name:{type:"string"},profilThumbImageUrl:{type:"string"},slug:{type:"string"}}}},additionalProperties:!1},voteCount:{type:"object",description:"Nombre total de votes par type de réaction",properties:{love:{type:"integer",minimum:0},bothered:{type:"integer",minimum:0},scared:{type:"integer",minimum:0},like:{type:"integer",minimum:0},enjoy:{type:"integer",minimum:0},sad:{type:"integer",minimum:0},support:{type:"integer",minimum:0},glad:{type:"integer",minimum:0}},additionalProperties:!1}}},{type:"object",required:["_id"],properties:{_id:{$ref:"#/$defs/_idObject"}},additionalProperties:!1,description:"Cas sans votes : uniquement l'identifiant de l'objet concerné"}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Recherche globale avec autocomplétion",path:"/co2/search/globalautocomplete",constant:"GLOBAL_AUTOCOMPLETE",constantCocolight:"GLOBALAUTOCOMPLETE",functionCocolight:"globalautocomplete",method:"POST",auth:"none",description:"Effectue une recherche globale avec possibilité d’autocomplétion.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{name:{type:"string",description:"Nom ou mot-clé de la recherche"},locality:{type:"object",description:"Liste des localités ciblées avec leur identifiant et leur type (city ou level1)",patternProperties:{"^[^\\s]+$":{type:"object",properties:{id:{type:"string",description:"Identifiant de la localité"},type:{type:"string",enum:["cities","level1"],description:"Type de la localité : 'cities' pour une ville ou 'level1' pour une région"}},required:["id","type"],additionalProperties:!1}},additionalProperties:!1},searchType:{type:"array",description:"Types d'entités à inclure dans la recherche",items:{type:"string",enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"]}},searchTags:{type:"array",description:"Balises (tags) à utiliser pour filtrer la recherche",items:{type:"string"}},ranges:{type:"object",description:"Configuration des plages de résultats pour chaque type de recherche",patternProperties:{"^[^\\s]+$":{type:"object",properties:{indexMin:{type:"number",description:"Index de départ pour la pagination"},indexMax:{type:"number",description:"Index de fin pour la pagination"}},required:["indexMin","indexMax"],additionalProperties:!1}},additionalProperties:!1},countType:{type:"array",description:"Liste fixe des types à compter dans les résultats",items:{type:"string",enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"]},const:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],default:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"]},indexMin:{type:"number",const:0,default:0,description:"Index de départ global pour la pagination (toujours 0)"},indexStep:{type:"number",description:"Nombre d’éléments à récupérer (limite de pagination)"},initType:{type:"string",const:"",default:"",description:"Type initial de la recherche, vide par défaut"},count:{type:"boolean",const:!0,default:!0,description:"Indique si les types doivent être comptés dans les résultats"},notSourceKey:{type:"boolean",const:!0,default:!0,description:"Flag pour ne pas filtrer sur une clé de source spécifique"},filters:{type:"string",const:"",default:"",description:"Filtres additionnels appliqués à la recherche (actuellement vide)"},fediverse:{type:"boolean",const:!1,default:!1,description:"Indique si la recherche doit s'étendre au Fediverse (toujours désactivé)"}},required:["name","searchType","countType","indexMin","indexStep","initType","count","notSourceKey","filters","fediverse"],additionalProperties:!1},responses:{200:{$defs:{dateObject:{description:"Peut être un objet { sec, usec } ou un timestamp entier (sec)",oneOf:[{type:"object",required:["sec","usec"],properties:{sec:{type:"number"},usec:{type:"number"}},additionalProperties:!1},{type:"integer"}]},_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1},emptyArray:{type:"array",minItems:0,maxItems:0}},oneOf:[{type:"object",description:"Réponse avec résultats de recherche",properties:{results:{type:"object",patternProperties:{"^[a-fA-F0-9]{24}$":{type:"object",properties:{_id:{$ref:"#/$defs/_idObject"},collection:{type:"string"},created:{$ref:"#/$defs/dateObject"},name:{type:"string"},parent:{type:"object",patternProperties:{"^[a-fA-F0-9]{24}$":{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["type"]}}},updated:{$ref:"#/$defs/dateObject"},slug:{type:"string"},links:{type:"object"}},required:["_id","collection","name"]}}},count:{type:"object",patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{type:"integer",minimum:0}},minProperties:1,additionalProperties:!1}},required:["results","count"],additionalProperties:!1},{type:"object",description:"Réponse sans résultats de recherche",properties:{results:{$ref:"#/$defs/emptyArray"},count:{type:"object",minProperties:1,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{type:"integer",const:0}},additionalProperties:!1}},required:["results","count"],additionalProperties:!1}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Recherche de villes avec autocomplétion",path:"/co2/search/globalautocomplete",constant:"CITY_AUTOCOMPLETE",constantCocolight:"GLOBALAUTOCOMPLETE",functionCocolight:"globalAutocompleteCities",method:"POST",auth:"none",description:"Recherche des villes en fonction d’un nom, autocomplétion rapide.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{name:{type:"string",description:"Nom de la ville"},locality:{type:"string",const:"",default:"",description:"Localité vide ou spécifique"},searchType:{type:"array",items:{type:"string",enum:["cities"]},const:["cities"],default:["cities"]},searchBy:{type:"string",description:"Mode de recherche (ex: ALL)",const:"ALL",default:"ALL"},indexMin:{type:"integer",description:"Index minimum",minimum:0},indexMax:{type:"integer",description:"Index maximum",minimum:5}},required:["name","locality","searchType"],additionalProperties:!1},responses:{200:{$defs:{_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1},geoObject:{type:"object",required:["latitude","longitude"],properties:{"@type":{type:"string"},latitude:{type:"string"},longitude:{type:"string"}}},geoPositionObject:{type:"object",required:["type","coordinates"],properties:{type:{type:"string"},float:{type:["string","boolean"]},coordinates:{type:"array",items:{type:"number"},minItems:2,maxItems:2}}},emptyArray:{type:"array",minItems:0,maxItems:0}},oneOf:[{type:"object",description:"Réponse avec résultats de recherche",properties:{results:{type:"array",items:{type:"object",required:["_id","type"],properties:{_id:{$ref:"#/$defs/_idObject"},type:{type:"string"},name:{type:"string"},alternateName:{type:"string"},postalCode:{type:"string"},postalCodes:{type:"array",items:{type:"object",required:["postalCode","geoPosition"],properties:{postalCode:{type:"string"},geoPosition:{$ref:"#/$defs/geoPositionObject"}}}},geo:{$ref:"#/$defs/geoObject"},insee:{type:"string"},country:{type:"string"},countryCode:{type:"string"},level1:{type:"string"},level1Name:{type:"string"},level3:{type:"string"},level3Name:{type:"string"},level4:{type:"string"},level4Name:{type:"string"},allCP:{type:"boolean"},uniqueCp:{type:"boolean"},level:{type:"array",items:{type:"string"}}},additionalProperties:!0}}},required:["results"],additionalProperties:!1},{type:"object",description:"Réponse sans résultats de recherche",properties:{results:{$ref:"#/$defs/emptyArray"}},required:["results"],additionalProperties:!1}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Suggestions d'entrée",path:"/co2/search/globalautocomplete",method:"POST",constant:"SUGGESTION_INPUT",constantCocolight:"GLOBALAUTOCOMPLETE",functionCocolight:"suggestionInput",auth:"none",description:"Fournit des suggestions basées sur le nom recherché, etc.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{name:{type:"string",description:"Nom ou terme recherché"},searchType:{description:"Types d'entités à inclure dans la recherche",type:"array",items:{type:"string",enum:["organizations","projects","poi"]}},indexMin:{description:"Index minimum pour la pagination",type:"integer",minimum:0,default:0},indexMax:{description:"Index maximum pour la pagination",type:"integer",minimum:20,default:20}},required:["name","searchType","indexMin","indexMax"],additionalProperties:!1},responses:{200:{$defs:{dateObject:{description:"Peut être un objet { sec, usec } ou un timestamp entier (sec)",oneOf:[{type:"object",required:["sec","usec"],properties:{sec:{type:"number"},usec:{type:"number"}},additionalProperties:!1},{type:"integer"}]},_idObject:{type:"object",properties:{$id:{type:"string",pattern:"^[a-f0-9]{24}$"}},required:["$id"],additionalProperties:!1},emptyArray:{type:"array",minItems:0,maxItems:0}},oneOf:[{type:"object",description:"Réponse avec résultats de recherche",properties:{results:{type:"object",patternProperties:{"^[a-fA-F0-9]{24}$":{type:"object",properties:{_id:{$ref:"#/$defs/_idObject"},collection:{type:"string"},created:{$ref:"#/$defs/dateObject"},name:{type:"string"},parent:{type:"object",patternProperties:{"^[a-fA-F0-9]{24}$":{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["type"]}}},updated:{$ref:"#/$defs/dateObject"},slug:{type:"string"},links:{type:"object"}},required:["_id","collection","name"]}}}},required:["results"],additionalProperties:!1},{type:"object",description:"Réponse sans résultats de recherche",properties:{results:{$ref:"#/$defs/emptyArray"},count:{type:"object",minProperties:1,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{type:"integer",const:0}},additionalProperties:!1}},required:["results","count"],additionalProperties:!1}]},401:{description:"Erreur d'authentification (token invalide ou expiré)",type:"object",properties:{error:{type:"string",description:"Description de l'erreur"}},required:["error"],additionalProperties:!1}}},{name:"Récupérer les projets non administrables",path:"/co2/search/globalautocomplete",constant:"GET_PROJECTS_NO_ADMIN",constantCocolight:"GLOBALAUTOCOMPLETE",functionCocolight:"getProjectsNoAdmin",method:"POST",auth:"none",description:"Récupère les projets accessibles sans droits d'administration.",contentType:"application/x-www-form-urlencoded",request:{type:"object",properties:{name:{type:"string",description:"Nom ou terme recherché"},searchType:{description:"Types d'entités à inclure dans la recherche",type:"array",items:{type:"string",enum:["projects"]},const:["projects"],default:["projects"]},indexMin:{description:"Index minimum pour la pagination",type:"integer",minimum:0,default:0},initType:{type:"string",const:"",default:"",description:"Type initial de la recherche, vide par défaut"},count:{type:"boolean",const:!0,default:!0,description:"Indique si les types doivent être comptés dans les résultats"},countType:{type:"array",description:"Liste fixe des types à compter dans les résultats",items:{type:"string",enum:["projects"]},const:["projects"],default:["projects"]},indexStep:{type:"integer",description:"Nombre d’éléments à récupérer (limite de pagination)",default:30},notSourceKey:{type:"boolean",const:!0,default:!0,description:"Flag pour ne pas filtrer sur une clé de source spécifique"},filters:{type:"object",properties:{$or:{type:"object",patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":{type:"object",properties:{$exists:{const:!0}},required:["$exists"],additionalProperties:!1},"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":{type:"object",properties:{$exists:{const:!0}},required:["$exists"],additionalProperties:!1}},additionalProperties:!1,minProperties:2,maxProperties:2}},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":{type:"object",properties:{$exists:{const:!0}},required:["$exists"],additionalProperties:!1}},required:["$or"],additionalProperties:!1,default:{$or:{"links.contributors.@userId":{$exists:!0},"parent.@userId":{$exists:!0}},"links.contributors.@userId":{$exists:!0}}},locality:{type:"string",const:"",default:"",description:"Localité vide ou spécifique"},fediverse:{type:"boolean",const:!1,default:!1,description:"Indique si la recherche doit s'étendre au Fediverse (toujours désactivé)"}},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],additionalProperties:!1}}];class u extends Error{constructor(e,t,r){super(e),this.name="ApiClientError",this.status=t,this.details=r}}class y extends Error{constructor(e){super(e),this.name="CircuitBreakerError"}}p.addType("oid",(e=>new c.ObjectID(e)));class m extends r.EventEmitter{constructor({baseURL:e,accessToken:t,refreshToken:r,refreshUrl:p="/api/cocolight/refreshtoken",endpoints:d=l,timeout:c=3e4,debug:y=!1,maxRetries:m=0,circuitBreakerThreshold:g=5,circuitBreakerResetTime:f=6e4,fromJSONValue:b=!0}={}){if(super(),!e)throw new u('Le paramètre "baseURL" est obligatoire.',500);this._baseURL=e,this._refreshToken=r,this._refreshUrl=p,this._endpoints=d,this._debug=y;let h=null;this._fromJSONValue=b,Object.defineProperty(this,"userId",{get:()=>h,set:()=>{throw new Error("Modification directe de userId non autorisée.")},enumerable:!0}),this._setUserId=e=>{h=e,this._logger.debug(`[ApiClient] userId set: ${e}`)},this._ajv=new i({strict:!1,useDefaults:!0}),s(this._ajv),this._logger=a({transport:{target:"pino-pretty",options:{colorize:!0}},level:y?"debug":"info"}),this._client=o.create({baseURL:e,timeout:c}),m>0&&(n(this._client,{retries:m,retryDelay:n.exponentialDelay,retryCondition:e=>n.isNetworkError(e)||n.isRetryableError(e)}),this._logger.info(`[ApiClient] Retry activé : ${m} max`)),this._breakerThreshold=g,this._breakerResetTime=f,this._breakerErrorCount=0,this._breakerOpen=!1,this._lastBreakerOpenTime=null,t&&this.setToken(t),this._client.interceptors.response.use((e=>e),(async e=>{if(e.response&&401===e.response.status&&this._refreshToken)try{if(await this._refreshAccessToken())return this._client.request(e.config)}catch(e){throw new u(e.message,401,e)}throw e}))}setToken(e){this._accessToken=e,this._client.defaults.headers.common.Authorization="Bearer "+e,this._logger.debug(`[ApiClient] setToken: ${e}`)}getToken(){return this._accessToken}setRefreshToken(e){this._refreshToken=e,this._logger.debug(`[ApiClient] setRefreshToken: ${e}`)}getRefreshToken(){return this._refreshToken}async _refreshAccessToken(){if(!this._refreshToken)return!1;try{const e=await this._client.post(this._refreshUrl,{refreshToken:this._refreshToken},{headers:{"Content-Type":"application/json"}});return!(!e.data||!e.data.accessToken||(this.setToken(e.data.accessToken),e.data.refreshToken&&this.setRefreshToken(e.data.refreshToken),this.emit("refreshSuccess",e.data),0))}catch(e){return this._logger.error(`[ApiClient] Refresh Error : ${e.message}`),!1}}_checkCircuitBreaker(){return!this._breakerOpen||Date.now()-this._lastBreakerOpenTime>this._breakerResetTime&&(this._breakerOpen=!1,this._breakerErrorCount=0,this._logger.warn("[ApiClient] Circuit breaker réinitialisé"),!0)}_updateCircuitBreakerError(){this._breakerErrorCount+=1,this._logger.warn(`[ApiClient] Erreur #${this._breakerErrorCount} sur ${this._breakerThreshold}`),this._breakerErrorCount>=this._breakerThreshold&&(this._breakerOpen=!0,this._lastBreakerOpenTime=Date.now(),this._logger.error("[ApiClient] Circuit breaker ACTIVÉ - L'API est considérée indisponible"))}_resetCircuitBreakerSuccess(){this._breakerErrorCount=0,this._breakerOpen&&(this._breakerOpen=!1,this._logger.warn("[ApiClient] Circuit breaker refermé suite à un succès"))}static stripNullsInPlace(e){if(e&&"object"==typeof e&&e.value&&"function"==typeof e.value.pipe)return e;if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)null===e[t]||void 0===e[t]?e.splice(t,1):"object"==typeof e[t]&&m.stripNullsInPlace(e[t]);else if(e&&"object"==typeof e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(null===e[t]||void 0===e[t]?delete e[t]:"object"==typeof e[t]&&m.stripNullsInPlace(e[t]));return e}_resolveSpecialValuesInPlace(e){const t={userId:()=>this.userId,accessToken:()=>this._accessToken,refreshToken:()=>this._refreshToken,baseURL:()=>this._baseURL},r=e=>"string"!=typeof e?e:e.replace(/@(\w+)/g,((e,r)=>{const i=t[r],s="function"==typeof i?i():void 0;return null==s?`@${r}`:s})),i=e=>{if((e=>e&&"object"==typeof e&&("function"==typeof e.pipe||"undefined"!=typeof Buffer&&e instanceof Buffer))(e))return e;if(Array.isArray(e))return e.map(i);if((e=>"[object Object]"===Object.prototype.toString.call(e))(e)){const t={};for(const[s,o]of Object.entries(e))t[r(s)]=i(o);return t}return"string"==typeof e?r(e):e};return i(e)}_cleanSchemaLeftoverAlias(e){const t=/@\w+/;if(Array.isArray(e))return e.map((e=>this._cleanSchemaLeftoverAlias(e)));if(e&&"object"==typeof e){const r={};for(const i of Object.keys(e)){const s=e[i];if(!t.test(i)){if("default"===i){if("string"==typeof s&&t.test(s))continue;if(s&&"object"==typeof s){const e=this._cleanSchemaLeftoverAlias(s);Object.keys(e).length>0&&(r[i]=e);continue}}"string"==typeof s&&t.test(s)||(r[i]=this._cleanSchemaLeftoverAlias(s))}}return r}return e}async callEndpoint(e,t={},r=!0,i=!0){if(!this._checkCircuitBreaker())throw new y("Le circuit breaker est activé, impossible d'appeler l'API");const s=this._endpoints.find((t=>t.constant===e));if(!s)throw new u(`Endpoint introuvable : ${e}`,404);const{path:o,method:n,contentType:p,auth:a,pathParams:d,request:c,responses:l}=s,g=(n||"GET").toLowerCase(),f=p||"application/json",b={"Content-Type":f};if(this._accessToken)"bearer"===a?b.Authorization=`Bearer ${this._accessToken}`:a&&"none"!==a||b.Authorization||(b.Authorization=`Bearer ${this._accessToken}`);else if("bearer"===a)throw new u(`Token requis pour l'endpoint sécurisé : ${e}`,401);let h,j=o;if(d){let e=d;"none"===a&&null===this.userId&&(e=this._cleanSchemaLeftoverAlias(d));const r=t.pathParams||{},i=this._ajv.compile(e);if(!i(r))throw this.emit("validationError",{stage:"pathParams",errors:i.errors}),new u("Path parameter validation failed.",400,i.errors);const s=this._resolveSpecialValuesInPlace(r);j=j.replace(/\{(\w+)\}/g,((e,t)=>{const r=s[t];if(void 0!==r)return encodeURIComponent(r);throw new u(`Path param manquant ou non résolu : {${t}}`,400)}))}if(c){let e=c;"none"===a&&null===this.userId&&(e=this._cleanSchemaLeftoverAlias(c));const r={...t};delete r.pathParams;const i=m.stripNullsInPlace(r),s=this._ajv.compile(e);if(!s(i))throw this.emit("validationError",{stage:"request",errors:s.errors}),new u("Request validation failed.",400,s.errors);t=this._resolveSpecialValuesInPlace(i)}"application/json"===f||"multipart/form-data"===f?h=t:"application/x-www-form-urlencoded"===f&&(h=m.toURLSearchParams(t)),this._logger.debug(`[ApiClient] callEndpoint: ${e} -> ${j}, method=${g}`);try{const e=await this._client.request({url:j,method:g,headers:b,["get"===g?"params":"data"]:h});if(i){const t=e.status.toString(),r=l?.[t];if(r){const i=this._ajv.compile(r);if(!i(e.data))throw this.emit("validationError",{stage:"response",errors:i.errors}),new u("Response validation failed.",t,i.errors)}}return this._resetCircuitBreakerSuccess(),"function"==typeof r?e.data=r(e.data):!0===r&&(e.data=this._transformData(e.data)),Array.isArray(s.postActions)&&s.postActions.forEach((t=>{const r=t.path?this._getValueByPath(e.data,t.path):null;switch(t.type){case"setToken":this.setToken(r);break;case"setRefreshToken":this.setRefreshToken(r);break;case"setUserId":this._setUserId(r);break;case"resetSession":this.resetSession();break;case"emitEvent":t.event&&(this.emit(t.event,r),this._logger.debug(`[ApiClient] Event émis : ${t.event}`,r));break;case"callMethod":"function"==typeof this[t.method]?(this[t.method](),this._logger.debug(`[ApiClient] Méthode appelée : ${t.method}`)):this._logger.warn(`[ApiClient] Méthode inconnue : ${t.method}`);break;default:this._logger.warn(`[ApiClient] Action inconnue : ${t.type}`)}})),e}catch(e){throw this._updateCircuitBreakerError(),e}}resetSession(){this.setToken(null),this.setRefreshToken(null),this._setUserId(null),delete this._client.defaults.headers.common.Authorization,this._logger.info("[ApiClient] Session utilisateur réinitialisée."),this.emit("sessionReset")}_getValueByPath(e,t){if(t)return t.split(".").reduce(((e,t)=>e&&e[t]),e)}static toURLSearchParams(e,t={}){return this._buildParams(e,new URLSearchParams,t)}static _buildParams(e,t,r={}){if("object"!=typeof e||null===e)throw new TypeError("La donnée doit être un objet non nul.");const{dots:i=!1,indexes:s=!1,metaTokens:o=!0}=r,n=[];function p(e){return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)}function a(e){return e.endsWith("[]")?e.slice(0,-2):e}function d(e,t,r=!1){return e?e.concat(t).map(((e,t)=>(e=a(e),!r&&t?`[${e}]`:e))).join(r?".":""):t}function c(e){return null==e?"":e instanceof Date?e.toISOString():(e instanceof Blob||e instanceof File||e instanceof ArrayBuffer||ArrayBuffer.isView(e),e)}return function e(r,l=[]){null==r||n.includes(r)||(n.push(r),Object.entries(r).forEach((([r,n])=>{void 0!==n&&function(e,r,n){if(e&&"object"==typeof e){if(r.endsWith("{}"))return r=o?r:r.slice(0,-2),t.append(d(n,r,i),JSON.stringify(e)),!1;if(Array.isArray(e)&&!e.some(p)||r.endsWith("[]"))return r=a(r),e.forEach(((e,o)=>{if(null!=e){const p=s?d(n.concat(r),o,i):`${d(n,r,i)}[]`;t.append(p,c(e))}})),!1}return!!p(e)||(t.append(d(n,r,i),c(e)),!1)}(n,r.trim(),l)&&e(n,l.concat(a(r)))})),n.pop())}(e),t}_transformData(e){if(e&&"object"==typeof e)if(e.resultGoods?.msg)e=this._normalizeJsonData({msg:e.resultGoods.msg,...e});else if(e.resultErrors?.msg)e=this._normalizeJsonData({msg:e.resultErrors.msg,...e});else if(e.results&&"object"==typeof e.results&&!Array.isArray(e.results))e.results=Object.keys(e.results).map((t=>this._normalizeJsonData({id:t,...e.results[t]})));else if(Array.isArray(e.results))e.results=e.results.map((e=>this._normalizeJsonData(e)));else if(e.news&&Array.isArray(e.news)&&0===e.news.length)e=e.news;else if(e.news&&"object"==typeof e.news&&!Array.isArray(e.news))e=Object.keys(e.news).map((t=>this._normalizeJsonData({id:t,...e.news[t]})));else if(e.notif&&"object"==typeof e.notif&&!Array.isArray(e.notif))e.notif=Object.keys(e.notif).map((t=>this._normalizeJsonData({id:t,...e.notif[t]})));else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens)&&e.organizations&&"object"==typeof e.organizations&&!Array.isArray(e.organizations))e=[...Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]}))),...Object.keys(e.organizations).map((t=>this._normalizeJsonData({id:t,...e.organizations[t]})))];else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens))e=Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]})));else if(e.cities&&"object"==typeof e.cities&&!Array.isArray(e.cities))e=Object.keys(e.cities).map((t=>this._normalizeJsonData({id:t,...e.cities[t]})));else if(e.cities&&Array.isArray(e.cities)&&0===e.cities.length)e=e.cities;else if(e.newComment&&"object"==typeof e.newComment)e.newComment=this._normalizeJsonData({...e.newComment});else if(Array.isArray(e))e=e.map((e=>this._normalizeJsonData(e)));else if(e.map&&"object"==typeof e.map)e.map=this._normalizeJsonData(e.map);else if(e.object&&"object"==typeof e.object)e.object=this._normalizeJsonData(e.object);else if("object"==typeof e&&Object.keys(e).length>0){const t=Object.keys(e).every((e=>/^[0-9a-fA-F]{24}$/.test(e)));e=t?Object.keys(e).map((t=>({id:t,...this._normalizeJsonData(e[t])}))):this._normalizeJsonData(e)}return e}_normalizeJsonData(e){if(!e||"object"!=typeof e)return e;if(e=this._normalizeRecursively(e),e?.mediaImg?.images&&Array.isArray(e.mediaImg.images)&&e.mediaImg.images.length>0&&(e.mediaImg.countImages=e.mediaImg.images.length),e?.mediaFile?.files&&Array.isArray(e.mediaFile.files)&&e.mediaFile.files.length>0&&(e.mediaFile.countFiles=e.mediaFile.files.length),e?.src?.changes&&"object"==typeof e.src.changes&&Object.keys(e.src.changes).length>0&&Object.keys(e.src.changes).forEach((t=>{e.src.changes[t]&&(e.src.changes[t]=this._ensureFullURL(e.src.changes[t]))})),e?.openingHours&&Array.isArray(e.openingHours)&&e.openingHours.length>0&&(e.openingHours=e.openingHours.filter((e=>e.dayOfWeek&&e.hours&&e.hours[0]&&e.hours[0].opens))),e.replies&&"object"==typeof e.replies&&Object.keys(e.replies).length>0&&(e.replies=Object.keys(e.replies).map((t=>this._normalizeJsonData({id:t,...e.replies[t]})))),e?.author&&"object"==typeof e.author&&Object.keys(e.author).length>0&&!("profilThumbImageUrl"in e.author)){const t=Object.keys(e.author)[0];e.author={...e.author[t]}}return e?.timeAgo&&delete e.timeAgo,this._fromJSONValue?p.fromJSONValue(e):e}_ensureFullURL(e){if(!e)return e;if(!(e=e.trim())||/^https?:\/\//i.test(e))return e;let t="/";return t=this._baseURL.endsWith("/")&&e.startsWith("/")||this._baseURL.endsWith("/")||e.startsWith("/")?"":"/",`${this._baseURL}${t}${e}`}_normalizeDatesRecursively(e){return null===e||"object"!=typeof e?e:Array.isArray(e)?e.map((e=>this._normalizeDatesRecursively(e))):(Object.keys(e).forEach((t=>{this._dateFields.includes(t)&&(e[t]&&"object"==typeof e[t]&&e[t].sec&&"number"==typeof e[t].sec?e[t]={$date:1e3*e[t].sec}:"number"==typeof e[t]&&(e[t]={$date:1e3*e[t]})),e[t]&&"object"==typeof e[t]&&this._normalizeDatesRecursively(e[t])})),e)}_normalizeImagesRecursively(e){return null===e||"object"!=typeof e?e:Array.isArray(e)?e.map((e=>this._normalizeImagesRecursively(e))):(Object.keys(e).forEach((t=>{this._imageFields.includes(t)&&"string"==typeof e[t]&&""!==e[t].trim()&&(e[t]=this._ensureFullURL(e[t])),"content"===t&&e[t]?.image&&(e[t].image=this._ensureFullURL(e[t].image)),e[t]&&"object"==typeof e[t]&&this._normalizeImagesRecursively(e[t])})),e)}_normalizeIdRecursively(e){return null===e||"object"!=typeof e?e:Array.isArray(e)?e.map((e=>this._normalizeIdRecursively(e))):(e._id&&e._id.$id&&/^[0-9a-fA-F]{24}$/.test(e._id.$id)&&(e.id=e._id.$id,e._id={$type:"oid",$value:e._id.$id}),e.id&&e.id.$id&&/^[0-9a-fA-F]{24}$/.test(e.id.$id)&&(e._id={$type:"oid",$value:e.id.$id},e.id=e.id.$id),Object.keys(e).forEach((t=>{e[t]&&"object"==typeof e[t]&&(e[t]=this._normalizeIdRecursively(e[t]))})),e)}_normalizeBooleansRecursively(e){return"string"==typeof e?"true"===e||"false"!==e&&e:Array.isArray(e)?e.map((e=>this._normalizeBooleansRecursively(e))):(null!==e&&"object"==typeof e&&Object.keys(e).forEach((t=>{e[t]=this._normalizeBooleansRecursively(e[t])})),e)}_normalizeString(e){return"true"===e||"false"!==e&&e}_normalizeId(e){return e._id&&e._id.$id&&/^[0-9a-fA-F]{24}$/.test(e._id.$id)&&(e.id=e._id.$id,e._id={$type:"oid",$value:e._id.$id}),e.id&&e.id.$id&&/^[0-9a-fA-F]{24}$/.test(e.id.$id)&&(e._id={$type:"oid",$value:e.id.$id},e.id=e.id.$id),e}_normalizeDate(e){return e&&"object"==typeof e&&"number"==typeof e.sec?{$date:1e3*e.sec}:"number"==typeof e?{$date:1e3*e}:e}_normalizeImage(e){return"string"==typeof e&&""!==e.trim()?this._ensureFullURL(e):e}_imageFields=["profilImageUrl","profilThumbImageUrl","profilMediumImageUrl","profilMarkerImageUrl","profilBannerUrl","profilRealBannerUrl","imagePath","imageThumbPath","docPath"];_dateFields=["modified","created","updated","birthDate","lastLoginDate","startDate","endDate","date"];_normalizeRecursively(e){if("string"==typeof e)return this._normalizeString(e);if(Array.isArray(e))return e.map((e=>this._normalizeRecursively(e)));if(null!==e&&"object"==typeof e){const t={};return Object.keys(e).forEach((r=>{let i=this._normalizeRecursively(e[r]);this._dateFields.includes(r)&&(i=this._normalizeDate(i)),this._imageFields.includes(r)&&(i=this._normalizeImage(i)),"content"===r&&i&&"object"==typeof i&&i.image&&(i.image=this._normalizeImage(i.image)),t[r]=i})),this._normalizeId(t)}return e}}module.exports=t})();
|
|
1
|
+
(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>f});const o=require("events"),r=require("ajv"),n=require("ajv-formats"),i=require("axios"),s=require("axios-retry"),a=require("ejson"),m=require("pino"),p={_looksLikeObjectID:e=>24===e.length&&/^[0-9a-f]*$/.test(e),ObjectID:class{constructor(e){if(e){if(e=e.toLowerCase(),!p._looksLikeObjectID(e))throw new Error("Invalid hexadecimal string for creating an ObjectID");this._str=e}}equals(e){return e instanceof p.ObjectID&&this.valueOf()===e.valueOf()}toString(){return`ObjectID("${this._str}")`}clone(){return new p.ObjectID(this._str)}typeName(){return"oid"}getTimestamp(){return Number.parseInt(this._str.substr(0,8),16)}valueOf(){return this._str}toJSONValue(){return this.valueOf()}toHexString(){return this.valueOf()}}},c=p,d={common1:{type:"string"},common2:{format:"email",type:"string"},common3:{type:"boolean"},common4:{const:!0,type:"boolean"},common5:{additionalProperties:!1,properties:{msg:{type:"string"},result:{const:!1,type:"boolean"}},required:["result","msg"],type:"object"},common6:{msg:{type:"string"},result:{const:!1,type:"boolean"}},common7:{const:!1,type:"boolean"},common8:{type:"integer"},common9:{format:"uri",type:"string"},common10:{enum:[""],type:"string"},common11:{properties:{betaTester:{type:"boolean"},standalonePageAccess:{type:"boolean"},superAdmin:{type:"boolean"}},type:"object"},common12:{betaTester:{type:"boolean"},standalonePageAccess:{type:"boolean"},superAdmin:{type:"boolean"}},common13:{additionalProperties:!1,properties:{error:{type:"string"}},required:["error"],type:"object"},common14:{error:{type:"string"}},common15:{_idObject:{additionalProperties:!1,properties:{$id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["$id"],type:"object"},dateObject:{oneOf:[{additionalProperties:!1,properties:{sec:{type:"number"},usec:{type:"number"}},required:["sec","usec"],type:"object"},{type:"integer"}]}},common16:{additionalProperties:!1,properties:{$id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["$id"],type:"object"},common17:{$id:{pattern:"^[a-f0-9]{24}$",type:"string"}},common18:{pattern:"^[a-f0-9]{24}$",type:"string"},common19:{oneOf:[{additionalProperties:!1,properties:{sec:{type:"number"},usec:{type:"number"}},required:["sec","usec"],type:"object"},{type:"integer"}]},common20:{additionalProperties:!1,properties:{sec:{type:"number"},usec:{type:"number"}},required:["sec","usec"],type:"object"},common21:{sec:{type:"number"},usec:{type:"number"}},common22:{type:"number"},common23:{$ref:"#/$defs/_idObject"},common24:{additionalProperties:!1,properties:{sec:{type:"integer"},usec:{type:"integer"}},required:["sec","usec"],type:"object"},common25:{sec:{type:"integer"},usec:{type:"integer"}},common26:{$ref:"#/$defs/dateObject"},common27:{properties:{activitypub:{type:"boolean"},activitypubStarterClosed:{type:"boolean"},badge:{type:"boolean"},isOpenData:{type:"boolean"},notifications:{items:{},type:"array"},privateFields:{items:{type:"string"},type:"array"},publicFields:{items:{type:"string"},type:"array"},sendMail:{oneOf:[{additionalProperties:!1,properties:{source:{items:{},type:"array"}},required:["source"],type:"object"},{const:!1,type:"boolean"}]}},required:["isOpenData","sendMail"],type:"object"},common28:{activitypub:{type:"boolean"},activitypubStarterClosed:{type:"boolean"},badge:{type:"boolean"},isOpenData:{type:"boolean"},notifications:{items:{},type:"array"},privateFields:{items:{type:"string"},type:"array"},publicFields:{items:{type:"string"},type:"array"},sendMail:{oneOf:[{additionalProperties:!1,properties:{source:{items:{},type:"array"}},required:["source"],type:"object"},{const:!1,type:"boolean"}]}},common29:{items:{},type:"array"},common30:{},common31:{items:{type:"string"},type:"array"},common32:{oneOf:[{additionalProperties:!1,properties:{source:{items:{},type:"array"}},required:["source"],type:"object"},{const:!1,type:"boolean"}]},common33:{additionalProperties:!1,properties:{source:{items:{},type:"array"}},required:["source"],type:"object"},common34:{source:{items:{},type:"array"}},common35:{format:"uri-reference",type:"string"},common36:{additionalProperties:!1,properties:{msg:{type:"string"},result:{const:!0,type:"boolean"}},required:["result","msg"],type:"object"},common37:{msg:{type:"string"},result:{const:!0,type:"boolean"}},common38:{default:"@userId",type:"string"},common39:{id:{default:"@userId",type:"string"}},common40:{default:"",type:"string"},common41:{200:{additionalProperties:!1,properties:{msg:{type:"string"},result:{const:!0,type:"boolean"}},required:["result","msg"],type:"object"},401:{additionalProperties:!1,properties:{error:{type:"string"}},required:["error"],type:"object"}},common42:{const:"citoyens"},common43:{properties:{value:{type:"boolean"}}},common44:{value:{type:"boolean"}},common45:{if:{properties:{typeElement:{const:"citoyens"}}},then:{properties:{id:{default:"@userId",type:"string"}}}},common46:{properties:{typeElement:{const:"citoyens"}}},common47:{typeElement:{const:"citoyens"}},common48:{properties:{id:{default:"@userId",type:"string"}}},common49:{not:{type:"null"}},common50:{type:"null"},common51:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},common52:{type:["string","null"]},common53:{anyOf:[{items:{type:"string"},type:"array"},{enum:[""],type:"string"}]},common54:{properties:{name:{not:{type:"null"}}},required:["name"]},common55:{name:{not:{type:"null"}}},common56:{properties:{url:{not:{type:"null"}}},required:["url"]},common57:{url:{not:{type:"null"}}},common58:{properties:{tags:{not:{type:"null"}}},required:["tags"]},common59:{tags:{not:{type:"null"}}},common60:{properties:{email:{not:{type:"null"}}},required:["email"]},common61:{email:{not:{type:"null"}}},common62:{const:"info",default:"info",type:"string"},common63:{$ref:"#/$defs/sharedFields/email"},common64:{$ref:"#/$defs/sharedFields/name"},common65:{$ref:"#/$defs/sharedFields/tags"},common66:{$ref:"#/$defs/sharedFields/url"},common67:{const:"projects"},common68:{name:{type:"string"},type:{type:"string"}},common69:{const:"organizations"},common70:{200:{oneOf:[{additionalProperties:!1,properties:{result:{const:!0,type:"boolean"},resultGoods:{additionalProperties:!0,properties:{msg:{type:"string"},result:{const:!0,type:"boolean"},values:{additionalProperties:!0,type:"object"}},required:["result","msg"],type:"object"}},required:["result","resultGoods"],type:"object"},{additionalProperties:!1,properties:{resultErrors:{additionalProperties:!0,properties:{msg:{type:"string"},result:{const:!1,type:"boolean"}},required:["result","msg"],type:"object"}},required:["resultErrors"],type:"object"}]},401:{additionalProperties:!1,properties:{error:{type:"string"}},required:["error"],type:"object"}},common71:{oneOf:[{additionalProperties:!1,properties:{result:{const:!0,type:"boolean"},resultGoods:{additionalProperties:!0,properties:{msg:{type:"string"},result:{const:!0,type:"boolean"},values:{additionalProperties:!0,type:"object"}},required:["result","msg"],type:"object"}},required:["result","resultGoods"],type:"object"},{additionalProperties:!1,properties:{resultErrors:{additionalProperties:!0,properties:{msg:{type:"string"},result:{const:!1,type:"boolean"}},required:["result","msg"],type:"object"}},required:["resultErrors"],type:"object"}]},common72:{additionalProperties:!1,properties:{result:{const:!0,type:"boolean"},resultGoods:{additionalProperties:!0,properties:{msg:{type:"string"},result:{const:!0,type:"boolean"},values:{additionalProperties:!0,type:"object"}},required:["result","msg"],type:"object"}},required:["result","resultGoods"],type:"object"},common73:{result:{const:!0,type:"boolean"},resultGoods:{additionalProperties:!0,properties:{msg:{type:"string"},result:{const:!0,type:"boolean"},values:{additionalProperties:!0,type:"object"}},required:["result","msg"],type:"object"}},common74:{additionalProperties:!0,properties:{msg:{type:"string"},result:{const:!0,type:"boolean"},values:{additionalProperties:!0,type:"object"}},required:["result","msg"],type:"object"},common75:{msg:{type:"string"},result:{const:!0,type:"boolean"},values:{additionalProperties:!0,type:"object"}},common76:{additionalProperties:!0,type:"object"},common77:{additionalProperties:!1,properties:{resultErrors:{additionalProperties:!0,properties:{msg:{type:"string"},result:{const:!1,type:"boolean"}},required:["result","msg"],type:"object"}},required:["resultErrors"],type:"object"},common78:{resultErrors:{additionalProperties:!0,properties:{msg:{type:"string"},result:{const:!1,type:"boolean"}},required:["result","msg"],type:"object"}},common79:{additionalProperties:!0,properties:{msg:{type:"string"},result:{const:!1,type:"boolean"}},required:["result","msg"],type:"object"},common80:{$ref:"#/$defs/socialField"},common81:{minLength:0,type:"string"},common82:{const:"GeoCoordinates",type:"string"},common83:{type:["string","number"]},common84:{items:{type:"number"},maxItems:2,minItems:2,type:"array"},common85:{const:!0,default:!0,type:"boolean"},common86:{maxLength:100,minLength:3,pattern:"^[a-zA-Z0-9]+$",type:"string"},common87:{properties:{type:{const:"citoyens"}}},common88:{type:{const:"citoyens"}},common89:{additionalProperties:!1,allOf:[{if:{properties:{folder:{const:"citoyens"}}},then:{properties:{ownerId:{default:"@userId"}}}}],properties:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},required:["folder","ownerId"],type:"object"},common90:{if:{properties:{folder:{const:"citoyens"}}},then:{properties:{ownerId:{default:"@userId"}}}},common91:{properties:{folder:{const:"citoyens"}}},common92:{folder:{const:"citoyens"}},common93:{properties:{ownerId:{default:"@userId"}}},common94:{ownerId:{default:"@userId"}},common95:{default:"@userId"},common96:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},common97:{additionalProperties:!1,properties:{$id:{type:"string"}},required:["$id"],type:"object"},common98:{$id:{type:"string"}},common99:{if:{properties:{type:{const:"citoyens"}}},then:{properties:{id:{default:"@userId"}}}},common100:{properties:{id:{default:"@userId"}}},common101:{id:{default:"@userId"}},common102:{enum:["citoyens"],type:"string"},common103:{anyOf:[{enum:[""],type:"string"},{format:"uri-reference",type:"string"}]},common104:{enum:["projects"],type:"string"},common105:{type:"object"},common106:{anyOf:[{type:"boolean"},{enum:["true","false"],type:"string"}]},common107:{enum:["true","false"],type:"string"},common108:{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{parentId:{default:"@userId",type:"string"}}}},common109:{properties:{parentType:{const:"citoyens"}}},common110:{parentType:{const:"citoyens"}},common111:{properties:{parentId:{default:"@userId",type:"string"}}},common112:{parentId:{default:"@userId",type:"string"}},common113:{_idObject:{additionalProperties:!1,properties:{$id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["$id"],type:"object"}},common114:{default:!0,type:"boolean"},common115:{NewsSchema:{additionalProperties:!0,properties:{_id:{$ref:"#/$defs/_idObject"},author:{$ref:"#/$defs/user"},collection:{const:"news",type:"string"},comment:{type:["string","null"]},created:{$ref:"#/$defs/dateObject"},date:{$ref:"#/$defs/dateObject"},lastAuthorShare:{$ref:"#/$defs/sharedUser"},markdownActive:{type:"boolean"},media:{additionalProperties:!0,type:"object"},mediaImg:{additionalProperties:!0,type:"object"},mentions:{items:{additionalProperties:!0,properties:{avatar:{type:"string"},count:{type:"string"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","avatar","type","value","count"],type:"object"},type:"array"},scope:{additionalProperties:!0,properties:{type:{type:"string"}},required:["type"],type:"object"},sharedBy:{items:{$ref:"#/$defs/sharedUser"},type:"array"},tags:{items:{type:"string"},type:"array"},target:{$ref:"#/$defs/user"},text:{type:"string"},type:{const:"news",type:"string"},typeSig:{const:"news",type:"string"},updated:{$ref:"#/$defs/dateObject"},vote:{additionalProperties:{additionalProperties:!1,properties:{date:{$ref:"#/$defs/dateObject"},status:{type:"string"}},required:["status","date"],type:"object"},type:"object"},voteCount:{additionalProperties:{type:"number"},type:"object"}},required:["_id","type","text","author","date","collection","sharedBy","target","created","markdownActive","scope","updated","comment","typeSig","lastAuthorShare"],type:"object"},_idObject:{additionalProperties:!1,properties:{$id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["$id"],type:"object"},dateObject:{oneOf:[{additionalProperties:!1,properties:{sec:{type:"number"},usec:{type:"number"}},required:["sec","usec"],type:"object"},{type:"integer"}]},sharedUser:{allOf:[{$ref:"#/$defs/user"},{properties:{comment:{type:["string","null"]},updated:{$ref:"#/$defs/dateObject"}},required:["updated","comment"],type:"object"}]},user:{additionalProperties:!0,properties:{geo:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:"string"},longitude:{type:"string"}},required:["@type","latitude","longitude"],type:"object"},id:{type:"string"},name:{type:"string"},profilThumbImageUrl:{format:"uri-reference",type:"string"},type:{type:"string"}},required:["id","name","type"],type:"object"}},common116:{additionalProperties:!0,properties:{_id:{$ref:"#/$defs/_idObject"},author:{$ref:"#/$defs/user"},collection:{const:"news",type:"string"},comment:{type:["string","null"]},created:{$ref:"#/$defs/dateObject"},date:{$ref:"#/$defs/dateObject"},lastAuthorShare:{$ref:"#/$defs/sharedUser"},markdownActive:{type:"boolean"},media:{additionalProperties:!0,type:"object"},mediaImg:{additionalProperties:!0,type:"object"},mentions:{items:{additionalProperties:!0,properties:{avatar:{type:"string"},count:{type:"string"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","avatar","type","value","count"],type:"object"},type:"array"},scope:{additionalProperties:!0,properties:{type:{type:"string"}},required:["type"],type:"object"},sharedBy:{items:{$ref:"#/$defs/sharedUser"},type:"array"},tags:{items:{type:"string"},type:"array"},target:{$ref:"#/$defs/user"},text:{type:"string"},type:{const:"news",type:"string"},typeSig:{const:"news",type:"string"},updated:{$ref:"#/$defs/dateObject"},vote:{additionalProperties:{additionalProperties:!1,properties:{date:{$ref:"#/$defs/dateObject"},status:{type:"string"}},required:["status","date"],type:"object"},type:"object"},voteCount:{additionalProperties:{type:"number"},type:"object"}},required:["_id","type","text","author","date","collection","sharedBy","target","created","markdownActive","scope","updated","comment","typeSig","lastAuthorShare"],type:"object"},common117:{_id:{$ref:"#/$defs/_idObject"},author:{$ref:"#/$defs/user"},collection:{const:"news",type:"string"},comment:{type:["string","null"]},created:{$ref:"#/$defs/dateObject"},date:{$ref:"#/$defs/dateObject"},lastAuthorShare:{$ref:"#/$defs/sharedUser"},markdownActive:{type:"boolean"},media:{additionalProperties:!0,type:"object"},mediaImg:{additionalProperties:!0,type:"object"},mentions:{items:{additionalProperties:!0,properties:{avatar:{type:"string"},count:{type:"string"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","avatar","type","value","count"],type:"object"},type:"array"},scope:{additionalProperties:!0,properties:{type:{type:"string"}},required:["type"],type:"object"},sharedBy:{items:{$ref:"#/$defs/sharedUser"},type:"array"},tags:{items:{type:"string"},type:"array"},target:{$ref:"#/$defs/user"},text:{type:"string"},type:{const:"news",type:"string"},typeSig:{const:"news",type:"string"},updated:{$ref:"#/$defs/dateObject"},vote:{additionalProperties:{additionalProperties:!1,properties:{date:{$ref:"#/$defs/dateObject"},status:{type:"string"}},required:["status","date"],type:"object"},type:"object"},voteCount:{additionalProperties:{type:"number"},type:"object"}},common118:{$ref:"#/$defs/user"},common119:{const:"news",type:"string"},common120:{$ref:"#/$defs/sharedUser"},common121:{items:{additionalProperties:!0,properties:{avatar:{type:"string"},count:{type:"string"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","avatar","type","value","count"],type:"object"},type:"array"},common122:{additionalProperties:!0,properties:{avatar:{type:"string"},count:{type:"string"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","avatar","type","value","count"],type:"object"},common123:{avatar:{type:"string"},count:{type:"string"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common124:{additionalProperties:!0,properties:{type:{type:"string"}},required:["type"],type:"object"},common125:{type:{type:"string"}},common126:{items:{$ref:"#/$defs/sharedUser"},type:"array"},common127:{additionalProperties:{additionalProperties:!1,properties:{date:{$ref:"#/$defs/dateObject"},status:{type:"string"}},required:["status","date"],type:"object"},type:"object"},common128:{additionalProperties:!1,properties:{date:{$ref:"#/$defs/dateObject"},status:{type:"string"}},required:["status","date"],type:"object"},common129:{date:{$ref:"#/$defs/dateObject"},status:{type:"string"}},common130:{additionalProperties:{type:"number"},type:"object"},common131:{allOf:[{$ref:"#/$defs/user"},{properties:{comment:{type:["string","null"]},updated:{$ref:"#/$defs/dateObject"}},required:["updated","comment"],type:"object"}]},common132:{properties:{comment:{type:["string","null"]},updated:{$ref:"#/$defs/dateObject"}},required:["updated","comment"],type:"object"},common133:{comment:{type:["string","null"]},updated:{$ref:"#/$defs/dateObject"}},common134:{additionalProperties:!0,properties:{geo:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:"string"},longitude:{type:"string"}},required:["@type","latitude","longitude"],type:"object"},id:{type:"string"},name:{type:"string"},profilThumbImageUrl:{format:"uri-reference",type:"string"},type:{type:"string"}},required:["id","name","type"],type:"object"},common135:{geo:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:"string"},longitude:{type:"string"}},required:["@type","latitude","longitude"],type:"object"},id:{type:"string"},name:{type:"string"},profilThumbImageUrl:{format:"uri-reference",type:"string"},type:{type:"string"}},common136:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:"string"},longitude:{type:"string"}},required:["@type","latitude","longitude"],type:"object"},common137:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:"string"},longitude:{type:"string"}},common138:{maxItems:0,minItems:0,type:"array"},common139:{enum:["citoyens","projects","organizations"],type:"string"},common140:{$ref:"#/$defs/NewsSchema"},common141:{required:["text"]},common142:{required:["mediaImg"]},common143:{required:["mediaFile"]},common144:{additionalProperties:!1,properties:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},required:["countFiles","files"],type:"object"},common145:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},common146:{additionalProperties:!1,properties:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},required:["countImages","images"],type:"object"},common147:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},common148:{additionalProperties:!1,patternProperties:{"^[0-9]+$":{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"}},type:"object"},common149:{"^[0-9]+$":{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"}},common150:{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},common151:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common152:{default:"public",enum:["public","private","restricted"],type:"string"},common153:{const:"news",default:"news",type:"string"},common154:{NewsSchema:{additionalProperties:!0,properties:{_id:{$ref:"#/$defs/_idObject"},author:{$ref:"#/$defs/user"},collection:{const:"news",type:"string"},comment:{type:["string","null"]},created:{$ref:"#/$defs/dateObject"},date:{$ref:"#/$defs/dateObject"},lastAuthorShare:{$ref:"#/$defs/sharedUser"},markdownActive:{type:"boolean"},media:{additionalProperties:!0,type:"object"},mediaImg:{additionalProperties:!0,type:"object"},mentions:{items:{additionalProperties:!0,properties:{avatar:{type:"string"},count:{type:"string"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","avatar","type","value","count"],type:"object"},type:"array"},scope:{additionalProperties:!0,properties:{type:{type:"string"}},required:["type"],type:"object"},sharedBy:{items:{$ref:"#/$defs/sharedUser"},type:"array"},tags:{items:{type:"string"},type:"array"},target:{$ref:"#/$defs/user"},text:{type:"string"},type:{const:"news",type:"string"},typeSig:{const:"news",type:"string"},updated:{$ref:"#/$defs/dateObject"},vote:{additionalProperties:{additionalProperties:!1,properties:{date:{$ref:"#/$defs/dateObject"},status:{type:"string"}},required:["status","date"],type:"object"},type:"object"},voteCount:{additionalProperties:{type:"number"},type:"object"}},required:["_id","type","text","author","date","collection","sharedBy","target","created","markdownActive","scope","updated","comment","typeSig","lastAuthorShare"],type:"object"},_idObject:{additionalProperties:!1,properties:{$id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["$id"],type:"object"},dateObject:{oneOf:[{additionalProperties:!1,properties:{sec:{type:"number"},usec:{type:"number"}},required:["sec","usec"],type:"object"},{type:"integer"}]},sharedUser:{allOf:[{$ref:"#/$defs/user"},{properties:{comment:{type:["string","null"]},updated:{$ref:"#/$defs/dateObject"}},required:["updated","comment"],type:"object"}]},user:{additionalProperties:!0,properties:{geo:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:"string"},longitude:{type:"string"}},required:["@type","latitude","longitude"],type:"object"},id:{type:"string"},name:{type:"string"},profilThumbImageUrl:{format:"uri-reference",type:"string"},type:{type:"string"}},required:["id","name"],type:"object"}},common155:{additionalProperties:!0,properties:{geo:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:"string"},longitude:{type:"string"}},required:["@type","latitude","longitude"],type:"object"},id:{type:"string"},name:{type:"string"},profilThumbImageUrl:{format:"uri-reference",type:"string"},type:{type:"string"}},required:["id","name"],type:"object"},common156:{200:{oneOf:[{properties:{docPath:{type:"string"},id:{additionalProperties:!1,properties:{$id:{type:"string"}},required:["$id"],type:"object"},msg:{type:"string"},name:{type:"string"},result:{const:!0,type:"boolean"},resultUpload:{const:!0,type:"boolean"},size:{type:"number"},success:{const:!0,type:"boolean"}},required:["resultUpload","success","name","docPath","size","result","msg","id"],type:"object"},{additionalProperties:!1,properties:{msg:{type:"string"},result:{const:!1,type:"boolean"}},required:["result","msg"],type:"object"}]},401:{additionalProperties:!1,properties:{error:{type:"string"}},required:["error"],type:"object"}},common157:{oneOf:[{properties:{docPath:{type:"string"},id:{additionalProperties:!1,properties:{$id:{type:"string"}},required:["$id"],type:"object"},msg:{type:"string"},name:{type:"string"},result:{const:!0,type:"boolean"},resultUpload:{const:!0,type:"boolean"},size:{type:"number"},success:{const:!0,type:"boolean"}},required:["resultUpload","success","name","docPath","size","result","msg","id"],type:"object"},{additionalProperties:!1,properties:{msg:{type:"string"},result:{const:!1,type:"boolean"}},required:["result","msg"],type:"object"}]},common158:{properties:{docPath:{type:"string"},id:{additionalProperties:!1,properties:{$id:{type:"string"}},required:["$id"],type:"object"},msg:{type:"string"},name:{type:"string"},result:{const:!0,type:"boolean"},resultUpload:{const:!0,type:"boolean"},size:{type:"number"},success:{const:!0,type:"boolean"}},required:["resultUpload","success","name","docPath","size","result","msg","id"],type:"object"},common159:{docPath:{type:"string"},id:{additionalProperties:!1,properties:{$id:{type:"string"}},required:["$id"],type:"object"},msg:{type:"string"},name:{type:"string"},result:{const:!0,type:"boolean"},resultUpload:{const:!0,type:"boolean"},size:{type:"number"},success:{const:!0,type:"boolean"}},common160:{additionalProperties:!1,properties:{id:{type:"string"}},required:["id"],type:"object"},common161:{id:{type:"string"}},common162:{default:!1,type:"boolean"},common163:{properties:{msg:{type:"string"},result:{const:!1,type:"boolean"}},required:["result","msg"],type:"object"},common164:{properties:{type:{type:"string"}},type:"object"},common165:{additionalProperties:!1,properties:{id:{type:"string"},type:{default:"news",enum:["news"],type:"string"}},required:["type","id"],type:"object"},common166:{id:{type:"string"},type:{default:"news",enum:["news"],type:"string"}},common167:{default:"news",enum:["news"],type:"string"},common168:{properties:{activitypub:{type:"boolean"},badge:{type:"boolean"},isOpenData:{type:"boolean"},privateFields:{items:{type:"string"},type:"array"},publicFields:{items:{type:"string"},type:"array"},sendMail:{type:"boolean"}},required:["isOpenData","sendMail"],type:"object"},common169:{activitypub:{type:"boolean"},badge:{type:"boolean"},isOpenData:{type:"boolean"},privateFields:{items:{type:"string"},type:"array"},publicFields:{items:{type:"string"},type:"array"},sendMail:{type:"boolean"}},common170:{type:["array","null"]},common171:{$ref:"#/$defs/author"},common172:{enum:["comments"],type:"string"},common173:{additionalProperties:!1,patternProperties:{"^[a-f0-9]{24}$":{$ref:"#/$defs/comment"}},type:"object"},common174:{"^[a-f0-9]{24}$":{$ref:"#/$defs/comment"}},common175:{$ref:"#/$defs/comment"},common176:{$ref:"#/$defs/views"},common177:{additionalProperties:!1,patternProperties:{"^[a-f0-9]{24}$":{properties:{date:{$ref:"#/$defs/dateObject"}},required:["date"],type:"object"}},type:"object"},common178:{"^[a-f0-9]{24}$":{properties:{date:{$ref:"#/$defs/dateObject"}},required:["date"],type:"object"}},common179:{properties:{date:{$ref:"#/$defs/dateObject"}},required:["date"],type:"object"},common180:{date:{$ref:"#/$defs/dateObject"}},common181:{items:{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},type:"array"},common182:{minimum:0,type:"integer"},common183:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],type:"string"},common184:{const:!1,default:!1,type:"boolean"},common185:{const:"",default:"",type:"string"},common186:{200:{$defs:{_idObject:{additionalProperties:!1,properties:{$id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["$id"],type:"object"},dateObject:{oneOf:[{additionalProperties:!1,properties:{sec:{type:"number"},usec:{type:"number"}},required:["sec","usec"],type:"object"},{type:"integer"}]},emptyArray:{maxItems:0,minItems:0,type:"array"}},oneOf:[{additionalProperties:!1,properties:{count:{additionalProperties:!1,minProperties:1,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{minimum:0,type:"integer"}},type:"object"},results:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{_id:{$ref:"#/$defs/_idObject"},collection:{type:"string"},created:{$ref:"#/$defs/dateObject"},links:{type:"object"},name:{type:"string"},parent:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},slug:{type:"string"},updated:{$ref:"#/$defs/dateObject"}},required:["_id","collection","name"],type:"object"}},type:"object"}},required:["results","count"],type:"object"},{additionalProperties:!1,properties:{count:{additionalProperties:!1,minProperties:1,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{const:0,type:"integer"}},type:"object"},results:{$ref:"#/$defs/emptyArray"}},required:["results","count"],type:"object"}]},401:{additionalProperties:!1,properties:{error:{type:"string"}},required:["error"],type:"object"}},common187:{$defs:{_idObject:{additionalProperties:!1,properties:{$id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["$id"],type:"object"},dateObject:{oneOf:[{additionalProperties:!1,properties:{sec:{type:"number"},usec:{type:"number"}},required:["sec","usec"],type:"object"},{type:"integer"}]},emptyArray:{maxItems:0,minItems:0,type:"array"}},oneOf:[{additionalProperties:!1,properties:{count:{additionalProperties:!1,minProperties:1,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{minimum:0,type:"integer"}},type:"object"},results:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{_id:{$ref:"#/$defs/_idObject"},collection:{type:"string"},created:{$ref:"#/$defs/dateObject"},links:{type:"object"},name:{type:"string"},parent:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},slug:{type:"string"},updated:{$ref:"#/$defs/dateObject"}},required:["_id","collection","name"],type:"object"}},type:"object"}},required:["results","count"],type:"object"},{additionalProperties:!1,properties:{count:{additionalProperties:!1,minProperties:1,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{const:0,type:"integer"}},type:"object"},results:{$ref:"#/$defs/emptyArray"}},required:["results","count"],type:"object"}]},common188:{_idObject:{additionalProperties:!1,properties:{$id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["$id"],type:"object"},dateObject:{oneOf:[{additionalProperties:!1,properties:{sec:{type:"number"},usec:{type:"number"}},required:["sec","usec"],type:"object"},{type:"integer"}]},emptyArray:{maxItems:0,minItems:0,type:"array"}},common189:{additionalProperties:!1,properties:{count:{additionalProperties:!1,minProperties:1,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{minimum:0,type:"integer"}},type:"object"},results:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{_id:{$ref:"#/$defs/_idObject"},collection:{type:"string"},created:{$ref:"#/$defs/dateObject"},links:{type:"object"},name:{type:"string"},parent:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},slug:{type:"string"},updated:{$ref:"#/$defs/dateObject"}},required:["_id","collection","name"],type:"object"}},type:"object"}},required:["results","count"],type:"object"},common190:{count:{additionalProperties:!1,minProperties:1,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{minimum:0,type:"integer"}},type:"object"},results:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{_id:{$ref:"#/$defs/_idObject"},collection:{type:"string"},created:{$ref:"#/$defs/dateObject"},links:{type:"object"},name:{type:"string"},parent:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},slug:{type:"string"},updated:{$ref:"#/$defs/dateObject"}},required:["_id","collection","name"],type:"object"}},type:"object"}},common191:{additionalProperties:!1,minProperties:1,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{minimum:0,type:"integer"}},type:"object"},common192:{"^[a-zA-Z][a-zA-Z0-9]*$":{minimum:0,type:"integer"}},common193:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{_id:{$ref:"#/$defs/_idObject"},collection:{type:"string"},created:{$ref:"#/$defs/dateObject"},links:{type:"object"},name:{type:"string"},parent:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},slug:{type:"string"},updated:{$ref:"#/$defs/dateObject"}},required:["_id","collection","name"],type:"object"}},type:"object"},common194:{"^[a-fA-F0-9]{24}$":{properties:{_id:{$ref:"#/$defs/_idObject"},collection:{type:"string"},created:{$ref:"#/$defs/dateObject"},links:{type:"object"},name:{type:"string"},parent:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},slug:{type:"string"},updated:{$ref:"#/$defs/dateObject"}},required:["_id","collection","name"],type:"object"}},common195:{properties:{_id:{$ref:"#/$defs/_idObject"},collection:{type:"string"},created:{$ref:"#/$defs/dateObject"},links:{type:"object"},name:{type:"string"},parent:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},slug:{type:"string"},updated:{$ref:"#/$defs/dateObject"}},required:["_id","collection","name"],type:"object"},common196:{_id:{$ref:"#/$defs/_idObject"},collection:{type:"string"},created:{$ref:"#/$defs/dateObject"},links:{type:"object"},name:{type:"string"},parent:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},slug:{type:"string"},updated:{$ref:"#/$defs/dateObject"}},common197:{patternProperties:{"^[a-fA-F0-9]{24}$":{properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},common198:{"^[a-fA-F0-9]{24}$":{properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},common199:{properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"},common200:{additionalProperties:!1,properties:{count:{additionalProperties:!1,minProperties:1,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{const:0,type:"integer"}},type:"object"},results:{$ref:"#/$defs/emptyArray"}},required:["results","count"],type:"object"},common201:{count:{additionalProperties:!1,minProperties:1,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{const:0,type:"integer"}},type:"object"},results:{$ref:"#/$defs/emptyArray"}},common202:{additionalProperties:!1,minProperties:1,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":{const:0,type:"integer"}},type:"object"},common203:{"^[a-zA-Z][a-zA-Z0-9]*$":{const:0,type:"integer"}},common204:{const:0,type:"integer"},common205:{$ref:"#/$defs/emptyArray"},common206:{additionalProperties:!1,properties:{results:{$ref:"#/$defs/emptyArray"}},required:["results"],type:"object"},common207:{results:{$ref:"#/$defs/emptyArray"}},common208:{default:0,minimum:0,type:"integer"},common209:{const:["projects"],default:["projects"],items:{enum:["projects"],type:"string"},type:"array"},common210:{$exists:!0},common211:{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},common212:{$exists:{const:!0}},common213:{const:!0},common214:{default:30,type:"integer"},common215:{additionalProperties:!1,allOf:[{if:{properties:{type:{const:"citoyens"}}},then:{properties:{id:{default:"@userId"}}}}],properties:{id:{pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},required:["type","id"],type:"object"},common216:{id:{pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},common217:{pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},common218:{const:["poi"],default:["poi"],items:{enum:["poi"],type:"string"},type:"array"},common219:{enum:["poi"],type:"string"},common220:{const:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],default:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],items:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},type:"array"},common221:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},common222:{$exists:!1},common223:{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},common224:{$exists:{const:!1}},common225:{const:!1},common226:{const:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],default:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],items:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},type:"array"},common227:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common228:{additionalProperties:!1,properties:{$exists:{default:!1,type:"boolean"}},required:["$exists"],type:"object"},common229:{$exists:{default:!1,type:"boolean"}},common230:{additionalProperties:!1,properties:{$in:{items:{type:"string"},minItems:1,type:"array"}},required:["$in"],type:"object"},common231:{$in:{items:{type:"string"},minItems:1,type:"array"}},common232:{items:{type:"string"},minItems:1,type:"array"},common233:{additionalProperties:!1,properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}},required:["id"],type:"object"},common234:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}},common235:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},common236:{const:["citoyens"],default:["citoyens"],items:{enum:["citoyens"],type:"string"},type:"array"},common237:{const:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],default:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],items:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},type:"array"},common238:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},common239:{not:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common240:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common241:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common242:{"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"}},common243:{not:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common244:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common245:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common246:{properties:{id:{pattern:"^@userId$"}}},common247:{id:{pattern:"^@userId$"}},common248:{pattern:"^@userId$"}},l=[{auth:"none",constant:"PERSON_REGISTER",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Enregistrement d'un utilisateur",path:"/co2/person/register",request:{additionalProperties:!1,properties:{app:d.common1,email:d.common2,isInvitation:d.common3,mode:d.common1,name:d.common1,pendingUserId:d.common1,pwd:d.common1,username:d.common1},required:["name","username","email","pwd"],type:"object"},responses:{200:{oneOf:[{additionalProperties:!1,properties:{id:d.common1,msg:d.common1,person:{properties:{_id:d.common1,email:d.common2,name:d.common1,pwd:d.common1,username:d.common1},required:["name","username","pwd","email","_id"],type:"object"},result:d.common4},required:["result","msg","id","person"],type:"object"},d.common5]}}},{auth:"none",constant:"AUTHENTICATE_URL",contentType:"application/json",method:"POST",name:"Authentification",path:"/api/cocolight/authenticate",postActions:[{path:"accessToken",type:"setToken"},{path:"refreshToken",type:"setRefreshToken"},{path:"user.id",type:"setUserId"},{event:"userLoggedIn",payloadPath:"user",type:"emitEvent"}],request:{additionalProperties:!1,properties:{email:d.common2,password:d.common1},required:["email","password"],type:"object"},responses:{200:{additionalProperties:!1,properties:{accessToken:d.common1,refreshToken:d.common1,status:d.common8,user:{additionalProperties:!1,properties:{email:d.common2,id:d.common1,lastLoginDate:d.common8,profilImageUrl:{anyOf:[d.common9,d.common10]},roles:d.common11,timezone:d.common1,username:d.common1},required:["id","username","email","roles"],type:"object"}},required:["user","accessToken","refreshToken","status"],type:"object"},401:d.common13}},{auth:"none",constant:"REFRESH_TOKEN_URL",contentType:"application/json",method:"POST",name:"Rafraîchir un token",path:"/api/cocolight/refreshtoken",request:{additionalProperties:!1,properties:{refreshToken:d.common1},required:["refreshToken"],type:"object"},responses:{200:{additionalProperties:!1,properties:{refreshToken:d.common1,token:d.common1},required:["token","refreshToken"],type:"object"},401:d.common13}},{auth:"bearer",constant:"ME_INFO_URL",contentType:"application/json",method:"POST",name:"Récupérer les informations utilisateur",path:"/api/cocolight/me",responses:{200:{$defs:d.common15,properties:{_id:d.common23,birthDate:d.common24,collection:d.common1,email:d.common2,language:d.common1,modified:d.common26,name:d.common1,preferences:d.common27,profilBannerUrl:d.common35,profilImageUrl:d.common1,profilMarkerImageUrl:d.common35,profilMediumImageUrl:d.common35,profilRealBannerUrl:d.common35,profilThumbImageUrl:d.common35,roles:d.common11,shortDescription:d.common1,slug:d.common1,tags:d.common31,username:d.common1},required:["_id","name","email","username","roles","collection","preferences","slug"],type:"object"},401:d.common13}},{auth:"none",constant:"PASSWORD_RECOVERY",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Récupération de mot de passe",path:"/co2/person/sendemail",request:{additionalProperties:!1,properties:{email:d.common2,type:{const:"password",default:"password",type:"string"}},required:["email","type"],type:"object"},responses:{200:{oneOf:[{additionalProperties:!1,properties:{errId:{const:"UNKNOWN_ACCOUNT_ID",type:"string"},msg:d.common1,result:d.common7},required:["result","errId","msg"],type:"object"},d.common36]}}},{auth:"bearer",constant:"SERVER_EXCHANGE_TOKEN",contentType:"application/json",method:"POST",name:"Échange de token avec un autre serveur",path:"/api/cocolight/exchangetoken",request:{additionalProperties:!1,properties:{serverUrl:d.common1},required:["serverUrl"],type:"object"},responses:{200:{additionalProperties:!1,properties:{accessToken:d.common1,refreshToken:d.common1,status:d.common8,user:{additionalProperties:!1,properties:{email:d.common2,id:d.common1,lastLoginDate:d.common8,profilImageUrl:d.common9,roles:d.common11,timezone:d.common1,username:d.common1},required:["id","username","email","roles"],type:"object"}},required:["user","accessToken","refreshToken","status"],type:"object"},401:d.common13}},{auth:"bearer",constant:"CHANGE_PASSWORD",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Changer le mot de passe",path:"/co2/person/changepassword",request:{additionalProperties:!1,properties:{mode:{const:"changePassword",default:"changePassword",type:"string"},newPassword:d.common1,newPassword2:d.common1,oldPassword:d.common1,scope:{default:"",type:["string"]},userId:d.common38},required:["mode","userId","oldPassword","newPassword","newPassword2"],type:"object"},responses:{200:{oneOf:[d.common36,d.common5]},401:d.common13}},{auth:"bearer",constant:"DELETE_ACCOUNT",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Supprimer un compte",path:"/co2/element/delete/id/{id}/type/citoyens",pathParams:{additionalProperties:!1,properties:d.common39,required:["id"],type:"object"},postActions:[{type:"resetSession"},{event:"accountDeleted",path:null,type:"emitEvent"}],request:{additionalProperties:!1,properties:{reason:d.common40},required:["reason"],type:"object"},responses:d.common41},{auth:"bearer",constant:"UPDATE_SETTINGS",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Mettre à jour les paramètres utilisateur",path:"/co2/element/updatesettings",request:{additionalProperties:!1,allOf:[{if:{properties:{typeEntity:d.common42}},then:{properties:{idEntity:d.common38}}},{if:{properties:{type:{enum:["birthDate","email","locality","phone","directory"]},typeEntity:d.common42}},then:{properties:{value:{enum:["private","public","mask"],type:"string"}}}},{if:{properties:{type:{enum:["activitypub","isOpenData"]},typeEntity:d.common42}},then:d.common43},{if:{properties:{type:{enum:["isOpenData","isOpenEdition","private","feedback"]},typeEntity:{not:d.common42}}},then:d.common43}],properties:{idEntity:d.common1,type:d.common1,typeEntity:{default:"citoyens",type:"string"},value:d.common30},required:["type","value","typeEntity","idEntity"],type:"object"},responses:d.common41},{auth:"bearer",constant:"UPDATE_BLOCK_DESCRIPTION",constantCocolight:"UPDATE_BLOCK",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Mettre à jour la description d'un élément",path:"/co2/element/updateblock/",request:{additionalProperties:!1,allOf:[d.common45,{anyOf:[{properties:d.common30,required:["description"]},{properties:{shortDescription:d.common49},required:["shortDescription"]}]}],properties:{block:{const:"descriptions",default:"descriptions",type:"string"},descMentions:d.common40,id:d.common1,scope:{default:"",type:["string","null"]},shortDescription:d.common1,typeElement:d.common51},required:["block","typeElement","id"],type:"object"},responses:{200:{additionalProperties:!1,properties:{result:d.common4,resultGoods:{additionalProperties:!0,properties:{msg:d.common1,result:d.common4,values:{additionalProperties:!0,properties:{shortDescription:d.common52},type:"object"}},required:["result","msg"],type:"object"}},required:["result","resultGoods"],type:"object"},401:d.common13}},{auth:"bearer",constant:"UPDATE_BLOCK_INFO",constantCocolight:"UPDATE_BLOCK",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Mettre à jour les informations d'un élément",path:"/co2/element/updateblock/",request:{$defs:{sharedFields:{email:d.common2,name:d.common1,tags:d.common53,url:d.common9}},allOf:[{if:d.common46,then:{additionalProperties:!1,anyOf:[d.common54,{properties:{birthDate:d.common49},required:["birthDate"]},{properties:{fixe:d.common49},required:["fixe"]},{properties:{mobile:d.common49},required:["mobile"]},d.common56,d.common58,d.common60],properties:{birthDate:{format:"date",type:"string"},block:d.common62,email:d.common63,fixe:d.common1,id:d.common38,mobile:d.common1,name:d.common64,scope:d.common40,tags:d.common65,typeElement:d.common51,url:d.common66}}},{if:{properties:{typeElement:d.common67}},then:{additionalProperties:!1,anyOf:[d.common54,d.common56,d.common58,d.common60,{properties:{avancement:d.common49},required:["avancement"]},{properties:{parent:d.common49},required:["parent"]}],properties:{avancement:{enum:["abandoned","concept","development","production","started","testing","idea","mature","qa","finished"],type:"string"},block:d.common62,email:d.common63,id:d.common1,name:d.common64,parent:{additionalProperties:!1,patternProperties:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:d.common68,required:["type","name"],type:"object"}},type:"object"},scope:d.common40,tags:d.common65,typeElement:d.common51,url:d.common66}}},{if:{properties:{typeElement:d.common69}},then:{additionalProperties:!1,anyOf:[d.common54,d.common56,d.common58,d.common60,{properties:{type:d.common49},required:["type"]}],properties:{block:d.common62,email:d.common63,id:d.common1,name:d.common64,scope:d.common40,tags:d.common65,type:{enum:["NGO","Cooperative","LocalBusiness","GovernmentOrganizationautre"],type:"string"},typeElement:d.common51,url:d.common66}}}],properties:{block:d.common62,id:d.common1,scope:d.common40,typeElement:d.common51},required:["block","typeElement","id"],type:"object"},responses:d.common70},{auth:"bearer",constant:"UPDATE_BLOCK_SOCIAL",constantCocolight:"UPDATE_BLOCK",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Mettre à jour les réseaux sociaux d'un élément",path:"/co2/element/updateblock/",request:{$defs:{socialField:{anyOf:[d.common10,d.common9]}},allOf:[d.common45,{anyOf:[{properties:{gitlab:d.common49},required:["gitlab"]},{properties:{github:d.common49},required:["github"]},{properties:{twitter:d.common49},required:["twitter"]},{properties:{facebook:d.common49},required:["facebook"]},{properties:{instagram:d.common49},required:["instagram"]},{properties:{diaspora:d.common49},required:["diaspora"]},{properties:{mastodon:d.common49},required:["mastodon"]},{properties:{telegram:d.common49},required:["telegram"]},{properties:{signal:d.common49},required:["signal"]}]}],properties:{block:{const:"network",default:"network",type:"string"},diaspora:d.common80,facebook:d.common80,github:d.common80,gitlab:d.common80,id:d.common1,instagram:d.common80,mastodon:d.common80,scope:d.common40,signal:d.common80,telegram:d.common80,twitter:d.common80,typeElement:d.common51},required:["block","typeElement","id"],type:"object"},responses:d.common70},{auth:"bearer",constant:"UPDATE_BLOCK_LOCALITY",constantCocolight:"UPDATE_BLOCK",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Mettre à jour les localités d'un élément",path:"/co2/element/updateblock/",request:{allOf:[d.common45],properties:{address:{additionalProperties:!1,properties:{"@type":{const:"PostalAddress",type:"string"},addressCountry:d.common1,addressLocality:d.common1,codeInsee:d.common1,level1:d.common1,level1Name:d.common1,level3:d.common81,level3Name:d.common81,level4:d.common81,level4Name:d.common81,localityId:d.common1,postalCode:d.common1,streetAddress:d.common1},required:["@type","addressCountry","codeInsee","addressLocality","localityId","level1","level1Name"],type:"object"},block:{const:"localities",default:"localities",type:"string"},geo:{additionalProperties:!1,properties:{"@type":d.common82,latitude:d.common83,longitude:d.common83},required:["latitude","longitude"],type:"object"},geoPosition:{additionalProperties:!0,properties:{coordinates:d.common84,float:d.common85,type:{const:"Point",type:"string"}},required:["type","coordinates","float"],type:"object"},id:d.common1,scope:d.common40,typeElement:d.common51},required:["block","typeElement","id","address"],type:"object"},responses:d.common70},{auth:"bearer",constant:"UPDATE_BLOCK_SLUG",constantCocolight:"UPDATE_BLOCK",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Mettre à jour le slug d'un élément",path:"/co2/element/updateblock/",request:{allOf:[d.common45],properties:{block:d.common62,id:d.common1,scope:d.common40,slug:d.common86,typeElement:d.common51},required:["block","typeElement","id","slug"],type:"object"},responses:{200:{oneOf:[{additionalProperties:!1,properties:{result:d.common4,resultGoods:{additionalProperties:!0,properties:{msg:d.common1,result:d.common4,values:{additionalProperties:!0,properties:{slug:d.common1},type:"object"}},required:["result","msg"],type:"object"}},required:["result","resultGoods"],type:"object"},d.common77]},401:d.common13}},{auth:"bearer",constant:"CHECK",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Vérifier l'état d'une URL",path:"/co2/slug/check",request:{additionalProperties:!1,allOf:[{if:d.common87,then:d.common48}],properties:{block:d.common62,id:d.common1,slug:d.common86,type:d.common51},required:["block","type","id","slug"],type:"object"},responses:{200:{oneOf:[{additionalProperties:!1,properties:{domaineName:d.common1,result:d.common4},required:["result","domaineName"],type:"object"},{additionalProperties:!1,properties:{domaineName:d.common1,result:d.common7},required:["result","domaineName"],type:"object"}]},401:d.common13}},{auth:"bearer",constant:"PROFIL_IMAGE",constantCocolight:["PROFIL_IMAGE","UPDATE_PDP"],contentType:"multipart/form-data",method:"POST",name:"Mettre à jour l'image de profil",path:"/co2/document/upload-save/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/profil_avatar/contentKey/profil/docType/image",pathParams:d.common89,request:{additionalProperties:!1,properties:{profil_avatar:d.common30},required:["profil_avatar"],type:"object"},responses:{200:{oneOf:[{additionalProperties:!1,properties:{docPath:d.common1,id:d.common97,msg:d.common1,name:d.common1,result:d.common4,resultUpload:d.common4,size:d.common8,src:{additionalProperties:!1,properties:{changes:{additionalProperties:!1,properties:{profilImageUrl:d.common35,profilMarkerImageUrl:d.common35,profilMediumImageUrl:d.common35,profilThumbImageUrl:d.common35},required:["profilImageUrl","profilMediumImageUrl","profilThumbImageUrl","profilMarkerImageUrl"],type:"object"},msg:d.common1,result:d.common4},required:["result","msg","changes"],type:"object"},success:d.common4,survey:{type:["boolean","null"]}},required:["resultUpload","success","name","docPath","size","result","msg","id","src"],type:"object"},d.common5]},401:d.common13}},{auth:"none",constant:"GET_ELEMENTS_ABOUT",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Obtenir les éléments liés",path:"/co2/element/about/type/{type}/id/{id}/json/true",pathParams:{additionalProperties:!1,allOf:[d.common99],properties:{id:d.common1,type:d.common51},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{tpl:{const:"ficheInfoElement",default:"ficheInfoElement",type:"string"}},required:["tpl"],type:"object"},responses:{200:{$defs:d.common15,oneOf:[{properties:{_id:d.common23,birthDate:d.common24,collection:d.common102,created:d.common26,email:d.common2,language:d.common1,modified:d.common26,name:d.common1,preferences:d.common27,profilBannerUrl:d.common103,profilImageUrl:d.common103,profilMarkerImageUrl:d.common103,profilMediumImageUrl:d.common103,profilRealBannerUrl:d.common103,profilThumbImageUrl:d.common103,roles:d.common11,shortDescription:d.common1,slug:d.common1,tags:d.common31,username:d.common1},required:["_id","name","username","roles","collection","preferences","slug"],type:"object"},{properties:{_id:d.common23,collection:d.common104,created:d.common26,creator:d.common1,links:d.common105,modified:d.common26,name:d.common1,parent:{additionalProperties:!1,patternProperties:{"^[0-9a-fA-F]{24}$":{additionalProperties:!0,properties:{_id:d.common23,name:d.common1,profilThumbImageUrl:d.common1,slug:d.common1,type:d.common1},required:["type","name"],type:"object"}},type:"object"},preferences:{properties:{crowdfunding:d.common106,isOpenData:d.common106,isOpenEdition:d.common106,private:d.common106},required:["isOpenData","isOpenEdition"],type:"object"},profilImageUrl:d.common103,profilMarkerImageUrl:d.common103,profilMediumImageUrl:d.common103,profilThumbImageUrl:d.common103,slug:d.common1,type:d.common1,typeSig:d.common1,updated:d.common26},required:["_id","collection","created","creator","modified","name","parent","preferences","slug","typeSig","type","updated"],type:"object"},{properties:{_id:d.common23,collection:{enum:["organizations"],type:"string"},created:d.common26,creator:d.common1,links:d.common105,modified:d.common26,name:d.common1,preferences:{properties:{isOpenData:d.common106,isOpenEdition:d.common106},required:["isOpenData","isOpenEdition"],type:"object"},profilImageUrl:d.common103,profilMarkerImageUrl:d.common103,profilMediumImageUrl:d.common103,profilThumbImageUrl:d.common103,slug:d.common1,type:d.common1,updated:d.common26},required:["_id","collection","modified","name","preferences","slug","type","updated"],type:"object"}]},401:d.common13}},{auth:"bearer",constant:"MULTICONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Gérer des connexions multiples",path:"/co2/link/multiconnect",request:{additionalProperties:!1,allOf:[d.common108],properties:{listInvite:{additionalProperties:!1,patternProperties:{"^(citoyens|projects|organizations)$":{additionalProperties:!1,patternProperties:{"^[0-9a-fA-F]{24}$":{additionalProperties:!1,properties:{name:d.common1},required:["name"],type:"object"}},type:"object"}},type:"object"},parentId:d.common1,parentType:d.common51},required:["parentId","parentType","listInvite"],type:"object"},responses:{200:{$defs:d.common113,oneOf:[{additionalProperties:!1,properties:{citoyens:{items:{oneOf:[{properties:{msg:d.common1,newElement:{additionalProperties:!0,properties:{_id:d.common23,id:d.common1,isInviting:d.common3,name:d.common1,profilThumbImageUrl:d.common1},required:["_id","name","profilThumbImageUrl","id","isInviting"],type:"object"},newElementType:{const:"citoyens",type:"string"},result:d.common4},required:["result","msg","newElement","newElementType"],type:"object"},d.common5]},type:"array"}},required:["citoyens"],type:"object"}]},401:d.common13}},{auth:"none",constant:"GET_NEWS",constantCocolight:"GET_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Récupérer les actualités",path:"/news/co/get/type/{type}/id/{id}/isLive/{isLive}/json/{json}",pathParams:{additionalProperties:!1,allOf:[d.common99],properties:{id:d.common1,isLive:d.common114,json:d.common114,type:d.common51},required:["isLive","type","id","json"],type:"object"},request:{additionalProperties:!1,properties:{dateLimit:{default:0,type:"integer"},indexStep:{default:12,type:"integer"},search:{additionalProperties:!1,properties:{name:d.common40},required:["name"],type:"object"}},required:["dateLimit","indexStep"],type:"object"},responses:{200:{$defs:d.common115,oneOf:[{properties:{endStream:d.common4,limitDate:d.common7,news:d.common138,type:d.common139},required:["type","endStream","news","limitDate"],type:"object"},{properties:{endStream:d.common3,limitDate:d.common105,news:{additionalProperties:!1,patternProperties:{"^[a-f0-9]{24}$":d.common140},type:"object"},type:d.common139},required:["type","endStream","news","limitDate"],type:"object"}]},401:d.common13}},{auth:"none",constant:"GET_NEWS_BY_ID",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Récupérer des actualités par IDs",path:"/news/co/getbyids",request:{additionalProperties:!1,properties:{ids:d.common31},required:["ids"],type:"object"},responses:{200:{$defs:d.common115,items:d.common140,type:"array"}}},{auth:"bearer",constant:"ADD_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Ajouter une actualité",path:"/news/co/save",request:{additionalProperties:!1,allOf:[d.common108],anyOf:[d.common141,d.common142,d.common143],properties:{json:d.common85,markdownActive:d.common114,mediaFile:d.common144,mediaImg:d.common146,mentions:d.common148,parentId:d.common1,parentType:d.common51,scope:d.common152,tags:d.common53,text:d.common1,type:d.common153},required:["scope","markdownActive","parentId","parentType","type","json"],type:"object"},responses:{200:{$defs:d.common154,oneOf:[{additionalProperties:!1,properties:{id:d.common97,msg:d.common1,object:d.common140,result:d.common4},required:["result","msg","id","object"],type:"object"},d.common5]},401:d.common13}},{auth:"bearer",constant:"ADD_IMAGE_NEWS",constantCocolight:"ADD_IMAGE_NEWS",contentType:"multipart/form-data",method:"POST",name:"Ajouter une image à une actualité",path:"/co2/document/uploadSave/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/newsImage/docType/image/contentKey/slider",pathParams:d.common89,request:{additionalProperties:!1,properties:{newsImage:d.common30},required:["newsImage"],type:"object"},responses:d.common156},{auth:"bearer",constant:"ADD_FILE_NEWS",constantCocolight:"ADD_FILE_NEWS",contentType:"multipart/form-data",method:"POST",name:"Ajouter un fichier à une actualité",path:"/co2/document/uploadSave/dir/communecter/folder/{folder}/ownerId/{ownerId}}/input/newsFile/docType/file",pathParams:d.common89,request:{additionalProperties:!1,properties:{newsFile:d.common30},required:["newsFile"],type:"object"},responses:d.common156},{auth:"bearer",constant:"DELETE_NEWS",constantCocolight:"DELETE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Supprimer une actualité",path:"/news/co/delete/id/{id}",pathParams:d.common160,request:{additionalProperties:!1,properties:{isLive:d.common162},required:["isLive"],type:"object"},responses:{200:{oneOf:[{additionalProperties:!1,properties:{commentsDeleted:d.common22,msg:d.common1,result:d.common4,type:d.common119},required:["result","msg","type","commentsDeleted"],type:"object"},d.common163]},401:d.common13}},{auth:"bearer",constant:"UPDATE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Mettre à jour une actualité",path:"/news/co/update",request:{additionalProperties:!1,allOf:[d.common108],anyOf:[d.common141,d.common142,d.common143],properties:{idNews:d.common1,markdownActive:d.common114,mediaFile:d.common144,mediaImg:d.common146,mentions:d.common148,parentId:d.common1,parentType:d.common51,scope:d.common152,tags:d.common53,text:d.common1,type:d.common153},required:["idNews","scope","markdownActive","parentId","parentType","type"],type:"object"},responses:{200:{$defs:d.common154,oneOf:[{additionalProperties:!1,properties:{msg:d.common1,object:d.common140,result:d.common4},required:["result","msg","object"],type:"object"},d.common5]},401:d.common13}},{auth:"bearer",constant:"SHARE_NEWS",constantCocolight:"SHARE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Partager une actualité",path:"/news/co/share",request:{additionalProperties:!1,allOf:[{if:{properties:{childType:d.common42}},then:{properties:{childId:d.common38}}}],properties:{childId:d.common1,childType:d.common51,comment:d.common1,connectType:{const:"share",default:"share",type:"string"},parentId:d.common1,parentType:d.common153},required:["parentId","parentType","childId","childType","connectType"],type:"object"},responses:{200:{$defs:{_idObject:d.common16,dateObject:d.common19,sharedUser:d.common131,user:d.common155},oneOf:[{additionalProperties:!1,properties:{data:{properties:{_id:d.common23,author:d.common118,collection:d.common119,comment:d.common52,created:d.common26,icon:d.common1,imageBackground:d.common52,lastAuthorShare:d.common120,name:d.common52,object:{properties:{_id:d.common23,author:d.common118,authorId:d.common1,authorName:d.common1,collection:d.common119,comment:d.common52,created:d.common26,date:d.common26,id:d.common1,lastAuthorShare:d.common120,markdownActive:d.common3,scope:d.common164,sharedBy:d.common126,target:d.common118,text:d.common1,type:d.common119,typeSig:d.common1,updated:d.common26},required:["id","type","authorName","authorId","_id","text","author","date","collection","sharedBy","target","created","markdownActive","scope","updated","typeSig","lastAuthorShare"],type:"object"},scope:d.common164,sharedBy:d.common126,target:d.common118,type:{const:"activityStream",type:"string"},typeSig:d.common1,updated:d.common26,verb:{const:"share",type:"string"}},required:["_id","type","verb","target","author","object","scope","created","sharedBy","collection","icon","updated","typeSig","lastAuthorShare"],type:"object"},idNews:d.common1,msg:d.common1,result:d.common4},required:["result","msg","data","idNews"],type:"object"},d.common163]},401:d.common13}},{auth:"none",constant:"GET_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Récupérer les commentaires",path:"/co2/comment/index/type/{type}/id/{id}/json/true",pathParams:d.common165,responses:{200:{$defs:{_idObject:d.common16,author:{properties:{address:d.common105,email:d.common2,id:d.common1,name:d.common1,preferences:d.common168,profilImageUrl:d.common35,profilMarkerImageUrl:d.common35,profilThumbImageUrl:d.common35,tags:d.common170,typeSig:d.common1,username:d.common1},required:["id","name","typeSig"],type:"object"},comment:{properties:{_id:d.common23,argval:d.common1,author:d.common171,collection:d.common172,contextId:d.common1,contextType:d.common1,created:d.common26,parentId:d.common1,postedDate:d.common26,replies:{anyOf:[d.common173,{maxItems:0,type:"array"}]},status:d.common1,tags:d.common170,text:d.common1,views:d.common176},required:["_id","contextId","contextType","parentId","text","created","author","collection","status","views","postedDate","argval","replies"],type:"object"},dateObject:d.common19,views:d.common177},oneOf:[d.common138,d.common173]}}},{auth:"bearer",constant:"ADD_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Ajouter un commentaire",path:"/co2/comment/save",request:{additionalProperties:!1,properties:{argval:d.common40,contextId:d.common1,contextType:d.common167,mentions:d.common181,parentCommentId:d.common40,path:d.common40,text:d.common1},required:["text","contextId","contextType"],type:"object"},responses:{200:{$defs:{_idObject:d.common16,author:{properties:{address:d.common105,email:d.common2,id:d.common1,name:d.common1,preferences:d.common168,profilImageUrl:d.common1,profilMarkerImageUrl:d.common1,profilThumbImageUrl:d.common1,tags:d.common170,typeSig:d.common1,username:d.common1},required:["id","name"],type:"object"},comment:{properties:{_id:d.common23,argval:d.common1,author:d.common171,collection:d.common172,contextId:d.common1,contextType:d.common1,created:d.common26,parentId:d.common52,postedDate:d.common26,status:d.common1,tags:d.common170,text:d.common1,views:d.common176},required:["_id","contextId","contextType","parentId","text","created","author","collection","status","views","postedDate","argval"],type:"object"},dateObject:d.common19,views:d.common177},oneOf:[{additionalProperties:!1,properties:{id:d.common23,msg:d.common1,newComment:d.common175,result:d.common4,time:d.common8},required:["result","msg","id","newComment","time"],type:"object"},d.common163]},401:d.common13}},{auth:"bearer",constant:"DELETE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Supprimer un commentaire",path:"/co2/comment/delete/id/{id}",pathParams:d.common160,responses:{200:{$defs:d.common113,oneOf:[{additionalProperties:!1,properties:{elt:{properties:{_id:d.common23,contextId:d.common1,contextType:d.common1,parentId:d.common52},type:"object"},msg:d.common1,result:d.common4},required:["result","msg","elt"],type:"object"},d.common163]},401:d.common13}},{auth:"bearer",constant:"UPDATE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Mettre à jour un commentaire",path:"/co2/comment/update",request:{additionalProperties:!1,properties:{id:d.common1,params:{properties:{mentions:d.common181,text:d.common1},required:["text"],type:"object"}},required:["id","params"],type:"object"},responses:{200:{oneOf:[{additionalProperties:!1,properties:{comment:{additionalProperties:!1,properties:{err:d.common52,errmsg:d.common52,n:d.common22,nModified:d.common22,ok:d.common22,updatedExisting:d.common3},required:["ok","nModified","n","err","errmsg","updatedExisting"],type:"object"},msg:d.common1,result:d.common4},required:["result","msg","comment"],type:"object"},d.common163]},401:d.common13}},{auth:"none",constant:"SEARCH_TAGS",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Rechercher des tags",path:"/api/tags/search?q={q}",pathParams:{additionalProperties:!1,properties:{q:d.common1},required:["q"],type:"object"},responses:{200:{$defs:d.common113,oneOf:[{items:{additionalProperties:!1,properties:{tag:d.common1},required:["tag"],type:"object"},maxItems:1,minItems:1,type:"array"},{items:{additionalProperties:!1,properties:{_id:d.common23,field_length:d.common182,tag:d.common1},required:["_id","tag","field_length"],type:"object"},minItems:1,type:"array"}]},401:d.common13}},{auth:"none",constant:"SHOW_VOTE",contentType:"application/x-www-form-urlencoded",method:"POST",name:"Afficher les votes d'une actualité",path:"/co2/action/list/type/{type}/id/{id}/actionType/vote/json/true",pathParams:d.common165,responses:{200:{$defs:d.common15,oneOf:[{properties:{_id:d.common23,vote:{additionalProperties:!1,patternProperties:{"^[a-f0-9]{24}$":{properties:{_id:d.common23,date:d.common26,name:d.common1,profilThumbImageUrl:d.common1,slug:d.common1,status:{enum:["love","bothered","scared","like","enjoy","sad","support","glad"],type:"string"}},required:["status","date","_id","name","slug"],type:"object"}},type:"object"},voteCount:{additionalProperties:!1,properties:{bothered:d.common182,enjoy:d.common182,glad:d.common182,like:d.common182,love:d.common182,sad:d.common182,scared:d.common182,support:d.common182},type:"object"}},required:["_id","vote","voteCount"],type:"object"},{additionalProperties:!1,properties:{_id:d.common23},required:["_id"],type:"object"}]},401:d.common13}},{auth:"none",constant:"GLOBAL_AUTOCOMPLETE",constantCocolight:"GLOBALAUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",functionCocolight:"globalautocomplete",method:"POST",name:"Recherche globale avec autocomplétion",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:d.common85,countType:{const:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],default:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],items:d.common183,type:"array"},fediverse:d.common184,filters:d.common185,indexMin:{const:0,default:0,type:"number"},indexStep:d.common22,initType:d.common185,locality:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:d.common1,type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},type:"object"},name:d.common1,notSourceKey:d.common85,ranges:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{indexMax:d.common22,indexMin:d.common22},required:["indexMin","indexMax"],type:"object"}},type:"object"},searchTags:d.common31,searchType:{items:d.common183,type:"array"}},required:["name","searchType","countType","indexMin","indexStep","initType","count","notSourceKey","filters","fediverse"],type:"object"},responses:d.common186},{auth:"none",constant:"CITY_AUTOCOMPLETE",constantCocolight:"GLOBALAUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",functionCocolight:"globalAutocompleteCities",method:"POST",name:"Recherche de villes avec autocomplétion",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{indexMax:{minimum:5,type:"integer"},indexMin:d.common182,locality:d.common185,name:d.common1,searchBy:{const:"ALL",default:"ALL",type:"string"},searchType:{const:["cities"],default:["cities"],items:{enum:["cities"],type:"string"},type:"array"}},required:["name","locality","searchType"],type:"object"},responses:{200:{$defs:{_idObject:d.common16,emptyArray:d.common138,geoObject:{properties:{"@type":d.common1,latitude:d.common1,longitude:d.common1},required:["latitude","longitude"],type:"object"},geoPositionObject:{properties:{coordinates:d.common84,float:{type:["string","boolean"]},type:d.common1},required:["type","coordinates"],type:"object"}},oneOf:[{additionalProperties:!1,properties:{results:{items:{additionalProperties:!0,properties:{_id:d.common23,allCP:d.common3,alternateName:d.common1,country:d.common1,countryCode:d.common1,geo:{$ref:"#/$defs/geoObject"},insee:d.common1,level:d.common31,level1:d.common1,level1Name:d.common1,level3:d.common1,level3Name:d.common1,level4:d.common1,level4Name:d.common1,name:d.common1,postalCode:d.common1,postalCodes:{items:{properties:{geoPosition:{$ref:"#/$defs/geoPositionObject"},postalCode:d.common1},required:["postalCode","geoPosition"],type:"object"},type:"array"},type:d.common1,uniqueCp:d.common3},required:["_id","type"],type:"object"},type:"array"}},required:["results"],type:"object"},d.common206]},401:d.common13}},{auth:"none",constant:"SUGGESTION_INPUT",constantCocolight:"GLOBALAUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",functionCocolight:"suggestionInput",method:"POST",name:"Suggestions d'entrée",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{indexMax:{default:20,minimum:20,type:"integer"},indexMin:d.common208,name:d.common1,searchType:{items:{enum:["organizations","projects","poi"],type:"string"},type:"array"}},required:["name","searchType","indexMin","indexMax"],type:"object"},responses:{200:{$defs:d.common188,oneOf:[{additionalProperties:!1,properties:{results:d.common193},required:["results"],type:"object"},d.common206]},401:d.common13}},{auth:"none",constant:"GET_PROJECTS_NO_ADMIN",constantCocolight:"GLOBALAUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",functionCocolight:"getProjectsNoAdmin",method:"POST",name:"Récupérer les projets non administrables",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common209,fediverse:d.common184,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@userId":d.common210,"parent.@userId":d.common210},"links.contributors.@userId":d.common210},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":d.common211},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":d.common211,"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":d.common211},type:"object"}},required:["$or"],type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common209},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186},{auth:"bearer",constant:"GET_PROJECTS_ADMIN",constantCocolight:"GLOBAL_AUTOCOMPLETE_ADMIN",contentType:"application/x-www-form-urlencoded",functionCocolight:"getProjectsAdmin",method:"POST",name:"Récupérer les projets administrables",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:d.common215,request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common209,fediverse:d.common184,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@{pathParams.id}":d.common210,"parent.@{pathParams.id}":d.common210},"links.contributors.@{pathParams.id}":d.common210},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":d.common211},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":d.common211,"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":d.common211},type:"object"}},required:["$or"],type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common209},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186},{auth:"none",constant:"GET_POIS_NO_ADMIN",constantCocolight:"GLOBALAUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",functionCocolight:"getPoisNoAdmin",method:"POST",name:"Récupérer les POIs non administrables",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common218,fediverse:d.common184,filters:{additionalProperties:!1,default:{"parent.@userId":d.common210},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":d.common211},type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common218},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186},{auth:"bearer",constant:"GET_POIS_ADMIN",constantCocolight:"GLOBAL_AUTOCOMPLETE_ADMIN",contentType:"application/x-www-form-urlencoded",functionCocolight:"getPoisAdmin",method:"POST",name:"Récupérer les POIs administrables",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:d.common215,request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common218,fediverse:d.common184,filters:{additionalProperties:!1,default:{"parent.@{pathParams.id}":d.common210},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":d.common211},type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common218},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186},{auth:"none",constant:"GET_ORGANIZATIONS_NO_ADMIN",constantCocolight:"GLOBALAUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",functionCocolight:"getOrganizationsNoAdmin",method:"POST",name:"Récupérer les organisations non administrables",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common220,fediverse:d.common184,filters:{additionalProperties:!1,default:{"links.members.@userId":d.common210,"links.members.@userId.isInviting":d.common222,"links.members.@userId.toBeValidated":d.common222},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)$":d.common211,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":d.common223,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":d.common223},type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common220},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186},{auth:"bearer",constant:"GET_ORGANIZATIONS_ADMIN",constantCocolight:"GLOBAL_AUTOCOMPLETE_ADMIN",contentType:"application/x-www-form-urlencoded",functionCocolight:"getOrganizationsAdmin",method:"POST",name:"Récupérer les organisations administrables",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:{additionalProperties:!1,allOf:[d.common99],properties:{id:d.common217,type:{default:"citoyens",enum:["citoyens","organizations"],type:"string"}},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common220,fediverse:d.common184,filters:{additionalProperties:!1,default:{"links.members.@{pathParams.id}":d.common210,"links.members.@{pathParams.id}.isInviting":d.common222,"links.members.@{pathParams.id}.toBeValidated":d.common222},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":d.common211,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":d.common223,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":d.common223},type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common220},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186},{auth:"none",constant:"GET_MEMBERS_NO_ADMIN",constantCocolight:"GLOBALAUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",functionCocolight:"getMembersNoAdmin",method:"POST",name:"Récupérer les membres non administrables",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common226,fediverse:d.common184,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)$)"}}},{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$)"}}}],patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)$":d.common211,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":d.common211,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":d.common228,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":d.common230,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":d.common223},type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common226},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186},{auth:"bearer",constant:"GET_MEMBERS_ADMIN",constantCocolight:"GLOBAL_AUTOCOMPLETE_ADMIN",contentType:"application/x-www-form-urlencoded",functionCocolight:"getMembersAdmin",method:"POST",name:"Récupérer les membres administrables",path:"/co2/search/globalautocompleteadmin/type/organizations/id/{id}/canSee/true",pathParams:{additionalProperties:!1,properties:{id:d.common18},required:["id"],type:"object"},request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common226,fediverse:d.common184,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.memberOf.@{pathParams.id}":d.common210,"links.memberOf.@{pathParams.id}.isInviting":d.common222,"links.memberOf.@{pathParams.id}.toBeValidated":d.common222},patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":d.common211,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":d.common211,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":d.common228,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":d.common230,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":d.common228},type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common226},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186},{auth:"bearer",constant:"GET_FRIENDS_ADMIN",constantCocolight:"GLOBAL_AUTOCOMPLETE_ADMIN",contentType:"application/x-www-form-urlencoded",functionCocolight:"getMembersAdmin",method:"POST",name:"Récupérer les amis administrables",path:"/co2/search/globalautocompleteadmin/type/citoyens/id/{id}/canSee/true",pathParams:d.common233,request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common236,fediverse:d.common184,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.friends.@{pathParams.id}":d.common210,"links.friends.@{pathParams.id}.isInviting":d.common222,"links.friends.@{pathParams.id}.toBeValidated":d.common222},patternProperties:{"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":d.common211,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":d.common228,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":d.common228},type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common236},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186},{auth:"none",constant:"GET_SUBSCRIPTIONS",constantCocolight:"GLOBAL_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",functionCocolight:"getFollowersNoAdmin",method:"POST",name:"Récupérer les suivis non administrables",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common237,fediverse:d.common184,filters:{additionalProperties:!1,allOf:[d.common239],default:{"links.followers.@userId":d.common210,"links.followers.@{userId}.isInviting":d.common222,"links.followers.@{userId}.toBeValidated":d.common222},patternProperties:d.common242,type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common237},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186},{auth:"bearer",constant:"GET_SUBSCRIPTIONS_ADMIN",constantCocolight:"GLOBAL_AUTOCOMPLETE_ADMIN",contentType:"application/x-www-form-urlencoded",functionCocolight:"getFollowersAdmin",method:"POST",name:"Récupérer les suivis administrables",path:"/co2/search/globalautocompleteadmin/type/citoyens/id/{id}/canSee/true",pathParams:d.common233,request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common237,fediverse:d.common184,filters:{additionalProperties:!1,allOf:[d.common239],default:{"links.followers.@{pathParams.id}":d.common210,"links.followers.@{pathParams.id}.isInviting":d.common222,"links.followers.@{pathParams.id}.toBeValidated":d.common222},patternProperties:d.common242,type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common237},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186},{auth:"none",constant:"GET_SUBSCRIBERS",constantCocolight:"GLOBAL_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",functionCocolight:"getFollowsNoAdmin",method:"POST",name:"Récupérer les abonnés non administrables",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common236,fediverse:d.common184,filters:{additionalProperties:!1,allOf:[d.common243],default:{"links.follows.@userId":d.common210,"links.follows.@{userId}.isInviting":d.common222,"links.follows.@{userId}.toBeValidated":d.common222},patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":d.common211,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":d.common223,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":d.common223},type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common236},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186},{auth:"bearer",constant:"GET_SUBSCRIBERS_ADMIN",constantCocolight:"GLOBAL_AUTOCOMPLETE_ADMIN",contentType:"application/x-www-form-urlencoded",functionCocolight:"getFollowsAdmin",method:"POST",name:"Récupérer les abonnés administrables",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:{additionalProperties:!1,allOf:[d.common99,{if:{properties:{type:d.common69}},then:d.common246},{if:{properties:{type:d.common67}},then:d.common246}],properties:{id:d.common217,type:{default:"citoyens",enum:["citoyens","organizations","projects"],type:"string"}},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{count:d.common85,countType:d.common236,fediverse:d.common184,filters:{additionalProperties:!1,allOf:[d.common243],default:{"links.follows.@{pathParams.id}":d.common210},maxProperties:1,minProperties:1,patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":d.common211},type:"object"},indexMin:d.common208,indexStep:d.common214,initType:d.common185,locality:d.common185,name:d.common1,notSourceKey:d.common85,searchType:d.common236},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"},responses:d.common186}];class u extends Error{constructor(e,t,o){super(e),this.name="ApiClientError",this.status=t,this.details=o}}class y extends Error{constructor(e){super(e),this.name="CircuitBreakerError"}}a.addType("oid",(e=>new c.ObjectID(e)));class f extends o.EventEmitter{constructor({baseURL:e,accessToken:t,refreshToken:o,refreshUrl:a="/api/cocolight/refreshtoken",endpoints:p=l,timeout:c=3e4,debug:d=!1,maxRetries:y=0,circuitBreakerThreshold:f=5,circuitBreakerResetTime:g=6e4,fromJSONValue:b=!0}={}){if(super(),!e)throw new u('Le paramètre "baseURL" est obligatoire.',500);this._baseURL=e,this._refreshToken=o,this._refreshUrl=a,this._endpoints=p,this._debug=d;let h=null;this._fromJSONValue=b,Object.defineProperty(this,"userId",{get:()=>h,set:()=>{throw new Error("Modification directe de userId non autorisée.")},enumerable:!0}),this._setUserId=e=>{h=e,this._logger.debug(`[ApiClient] userId set: ${e}`)},this._ajv=new r({strict:!1,useDefaults:!0}),n(this._ajv),this._logger=m({transport:{target:"pino-pretty",options:{colorize:!0}},level:d?"debug":"info"}),this._client=i.create({baseURL:e,timeout:c}),y>0&&(s(this._client,{retries:y,retryDelay:s.exponentialDelay,retryCondition:e=>s.isNetworkError(e)||s.isRetryableError(e)}),this._logger.info(`[ApiClient] Retry activé : ${y} max`)),this._breakerThreshold=f,this._breakerResetTime=g,this._breakerErrorCount=0,this._breakerOpen=!1,this._lastBreakerOpenTime=null,t&&this.setToken(t),this._client.interceptors.response.use((e=>e),(async e=>{if(e.response&&401===e.response.status&&this._refreshToken)try{if(await this._refreshAccessToken())return this._client.request(e.config)}catch(e){throw new u(e.message,401,e)}throw e}))}setToken(e){this._accessToken=e,this._client.defaults.headers.common.Authorization="Bearer "+e,this._logger.debug(`[ApiClient] setToken: ${e}`)}getToken(){return this._accessToken}setRefreshToken(e){this._refreshToken=e,this._logger.debug(`[ApiClient] setRefreshToken: ${e}`)}getRefreshToken(){return this._refreshToken}async _refreshAccessToken(){if(!this._refreshToken)return!1;try{const e=await this._client.post(this._refreshUrl,{refreshToken:this._refreshToken},{headers:{"Content-Type":"application/json"}});return!(!e.data||!e.data.accessToken||(this.setToken(e.data.accessToken),e.data.refreshToken&&this.setRefreshToken(e.data.refreshToken),this.emit("refreshSuccess",e.data),0))}catch(e){return this._logger.error(`[ApiClient] Refresh Error : ${e.message}`),!1}}_checkCircuitBreaker(){return!this._breakerOpen||Date.now()-this._lastBreakerOpenTime>this._breakerResetTime&&(this._breakerOpen=!1,this._breakerErrorCount=0,this._logger.warn("[ApiClient] Circuit breaker réinitialisé"),!0)}_updateCircuitBreakerError(){this._breakerErrorCount+=1,this._logger.warn(`[ApiClient] Erreur #${this._breakerErrorCount} sur ${this._breakerThreshold}`),this._breakerErrorCount>=this._breakerThreshold&&(this._breakerOpen=!0,this._lastBreakerOpenTime=Date.now(),this._logger.error("[ApiClient] Circuit breaker ACTIVÉ - L'API est considérée indisponible"))}_resetCircuitBreakerSuccess(){this._breakerErrorCount=0,this._breakerOpen&&(this._breakerOpen=!1,this._logger.warn("[ApiClient] Circuit breaker refermé suite à un succès"))}static stripNullsInPlace(e){if(e&&"object"==typeof e&&e.value&&"function"==typeof e.value.pipe)return e;if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)null===e[t]||void 0===e[t]?e.splice(t,1):"object"==typeof e[t]&&f.stripNullsInPlace(e[t]);else if(e&&"object"==typeof e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(null===e[t]||void 0===e[t]?delete e[t]:"object"==typeof e[t]&&f.stripNullsInPlace(e[t]));return e}_resolveSpecialValuesInPlace(e,t={}){const o={userId:()=>this.userId,accessToken:()=>this._accessToken,refreshToken:()=>this._refreshToken,baseURL:()=>this._baseURL,pathParams:e=>{const o=this._getValueByPath(t,e);return null!=o?o:void 0}},r=/@(?:\{([^}]+)\}|([\w.]+))/g,n=e=>"string"!=typeof e?e:e.replace(r,((t,r,n)=>{if(r){if(r.startsWith("pathParams.")){const e=r.substring(11),t=o.pathParams(e);return null!=t?t:`@{${r}}`}{const e=o[r];if("function"==typeof e){const t=e();return null!=t?t:`@{${r}}`}return`@{${r}}`}}if(n){if(n.startsWith("pathParams.")){const e=n.match(/^pathParams\.([^.]+)(.*)$/);if(e){const t=e[1],r=e[2],i=o.pathParams(t);return null!=i?i+r:`@${n}`}return`@${n}`}{const e=o[n];if("function"==typeof e){const t=e();return null!=t?t:`@${n}`}return`@${n}`}}return e})),i=e=>{if((e=>e&&"object"==typeof e&&("function"==typeof e.pipe||"undefined"!=typeof Buffer&&e instanceof Buffer))(e))return e;if(Array.isArray(e))return e.map(i);if((e=>"[object Object]"===Object.prototype.toString.call(e))(e)){const t={};for(const[o,r]of Object.entries(e))t[n(o)]=i(r);return t}return"string"==typeof e?n(e):e};return i(e)}_cleanSchemaLeftoverAlias(e){const t=/@\w+/;if(Array.isArray(e))return e.map((e=>this._cleanSchemaLeftoverAlias(e)));if(e&&"object"==typeof e){const o={};for(const r of Object.keys(e)){const n=e[r];if(!t.test(r)){if("default"===r){if("string"==typeof n&&t.test(n))continue;if(n&&"object"==typeof n){const e=this._cleanSchemaLeftoverAlias(n);Object.keys(e).length>0&&(o[r]=e);continue}}"string"==typeof n&&t.test(n)||(o[r]=this._cleanSchemaLeftoverAlias(n))}}return o}return e}async callEndpoint(e,t={},o=!0,r=!0){if(!this._checkCircuitBreaker())throw new y("Le circuit breaker est activé, impossible d'appeler l'API");const n=this._endpoints.find((t=>t.constant===e));if(!n)throw new u(`Endpoint introuvable : ${e}`,404);const{path:i,method:s,contentType:a,auth:m,pathParams:p,request:c,responses:d}=n,l=(s||"GET").toLowerCase(),g=a||"application/json",b={"Content-Type":g};if(this._accessToken)"bearer"===m?b.Authorization=`Bearer ${this._accessToken}`:m&&"none"!==m||b.Authorization||(b.Authorization=`Bearer ${this._accessToken}`);else if("bearer"===m)throw new u(`Token requis pour l'endpoint sécurisé : ${e}`,401);let h,j=i,P={};if(p){let e=p;"none"===m&&null===this.userId&&(e=this._cleanSchemaLeftoverAlias(p));const o=t.pathParams||{},r=this._ajv.compile(e);if(!r(o))throw this.emit("validationError",{stage:"pathParams",errors:r.errors}),new u("Path parameter validation failed.",400,r.errors);P=this._resolveSpecialValuesInPlace(o),j=j.replace(/\{(\w+)\}/g,((e,t)=>{const o=P[t];if(void 0!==o)return encodeURIComponent(o);throw new u(`Path param manquant ou non résolu : {${t}}`,400)}))}if(c){let e=c;"none"===m&&null===this.userId&&(e=this._cleanSchemaLeftoverAlias(c));const o={...t};delete o.pathParams;const r=f.stripNullsInPlace(o),n=this._ajv.compile(e);if(!n(r))throw this.emit("validationError",{stage:"request",errors:n.errors}),new u("Request validation failed.",400,n.errors);t=this._resolveSpecialValuesInPlace(r,P)}"application/json"===g||"multipart/form-data"===g?h=t:"application/x-www-form-urlencoded"===g&&(h=f.toURLSearchParams(t)),this._logger.debug(`[ApiClient] callEndpoint: ${e} -> ${j}, method=${l}`);try{const e=await this._client.request({url:j,method:l,headers:b,["get"===l?"params":"data"]:h});if(r){const t=e.status.toString(),o=d?.[t];if(o){const r=this._ajv.compile(o);if(!r(e.data))throw this.emit("validationError",{stage:"response",errors:r.errors}),new u("Response validation failed.",t,r.errors)}}return this._resetCircuitBreakerSuccess(),"function"==typeof o?e.data=o(e.data):!0===o&&(e.data=this._transformData(e.data)),Array.isArray(n.postActions)&&n.postActions.forEach((t=>{const o=t.path?this._getValueByPath(e.data,t.path):null;switch(t.type){case"setToken":this.setToken(o);break;case"setRefreshToken":this.setRefreshToken(o);break;case"setUserId":this._setUserId(o);break;case"resetSession":this.resetSession();break;case"emitEvent":t.event&&(this.emit(t.event,o),this._logger.debug(`[ApiClient] Event émis : ${t.event}`,o));break;case"callMethod":"function"==typeof this[t.method]?(this[t.method](),this._logger.debug(`[ApiClient] Méthode appelée : ${t.method}`)):this._logger.warn(`[ApiClient] Méthode inconnue : ${t.method}`);break;default:this._logger.warn(`[ApiClient] Action inconnue : ${t.type}`)}})),e}catch(e){throw this._updateCircuitBreakerError(),e}}resetSession(){this.setToken(null),this.setRefreshToken(null),this._setUserId(null),delete this._client.defaults.headers.common.Authorization,this._logger.info("[ApiClient] Session utilisateur réinitialisée."),this.emit("sessionReset")}_getValueByPath(e,t){if(t)return t.split(".").reduce(((e,t)=>e&&e[t]),e)}static toURLSearchParams(e,t={}){return this._buildParams(e,new URLSearchParams,t)}static _buildParams(e,t,o={}){if("object"!=typeof e||null===e)throw new TypeError("La donnée doit être un objet non nul.");const{dots:r=!1,indexes:n=!1,metaTokens:i=!0}=o,s=[];function a(e){return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)}function m(e){return e.endsWith("[]")?e.slice(0,-2):e}function p(e,t,o=!1){return e?e.concat(t).map(((e,t)=>(e=m(e),!o&&t?`[${e}]`:e))).join(o?".":""):t}function c(e){return null==e?"":e instanceof Date?e.toISOString():(e instanceof Blob||e instanceof File||e instanceof ArrayBuffer||ArrayBuffer.isView(e),e)}return function e(o,d=[]){null==o||s.includes(o)||(s.push(o),Object.entries(o).forEach((([o,s])=>{void 0!==s&&function(e,o,s){if(e&&"object"==typeof e){if(o.endsWith("{}"))return o=i?o:o.slice(0,-2),t.append(p(s,o,r),JSON.stringify(e)),!1;if(Array.isArray(e)&&!e.some(a)||o.endsWith("[]"))return o=m(o),e.forEach(((e,i)=>{if(null!=e){const a=n?p(s.concat(o),i,r):`${p(s,o,r)}[]`;t.append(a,c(e))}})),!1}return!!a(e)||(t.append(p(s,o,r),c(e)),!1)}(s,o.trim(),d)&&e(s,d.concat(m(o)))})),s.pop())}(e),t}_transformData(e){if(e&&"object"==typeof e)if(e.resultGoods?.msg)e=this._normalizeJsonData({msg:e.resultGoods.msg,...e});else if(e.resultErrors?.msg)e=this._normalizeJsonData({msg:e.resultErrors.msg,...e});else if(e.results&&"object"==typeof e.results&&!Array.isArray(e.results))e.results=Object.keys(e.results).map((t=>this._normalizeJsonData({id:t,...e.results[t]})));else if(Array.isArray(e.results))e.results=e.results.map((e=>this._normalizeJsonData(e)));else if(e.news&&Array.isArray(e.news)&&0===e.news.length)e=e.news;else if(e.news&&"object"==typeof e.news&&!Array.isArray(e.news))e=Object.keys(e.news).map((t=>this._normalizeJsonData({id:t,...e.news[t]})));else if(e.notif&&"object"==typeof e.notif&&!Array.isArray(e.notif))e.notif=Object.keys(e.notif).map((t=>this._normalizeJsonData({id:t,...e.notif[t]})));else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens)&&e.organizations&&"object"==typeof e.organizations&&!Array.isArray(e.organizations))e=[...Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]}))),...Object.keys(e.organizations).map((t=>this._normalizeJsonData({id:t,...e.organizations[t]})))];else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens))e=Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]})));else if(e.cities&&"object"==typeof e.cities&&!Array.isArray(e.cities))e=Object.keys(e.cities).map((t=>this._normalizeJsonData({id:t,...e.cities[t]})));else if(e.cities&&Array.isArray(e.cities)&&0===e.cities.length)e=e.cities;else if(e.newComment&&"object"==typeof e.newComment)e.newComment=this._normalizeJsonData({...e.newComment});else if(Array.isArray(e))e=e.map((e=>this._normalizeJsonData(e)));else if(e.map&&"object"==typeof e.map)e.map=this._normalizeJsonData(e.map);else if(e.object&&"object"==typeof e.object)e.object=this._normalizeJsonData(e.object);else if("object"==typeof e&&Object.keys(e).length>0){const t=Object.keys(e).every((e=>/^[0-9a-fA-F]{24}$/.test(e)));e=t?Object.keys(e).map((t=>({id:t,...this._normalizeJsonData(e[t])}))):this._normalizeJsonData(e)}return e}_normalizeJsonData(e){if(!e||"object"!=typeof e)return e;if(e=this._normalizeRecursively(e),e?.mediaImg?.images&&Array.isArray(e.mediaImg.images)&&e.mediaImg.images.length>0&&(e.mediaImg.countImages=e.mediaImg.images.length),e?.mediaFile?.files&&Array.isArray(e.mediaFile.files)&&e.mediaFile.files.length>0&&(e.mediaFile.countFiles=e.mediaFile.files.length),e?.src?.changes&&"object"==typeof e.src.changes&&Object.keys(e.src.changes).length>0&&Object.keys(e.src.changes).forEach((t=>{e.src.changes[t]&&(e.src.changes[t]=this._ensureFullURL(e.src.changes[t]))})),e?.openingHours&&Array.isArray(e.openingHours)&&e.openingHours.length>0&&(e.openingHours=e.openingHours.filter((e=>e.dayOfWeek&&e.hours&&e.hours[0]&&e.hours[0].opens))),e.replies&&"object"==typeof e.replies&&Object.keys(e.replies).length>0&&(e.replies=Object.keys(e.replies).map((t=>this._normalizeJsonData({id:t,...e.replies[t]})))),e?.author&&"object"==typeof e.author&&Object.keys(e.author).length>0&&!("profilThumbImageUrl"in e.author)){const t=Object.keys(e.author)[0];e.author={...e.author[t]}}return e?.timeAgo&&delete e.timeAgo,this._fromJSONValue?a.fromJSONValue(e):e}_ensureFullURL(e){if(!e)return e;if(!(e=e.trim())||/^https?:\/\//i.test(e))return e;let t="/";return t=this._baseURL.endsWith("/")&&e.startsWith("/")||this._baseURL.endsWith("/")||e.startsWith("/")?"":"/",`${this._baseURL}${t}${e}`}_normalizeString(e){return"true"===e||"false"!==e&&e}_normalizeId(e){return e._id&&e._id.$id&&/^[0-9a-fA-F]{24}$/.test(e._id.$id)&&(e.id=e._id.$id,e._id={$type:"oid",$value:e._id.$id}),e.id&&e.id.$id&&/^[0-9a-fA-F]{24}$/.test(e.id.$id)&&(e._id={$type:"oid",$value:e.id.$id},e.id=e.id.$id),e}_normalizeDate(e){return e&&"object"==typeof e&&"number"==typeof e.sec?{$date:1e3*e.sec}:"number"==typeof e?{$date:1e3*e}:e}_normalizeImage(e){return"string"==typeof e&&""!==e.trim()?this._ensureFullURL(e):e}_imageFields=["profilImageUrl","profilThumbImageUrl","profilMediumImageUrl","profilMarkerImageUrl","profilBannerUrl","profilRealBannerUrl","imagePath","imageThumbPath","docPath"];_dateFields=["modified","created","updated","birthDate","lastLoginDate","startDate","endDate","date"];_normalizeRecursively(e){if("string"==typeof e)return this._normalizeString(e);if(Array.isArray(e))return e.map((e=>this._normalizeRecursively(e)));if(null!==e&&"object"==typeof e){const t={};return Object.keys(e).forEach((o=>{let r=this._normalizeRecursively(e[o]);this._dateFields.includes(o)&&(r=this._normalizeDate(r)),this._imageFields.includes(o)&&(r=this._normalizeImage(r)),"content"===o&&r&&"object"==typeof r&&r.image&&(r.image=this._normalizeImage(r.image)),t[o]=r})),this._normalizeId(t)}return e}}module.exports=t})();
|