@communecter/cocolight-api-client 1.0.154 → 1.0.156

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/dist/1035.cocolight-api-client.browser.js +1 -1
  2. package/dist/1035.cocolight-api-client.cjs +1 -1
  3. package/dist/1483.cocolight-api-client.browser.js +1 -1
  4. package/dist/1483.cocolight-api-client.cjs +1 -1
  5. package/dist/1491.cocolight-api-client.browser.js +1 -1
  6. package/dist/1491.cocolight-api-client.cjs +1 -1
  7. package/dist/1494.cocolight-api-client.browser.js +1 -1
  8. package/dist/1494.cocolight-api-client.cjs +1 -1
  9. package/dist/1641.cocolight-api-client.browser.js +1 -1
  10. package/dist/1641.cocolight-api-client.cjs +1 -1
  11. package/dist/1678.cocolight-api-client.browser.js +1 -1
  12. package/dist/1678.cocolight-api-client.cjs +1 -1
  13. package/dist/2041.cocolight-api-client.browser.js +1 -1
  14. package/dist/2041.cocolight-api-client.cjs +1 -1
  15. package/dist/2302.cocolight-api-client.browser.js +1 -1
  16. package/dist/2302.cocolight-api-client.cjs +1 -1
  17. package/dist/2313.cocolight-api-client.browser.js +1 -1
  18. package/dist/2313.cocolight-api-client.cjs +1 -1
  19. package/dist/2379.cocolight-api-client.browser.js +1 -1
  20. package/dist/2379.cocolight-api-client.cjs +1 -1
  21. package/dist/2439.cocolight-api-client.browser.js +1 -1
  22. package/dist/2439.cocolight-api-client.cjs +1 -1
  23. package/dist/2594.cocolight-api-client.browser.js +1 -1
  24. package/dist/2594.cocolight-api-client.cjs +1 -1
  25. package/dist/2766.cocolight-api-client.browser.js +1 -1
  26. package/dist/2766.cocolight-api-client.cjs +1 -1
  27. package/dist/2812.cocolight-api-client.browser.js +1 -1
  28. package/dist/2812.cocolight-api-client.cjs +1 -1
  29. package/dist/2918.cocolight-api-client.browser.js +1 -1
  30. package/dist/2918.cocolight-api-client.cjs +1 -1
  31. package/dist/3028.cocolight-api-client.browser.js +1 -1
  32. package/dist/3028.cocolight-api-client.cjs +1 -1
  33. package/dist/3330.cocolight-api-client.browser.js +1 -1
  34. package/dist/3330.cocolight-api-client.cjs +1 -1
  35. package/dist/3371.cocolight-api-client.browser.js +1 -1
  36. package/dist/3371.cocolight-api-client.cjs +1 -1
  37. package/dist/3401.cocolight-api-client.browser.js +1 -1
  38. package/dist/3401.cocolight-api-client.cjs +1 -1
  39. package/dist/3516.cocolight-api-client.browser.js +1 -1
  40. package/dist/3516.cocolight-api-client.cjs +1 -1
  41. package/dist/3593.cocolight-api-client.browser.js +1 -1
  42. package/dist/3593.cocolight-api-client.cjs +1 -1
  43. package/dist/3764.cocolight-api-client.browser.js +1 -1
  44. package/dist/3764.cocolight-api-client.cjs +1 -1
  45. package/dist/3873.cocolight-api-client.browser.js +1 -1
  46. package/dist/3873.cocolight-api-client.cjs +1 -1
  47. package/dist/3911.cocolight-api-client.browser.js +1 -1
  48. package/dist/3911.cocolight-api-client.cjs +1 -1
  49. package/dist/4031.cocolight-api-client.browser.js +1 -1
  50. package/dist/4031.cocolight-api-client.cjs +1 -1
  51. package/dist/4152.cocolight-api-client.browser.js +1 -1
  52. package/dist/4152.cocolight-api-client.cjs +1 -1
  53. package/dist/4203.cocolight-api-client.browser.js +1 -1
  54. package/dist/4203.cocolight-api-client.cjs +1 -1
  55. package/dist/424.cocolight-api-client.browser.js +1 -1
  56. package/dist/424.cocolight-api-client.cjs +1 -1
  57. package/dist/435.cocolight-api-client.browser.js +1 -1
  58. package/dist/435.cocolight-api-client.cjs +1 -1
  59. package/dist/4402.cocolight-api-client.browser.js +1 -1
  60. package/dist/4402.cocolight-api-client.cjs +1 -1
  61. package/dist/4425.cocolight-api-client.browser.js +1 -1
  62. package/dist/4425.cocolight-api-client.cjs +1 -1
  63. package/dist/4472.cocolight-api-client.browser.js +1 -1
  64. package/dist/4472.cocolight-api-client.cjs +1 -1
  65. package/dist/4914.cocolight-api-client.browser.js +1 -1
  66. package/dist/4914.cocolight-api-client.cjs +1 -1
  67. package/dist/4959.cocolight-api-client.browser.js +1 -1
  68. package/dist/4959.cocolight-api-client.cjs +1 -1
  69. package/dist/5100.cocolight-api-client.browser.js +1 -1
  70. package/dist/5100.cocolight-api-client.cjs +1 -1
  71. package/dist/5111.cocolight-api-client.browser.js +1 -1
  72. package/dist/5111.cocolight-api-client.cjs +1 -1
  73. package/dist/5286.cocolight-api-client.browser.js +1 -1
  74. package/dist/5286.cocolight-api-client.cjs +1 -1
  75. package/dist/5380.cocolight-api-client.browser.js +1 -1
  76. package/dist/5380.cocolight-api-client.cjs +1 -1
  77. package/dist/5383.cocolight-api-client.browser.js +1 -1
  78. package/dist/5383.cocolight-api-client.cjs +1 -1
  79. package/dist/5480.cocolight-api-client.browser.js +1 -1
  80. package/dist/5480.cocolight-api-client.cjs +1 -1
  81. package/dist/5541.cocolight-api-client.browser.js +1 -1
  82. package/dist/5541.cocolight-api-client.cjs +1 -1
  83. package/dist/5839.cocolight-api-client.browser.js +1 -1
  84. package/dist/5839.cocolight-api-client.cjs +1 -1
  85. package/dist/5862.cocolight-api-client.browser.js +1 -1
  86. package/dist/5862.cocolight-api-client.cjs +1 -1
  87. package/dist/5869.cocolight-api-client.browser.js +1 -1
  88. package/dist/5869.cocolight-api-client.cjs +1 -1
  89. package/dist/588.cocolight-api-client.browser.js +1 -1
  90. package/dist/588.cocolight-api-client.cjs +1 -1
  91. package/dist/601.cocolight-api-client.browser.js +1 -1
  92. package/dist/601.cocolight-api-client.cjs +1 -1
  93. package/dist/6012.cocolight-api-client.browser.js +1 -1
  94. package/dist/6012.cocolight-api-client.cjs +1 -1
  95. package/dist/6200.cocolight-api-client.browser.js +1 -1
  96. package/dist/6200.cocolight-api-client.cjs +1 -1
  97. package/dist/6369.cocolight-api-client.browser.js +1 -1
  98. package/dist/6369.cocolight-api-client.cjs +1 -1
  99. package/dist/7009.cocolight-api-client.browser.js +1 -1
  100. package/dist/7009.cocolight-api-client.cjs +1 -1
  101. package/dist/725.cocolight-api-client.browser.js +1 -1
  102. package/dist/725.cocolight-api-client.cjs +1 -1
  103. package/dist/7320.cocolight-api-client.browser.js +1 -1
  104. package/dist/7339.cocolight-api-client.browser.js +1 -1
  105. package/dist/7339.cocolight-api-client.cjs +1 -1
  106. package/dist/7398.cocolight-api-client.browser.js +1 -1
  107. package/dist/7398.cocolight-api-client.cjs +1 -1
  108. package/dist/7888.cocolight-api-client.browser.js +1 -1
  109. package/dist/7888.cocolight-api-client.cjs +1 -1
  110. package/dist/7975.cocolight-api-client.browser.js +1 -1
  111. package/dist/7975.cocolight-api-client.cjs +1 -1
  112. package/dist/809.cocolight-api-client.browser.js +1 -1
  113. package/dist/809.cocolight-api-client.cjs +1 -1
  114. package/dist/8300.cocolight-api-client.browser.js +1 -1
  115. package/dist/8300.cocolight-api-client.cjs +1 -1
  116. package/dist/8317.cocolight-api-client.browser.js +1 -1
  117. package/dist/8317.cocolight-api-client.cjs +1 -1
  118. package/dist/8525.cocolight-api-client.browser.js +1 -1
  119. package/dist/8525.cocolight-api-client.cjs +1 -1
  120. package/dist/8894.cocolight-api-client.browser.js +1 -1
  121. package/dist/8894.cocolight-api-client.cjs +1 -1
  122. package/dist/9301.cocolight-api-client.browser.js +1 -1
  123. package/dist/9301.cocolight-api-client.cjs +1 -1
  124. package/dist/9438.cocolight-api-client.browser.js +1 -1
  125. package/dist/9438.cocolight-api-client.cjs +1 -1
  126. package/dist/9478.cocolight-api-client.browser.js +1 -1
  127. package/dist/9478.cocolight-api-client.cjs +1 -1
  128. package/dist/9568.cocolight-api-client.browser.js +1 -1
  129. package/dist/9568.cocolight-api-client.cjs +1 -1
  130. package/dist/cocolight-api-client.browser.js +6 -6
  131. package/dist/cocolight-api-client.cjs +1 -1
  132. package/dist/cocolight-api-client.vite.mjs.js +1 -1
  133. package/dist/cocolight-api-client.vite.mjs.js.map +1 -1
  134. package/package.json +7 -17
  135. package/types/Api.d.ts +1 -0
  136. package/types/ApiClient.d.ts +10 -1
  137. package/types/api/BaseEntity.d.ts +24 -0
  138. package/types/api/EndpointApi.d.ts +4 -4
  139. package/types/api/EndpointApi.types.d.ts +3 -3
  140. package/types/utils/OfflineClientManager.d.ts +8 -0
  141. package/dist/1035.cocolight-api-client.mjs.js +0 -1
  142. package/dist/1483.cocolight-api-client.mjs.js +0 -1
  143. package/dist/1491.cocolight-api-client.mjs.js +0 -1
  144. package/dist/1494.cocolight-api-client.mjs.js +0 -1
  145. package/dist/1641.cocolight-api-client.mjs.js +0 -1
  146. package/dist/1678.cocolight-api-client.mjs.js +0 -1
  147. package/dist/2041.cocolight-api-client.mjs.js +0 -1
  148. package/dist/2302.cocolight-api-client.mjs.js +0 -1
  149. package/dist/2313.cocolight-api-client.mjs.js +0 -1
  150. package/dist/2379.cocolight-api-client.mjs.js +0 -1
  151. package/dist/2439.cocolight-api-client.mjs.js +0 -1
  152. package/dist/2594.cocolight-api-client.mjs.js +0 -1
  153. package/dist/2766.cocolight-api-client.mjs.js +0 -1
  154. package/dist/2812.cocolight-api-client.mjs.js +0 -1
  155. package/dist/2918.cocolight-api-client.mjs.js +0 -1
  156. package/dist/3028.cocolight-api-client.mjs.js +0 -1
  157. package/dist/3330.cocolight-api-client.mjs.js +0 -1
  158. package/dist/3371.cocolight-api-client.mjs.js +0 -1
  159. package/dist/3401.cocolight-api-client.mjs.js +0 -1
  160. package/dist/3516.cocolight-api-client.mjs.js +0 -1
  161. package/dist/3593.cocolight-api-client.mjs.js +0 -1
  162. package/dist/3764.cocolight-api-client.mjs.js +0 -1
  163. package/dist/3873.cocolight-api-client.mjs.js +0 -1
  164. package/dist/3911.cocolight-api-client.mjs.js +0 -1
  165. package/dist/4031.cocolight-api-client.mjs.js +0 -1
  166. package/dist/4152.cocolight-api-client.mjs.js +0 -1
  167. package/dist/4203.cocolight-api-client.mjs.js +0 -1
  168. package/dist/424.cocolight-api-client.mjs.js +0 -1
  169. package/dist/435.cocolight-api-client.mjs.js +0 -1
  170. package/dist/4402.cocolight-api-client.mjs.js +0 -1
  171. package/dist/4425.cocolight-api-client.mjs.js +0 -1
  172. package/dist/4472.cocolight-api-client.mjs.js +0 -1
  173. package/dist/4914.cocolight-api-client.mjs.js +0 -1
  174. package/dist/4959.cocolight-api-client.mjs.js +0 -1
  175. package/dist/5100.cocolight-api-client.mjs.js +0 -1
  176. package/dist/5111.cocolight-api-client.mjs.js +0 -1
  177. package/dist/5286.cocolight-api-client.mjs.js +0 -1
  178. package/dist/5380.cocolight-api-client.mjs.js +0 -1
  179. package/dist/5383.cocolight-api-client.mjs.js +0 -1
  180. package/dist/5480.cocolight-api-client.mjs.js +0 -1
  181. package/dist/5541.cocolight-api-client.mjs.js +0 -1
  182. package/dist/5839.cocolight-api-client.mjs.js +0 -1
  183. package/dist/5862.cocolight-api-client.mjs.js +0 -1
  184. package/dist/5869.cocolight-api-client.mjs.js +0 -1
  185. package/dist/588.cocolight-api-client.mjs.js +0 -1
  186. package/dist/601.cocolight-api-client.mjs.js +0 -1
  187. package/dist/6012.cocolight-api-client.mjs.js +0 -1
  188. package/dist/6200.cocolight-api-client.mjs.js +0 -1
  189. package/dist/6369.cocolight-api-client.mjs.js +0 -1
  190. package/dist/7009.cocolight-api-client.mjs.js +0 -1
  191. package/dist/725.cocolight-api-client.mjs.js +0 -1
  192. package/dist/7339.cocolight-api-client.mjs.js +0 -1
  193. package/dist/7398.cocolight-api-client.mjs.js +0 -1
  194. package/dist/7888.cocolight-api-client.mjs.js +0 -1
  195. package/dist/7975.cocolight-api-client.mjs.js +0 -1
  196. package/dist/809.cocolight-api-client.mjs.js +0 -1
  197. package/dist/8300.cocolight-api-client.mjs.js +0 -1
  198. package/dist/8317.cocolight-api-client.mjs.js +0 -1
  199. package/dist/8525.cocolight-api-client.mjs.js +0 -1
  200. package/dist/8894.cocolight-api-client.mjs.js +0 -1
  201. package/dist/9301.cocolight-api-client.mjs.js +0 -1
  202. package/dist/9438.cocolight-api-client.mjs.js +0 -1
  203. package/dist/9478.cocolight-api-client.mjs.js +0 -1
  204. package/dist/9568.cocolight-api-client.mjs.js +0 -1
  205. package/dist/cocolight-api-client.mjs.js +0 -1
  206. package/src/Api.ts +0 -348
  207. package/src/ApiClient.ts +0 -1994
  208. package/src/EJSONType.ts +0 -103
  209. package/src/api/Action.ts +0 -665
  210. package/src/api/Answer.ts +0 -1392
  211. package/src/api/Badge.ts +0 -143
  212. package/src/api/BaseEntity.ts +0 -6338
  213. package/src/api/Classified.ts +0 -175
  214. package/src/api/Comment.ts +0 -280
  215. package/src/api/EndpointApi.ts +0 -2270
  216. package/src/api/EndpointApi.types.ts +0 -6566
  217. package/src/api/EntityRegistry.ts +0 -324
  218. package/src/api/Event.ts +0 -360
  219. package/src/api/Form.ts +0 -282
  220. package/src/api/News.ts +0 -547
  221. package/src/api/Notifications.ts +0 -196
  222. package/src/api/Organization.ts +0 -771
  223. package/src/api/Poi.ts +0 -242
  224. package/src/api/Project.ts +0 -545
  225. package/src/api/User.ts +0 -1889
  226. package/src/api/UserApi.ts +0 -192
  227. package/src/api/serverDataType/Action.ts +0 -177
  228. package/src/api/serverDataType/Answer.ts +0 -106
  229. package/src/api/serverDataType/Classified.ts +0 -152
  230. package/src/api/serverDataType/Comment.ts +0 -88
  231. package/src/api/serverDataType/Country.ts +0 -1
  232. package/src/api/serverDataType/Event.ts +0 -112
  233. package/src/api/serverDataType/Form.ts +0 -157
  234. package/src/api/serverDataType/News.ts +0 -138
  235. package/src/api/serverDataType/Notification.ts +0 -81
  236. package/src/api/serverDataType/Organization.ts +0 -111
  237. package/src/api/serverDataType/Poi.ts +0 -75
  238. package/src/api/serverDataType/Project.ts +0 -115
  239. package/src/api/serverDataType/User.ts +0 -112
  240. package/src/api/serverDataType/Zone.ts +0 -33
  241. package/src/api/serverDataType/common.ts +0 -84
  242. package/src/costum/normalize.ts +0 -7
  243. package/src/costum/registry.ts +0 -138
  244. package/src/costum/runtime-map.ts +0 -221
  245. package/src/costum/runtime.ts +0 -274
  246. package/src/costum/schemas/CercleTravailleursSociauxLiberauxLaPlumeSociale.ts +0 -19
  247. package/src/costum/schemas/FabEn.ts +0 -19
  248. package/src/costum/schemas/LivingLabInnovationSocialeBraspanon.ts +0 -19
  249. package/src/costum/schemas/alfph.ts +0 -27
  250. package/src/costum/schemas/campagne.ts +0 -19
  251. package/src/costum/schemas/chtitube.ts +0 -19
  252. package/src/costum/schemas/circuitCourt.ts +0 -19
  253. package/src/costum/schemas/cmcasHauteBretagne.ts +0 -19
  254. package/src/costum/schemas/coFinancementTierslieux.ts +0 -27
  255. package/src/costum/schemas/coeurNumerique.ts +0 -19
  256. package/src/costum/schemas/communLundi.ts +0 -19
  257. package/src/costum/schemas/cressReunion.ts +0 -35
  258. package/src/costum/schemas/cressReunionNetwork.ts +0 -35
  259. package/src/costum/schemas/ctenat.ts +0 -43
  260. package/src/costum/schemas/cyberReunion.ts +0 -19
  261. package/src/costum/schemas/ekisphere.ts +0 -35
  262. package/src/costum/schemas/equipementsSportifs974.ts +0 -19
  263. package/src/costum/schemas/federationDesCae.ts +0 -19
  264. package/src/costum/schemas/formationGenerique.ts +0 -35
  265. package/src/costum/schemas/franceTierslieux.ts +0 -19
  266. package/src/costum/schemas/hinaura.ts +0 -27
  267. package/src/costum/schemas/hubmayotte.ts +0 -19
  268. package/src/costum/schemas/hubnouvellecaledonie.ts +0 -19
  269. package/src/costum/schemas/hubpolynesiefrancaise.ts +0 -19
  270. package/src/costum/schemas/hubreunion.ts +0 -19
  271. package/src/costum/schemas/hubterritoires.ts +0 -19
  272. package/src/costum/schemas/hubwallisetfutuna.ts +0 -19
  273. package/src/costum/schemas/hva.ts +0 -27
  274. package/src/costum/schemas/ibv2.ts +0 -19
  275. package/src/costum/schemas/institutBleu.ts +0 -19
  276. package/src/costum/schemas/journalInsoumisChambery.ts +0 -27
  277. package/src/costum/schemas/kpacite.ts +0 -19
  278. package/src/costum/schemas/laCompagnieDesTierslieux.ts +0 -43
  279. package/src/costum/schemas/laMaisonDesFaiseurs.ts +0 -19
  280. package/src/costum/schemas/laReunionPourUnNumeriqueInclusif.ts +0 -19
  281. package/src/costum/schemas/laSemaineDesTierslieux.ts +0 -19
  282. package/src/costum/schemas/labEnCommuns.ts +0 -19
  283. package/src/costum/schemas/lakou.ts +0 -27
  284. package/src/costum/schemas/lesCommunsDesTierslieux.ts +0 -19
  285. package/src/costum/schemas/mayottePourUnNumeriqueInclusif.ts +0 -19
  286. package/src/costum/schemas/meir.ts +0 -27
  287. package/src/costum/schemas/navigatorDesTierslieux.ts +0 -19
  288. package/src/costum/schemas/notragora.ts +0 -27
  289. package/src/costum/schemas/nouvellecaledoniePourUnNumeriqueInclusif.ts +0 -19
  290. package/src/costum/schemas/openAtlas.ts +0 -19
  291. package/src/costum/schemas/polynesieFrancaisePourUnNumeriqueInclusif.ts +0 -19
  292. package/src/costum/schemas/prdr.ts +0 -19
  293. package/src/costum/schemas/reseauTierslieux.ts +0 -19
  294. package/src/costum/schemas/rfflabs.ts +0 -19
  295. package/src/costum/schemas/ries.ts +0 -19
  296. package/src/costum/schemas/siteDuPactePourLaTransition.ts +0 -27
  297. package/src/costum/schemas/sportSanteBienetre.ts +0 -43
  298. package/src/costum/schemas/suppa.ts +0 -19
  299. package/src/costum/schemas/terramies.ts +0 -19
  300. package/src/costum/schemas/testeTplFormation.ts +0 -35
  301. package/src/costum/schemas/tierslieuxbelgique.ts +0 -19
  302. package/src/costum/schemas/tierslieuxorg1.ts +0 -35
  303. package/src/costum/schemas/transiter.ts +0 -35
  304. package/src/costum/schemas/vhelioPeiTour2025.ts +0 -19
  305. package/src/costum/schemas/wallisetfutunaPourUnNumeriqueInclusif.ts +0 -19
  306. package/src/costum/symbol.ts +0 -26
  307. package/src/costum/types.ts +0 -895
  308. package/src/endpoints.module.ts +0 -4253
  309. package/src/error.ts +0 -86
  310. package/src/forms/entityForm.ts +0 -142
  311. package/src/index.ts +0 -161
  312. package/src/mixin/UserMixin.ts +0 -4
  313. package/src/types/api-responses.ts +0 -217
  314. package/src/types/entities.ts +0 -58
  315. package/src/types/error-guards.ts +0 -230
  316. package/src/types/index.ts +0 -41
  317. package/src/types/payloads.ts +0 -21
  318. package/src/types/transforms.ts +0 -119
  319. package/src/utils/FileOfflineStorageStrategy.node.ts +0 -50
  320. package/src/utils/FileStorageStrategy.node.ts +0 -63
  321. package/src/utils/MultiServerFileStorageStrategy.node.ts +0 -67
  322. package/src/utils/MultiServerTokenStorageStrategy.ts +0 -139
  323. package/src/utils/OfflineClientManager.ts +0 -216
  324. package/src/utils/OfflineQueueStorageStrategy.ts +0 -47
  325. package/src/utils/TokenStorage.ts +0 -77
  326. package/src/utils/compat.ts +0 -12
  327. package/src/utils/createDefaultMultiServerTokenStorageStrategy.ts +0 -35
  328. package/src/utils/createDefaultOfflineStrategy.ts +0 -34
  329. package/src/utils/createDefaultTokenStorageStrategy.ts +0 -33
  330. package/src/utils/reactive.ts +0 -243
  331. package/src/utils/stream-utils.node.ts +0 -12
@@ -1,192 +0,0 @@
1
- import ApiClient from "../ApiClient.js";
2
- import { Action } from "./Action.js";
3
- import { Answer } from "./Answer.js";
4
- import { Badge } from "./Badge.js";
5
- import { Classified } from "./Classified.js";
6
- import { Comment } from "./Comment.js";
7
- import EndpointApi from "./EndpointApi.js";
8
- import { Event } from "./Event.js";
9
- import { News } from "./News.js";
10
- import { Organization } from "./Organization.js";
11
- import { Poi } from "./Poi.js";
12
- import { Project } from "./Project.js";
13
- import { User } from "./User.js";
14
- import { COSTUM_REQUEST_ENVELOPE } from "../costum/symbol.js";
15
- import { ApiError, ApiResponseError } from "../error.js";
16
-
17
- type AxiosResponse = import("axios").AxiosResponse;
18
-
19
- function isAxiosResponse(r: any): r is AxiosResponse {
20
- return r && typeof r === "object" && "status" in r && "data" in r;
21
- }
22
-
23
- /**
24
- * API orientée utilisateur pour gérer l'authentification et
25
- * récupérer l'utilisateur connecté.
26
- */
27
- export class UserApi {
28
- client: ApiClient;
29
- loggedUser: User | null = null;
30
-
31
- /**
32
- * @param clientOrOptions - Soit une instance ApiClient, soit des options pour en créer une
33
- */
34
- constructor(clientOrOptions: ApiClient | ConstructorParameters<typeof ApiClient>[0]) {
35
- if (clientOrOptions instanceof ApiClient) {
36
- this.client = clientOrOptions;
37
- } else {
38
- // Injection de dépendance : ApiClient est créé à partir des options
39
- this.client = new ApiClient(clientOrOptions);
40
- }
41
- }
42
-
43
- /**
44
- * Indique si un utilisateur est connecté.
45
- */
46
- get isConnected(): boolean {
47
- return this.client.isConnected;
48
- }
49
-
50
- /**
51
- * Retourne l'ID de l'utilisateur connecté ou `null` s'il n'y a pas de session.
52
- */
53
- get userId(): string | null {
54
- return this.client.userId;
55
- }
56
-
57
- /**
58
- * Authentifie un utilisateur et retourne l'instance `User` correspondante.
59
- *
60
- * @param email - Adresse email de l'utilisateur.
61
- * @param password - Mot de passe de l'utilisateur.
62
- * @returns {Promise<User>}
63
- * @throws {ApiError} En cas d'échec de connexion réseau ou de problème interne.
64
- * @throws {ApiResponseError} Si l'API retourne une erreur d'authentification.
65
- */
66
- async login(email: string, password: string): Promise<User> {
67
- return this.client.safeCall(async () => {
68
- const response = await this.client.callEndpoint("AUTHENTICATE_URL", { email, password });
69
-
70
- this.loggedUser = new User(
71
- this.client,
72
- response.data.user,
73
- { EndpointApi, Organization, Project, Event, Poi, Badge, News, Comment, Answer, Classified, Action }
74
- );
75
- return this.loggedUser;
76
- });
77
- }
78
-
79
- /**
80
- * Récupère l'instance `User` correspondant à l'utilisateur actuellement connecté.
81
- *
82
- * @returns {Promise<User>}
83
- * @throws {ApiError} Si aucun utilisateur n'est connecté (`isConnected` faux ou `userId` absent).
84
- */
85
- async meIsconnected(): Promise<User> {
86
- if (!this.client.isConnected || !this.client.userId) {
87
- throw new ApiError("User not connected", 401);
88
- }
89
-
90
- this.client._logger.debug("UserApi", "meIsconnected", this.client.userId);
91
-
92
- this.loggedUser = new User(
93
- this.client,
94
- { id: this.client.userId },
95
- { EndpointApi, Organization, Project, Event, Poi, Badge, News, Comment, Answer, Classified, Action }
96
- );
97
-
98
- return this.loggedUser;
99
- }
100
-
101
- /**
102
- * Enregistre un nouvel utilisateur.
103
- *
104
- * @param params
105
- * @param params.name - Nom complet.
106
- * @param params.username - Nom d'utilisateur.
107
- * @param params.email - Adresse email.
108
- * @param params.pwd - Mot de passe.
109
- * @param params.costumSlug - (option) slug du costum de déploiement → estampille `source.key` du citoyen
110
- * côté backend (port Person::insert). `costumId`/`costumType` = entité porteuse (requis si le slug n'est
111
- * pas un doc `costum`, ex. un site porté par une org).
112
- * @returns Réponse brute de l'API.
113
- * @throws {ApiResponseError} Si l'API retourne un échec (`result === false`).
114
- */
115
- async register({ name, username, email, pwd, costumSlug, costumId, costumType }: { name: string; username: string; email: string; pwd: string; costumSlug?: string; costumId?: string; costumType?: string }): Promise<any> {
116
- return this.client.safeCall(async () => {
117
- const data: Record<string, unknown> = { name, username, email, pwd };
118
- // Contexte costum (déploiement) injecté via l'enveloppe (cf. element/save) : `callEndpoint` fusionne le
119
- // `context` dans le body + relâche l'AJV. Le backend lit costumSlug/Id/Type → estampille `source` (origin/key/keys).
120
- if (costumSlug) {
121
- (data as Record<symbol, unknown>)[COSTUM_REQUEST_ENVELOPE] = {
122
- properties: {},
123
- context: { costumSlug, ...(costumId ? { costumId } : {}), ...(costumType ? { costumType } : {}) },
124
- };
125
- }
126
- const response = await this.client.callEndpoint("PERSON_REGISTER", data);
127
-
128
- if (!isAxiosResponse(response)) {
129
- throw new ApiError("Requête mise en file (offline/circuit breaker)", 503, response);
130
- }
131
-
132
- if (response?.data?.result === false) {
133
- throw new ApiResponseError(response.data.msg, response.status, response.data);
134
- }
135
-
136
- return response.data;
137
- });
138
- }
139
-
140
- /**
141
- * Lance une procédure de récupération de mot de passe.
142
- *
143
- * @param email - Adresse email de l'utilisateur.
144
- * @returns Réponse brute de l'API.
145
- * @throws {ApiResponseError} Si l'API retourne un échec (`result === false`).
146
- */
147
- async recoverPassword(email: string): Promise<any> {
148
- return this.client.safeCall(async () => {
149
- const response = await this.client.callEndpoint("PASSWORD_RECOVERY", { email });
150
-
151
- if (!isAxiosResponse(response)) {
152
- throw new ApiError("Requête mise en file (offline/circuit breaker)", 503, response);
153
- }
154
-
155
- if (response?.data?.result === false) {
156
- throw new ApiResponseError(response.data.msg, response.status, response.data);
157
- }
158
-
159
- return response.data;
160
- });
161
- }
162
-
163
- /**
164
- * Active (valide l'email) un compte via le lien reçu par email.
165
- *
166
- * Endpoint public (aucune authentification requise). La `validationKey`
167
- * correspond à `sha256(user + email)`. En cas de succès, le rôle
168
- * `tobeactivated` est retiré et le consentement `sendMail.source` posé.
169
- *
170
- * @param params
171
- * @param params.user - Identifiant (`_id`) du compte à activer.
172
- * @param params.validationKey - Clé de validation = `sha256(user + email)`.
173
- * @returns Réponse brute de l'API (`{ result: true, msg: string }`).
174
- * @throws {ApiError} En cas de mise en file (offline/circuit breaker).
175
- * @throws {ApiResponseError} Si l'API retourne un échec (`result === false`).
176
- */
177
- async activateAccount({ user, validationKey }: { user: string; validationKey: string }): Promise<any> {
178
- return this.client.safeCall(async () => {
179
- const response = await this.client.callEndpoint("PERSON_ACTIVATE", { user, validationKey });
180
-
181
- if (!isAxiosResponse(response)) {
182
- throw new ApiError("Requête mise en file (offline/circuit breaker)", 503, response);
183
- }
184
-
185
- if (response?.data?.result === false) {
186
- throw new ApiResponseError(response.data.msg, response.status, response.data);
187
- }
188
-
189
- return response.data;
190
- });
191
- }
192
- }
@@ -1,177 +0,0 @@
1
- import type {
2
- IdObject,
3
- LinkContributorsRef,
4
- ParentsMap,
5
- DateValue,
6
- } from "./common.js";
7
- import type EJSONType from "../../EJSONType.js";
8
-
9
- type ObjectIDCtor = typeof EJSONType["ObjectID"];
10
- type ObjectID = InstanceType<ObjectIDCtor>;
11
-
12
- /**
13
- * Statuts supportés par une action (cf. COSTUM_PROJECT_ACTION_REQUEST_NEW).
14
- */
15
- export const ACTION_STATUSES = [
16
- "todo",
17
- "done",
18
- "tracking",
19
- "discuter",
20
- "next",
21
- "totest",
22
- "disabled",
23
- "closed"
24
- ] as const;
25
-
26
- export type ActionStatus = (typeof ACTION_STATUSES)[number];
27
-
28
- export interface ActionLinksBlock {
29
- contributors?: Record<string, LinkContributorsRef>;
30
- [k: string]: unknown;
31
- }
32
-
33
- export interface ActionMilestoneRef {
34
- milestoneId: string;
35
- startDate?: DateValue;
36
- endDate?: DateValue;
37
- }
38
-
39
- export interface ActionCounts {
40
- contributors?: number;
41
- [k: string]: unknown;
42
- }
43
-
44
- /**
45
- * Historique des changements de statut (alimenté par /set_status côté backend).
46
- * `update` est un MongoDate (DateValue côté Json, Date côté Normalized).
47
- */
48
- export interface ActionUpdateStatusEntryJson {
49
- status: ActionStatus;
50
- author: string;
51
- update: DateValue;
52
- }
53
-
54
- export interface ActionUpdateStatusEntryNormalized {
55
- status: ActionStatus;
56
- author: string;
57
- update: Date;
58
- }
59
-
60
- /**
61
- * Sous-tâche d'une action. Stockée dans `tasks[]`.
62
- */
63
- export interface ActionTaskJson {
64
- taskId?: string;
65
- task?: string;
66
- checked?: boolean;
67
- userId?: string;
68
- contributors?: Record<string, unknown>;
69
- timeSpent?: number;
70
- createdAt?: DateValue;
71
- checkedAt?: DateValue;
72
- [key: string]: unknown;
73
- }
74
-
75
- export interface ActionTaskNormalized {
76
- taskId?: string;
77
- task?: string;
78
- checked?: boolean;
79
- userId?: string;
80
- contributors?: Record<string, unknown>;
81
- timeSpent?: number;
82
- createdAt?: Date;
83
- checkedAt?: Date;
84
- [key: string]: unknown;
85
- }
86
-
87
- /**
88
- * Bloc media : galerie d'images + fichiers attachés (par IDs de documents).
89
- */
90
- export interface ActionMedia {
91
- type?: string;
92
- countImages?: number;
93
- images?: string[];
94
- files?: string[];
95
- [k: string]: unknown;
96
- }
97
-
98
- export interface ActionMediaFile {
99
- files?: string[];
100
- [k: string]: unknown;
101
- }
102
-
103
- export interface ActionItemJson {
104
- _id: IdObject;
105
- collection: "actions";
106
- name: string;
107
- description?: string;
108
- status?: ActionStatus;
109
- created?: DateValue;
110
- updated?: DateValue;
111
- modified?: DateValue;
112
- startDate?: DateValue;
113
- endDate?: DateValue;
114
- parentId: string;
115
- parentType: string;
116
- parent?: ParentsMap;
117
- tags?: string[];
118
- links?: ActionLinksBlock;
119
- creator?: string;
120
- idUserAuthor?: string;
121
- credits?: string;
122
- idParentRoom?: string;
123
- milestone?: ActionMilestoneRef;
124
- importance?: string;
125
- counts?: ActionCounts;
126
- url?: string;
127
- min?: number;
128
- max?: number;
129
- timeSpent?: number;
130
- tracking?: boolean;
131
- updateStatus?: ActionUpdateStatusEntryJson[];
132
- rc?: unknown[];
133
- tasks?: ActionTaskJson[];
134
- media?: ActionMedia;
135
- mediaFile?: ActionMediaFile;
136
- [key: string]: unknown;
137
- }
138
-
139
- export interface ActionItemNormalized {
140
- id: string;
141
- _id: ObjectID;
142
- collection: "actions";
143
- name: string;
144
- description?: string;
145
- status?: ActionStatus;
146
- created?: Date;
147
- updated?: Date;
148
- modified?: Date;
149
- startDate?: Date;
150
- endDate?: Date;
151
- parentId: string;
152
- parentType: string;
153
- parent?: ParentsMap;
154
- tags?: string[];
155
- links?: ActionLinksBlock;
156
- creator?: string;
157
- idUserAuthor?: string;
158
- credits?: number;
159
- idParentRoom?: string;
160
- milestone?: Omit<ActionMilestoneRef, "startDate" | "endDate"> & {
161
- startDate?: Date;
162
- endDate?: Date;
163
- };
164
- importance?: string;
165
- counts?: ActionCounts;
166
- url?: string;
167
- min?: number;
168
- max?: number;
169
- timeSpent?: number;
170
- tracking?: boolean;
171
- updateStatus?: ActionUpdateStatusEntryNormalized[];
172
- rc?: unknown[];
173
- tasks?: ActionTaskNormalized[];
174
- media?: ActionMedia;
175
- mediaFile?: ActionMediaFile;
176
- [key: string]: unknown;
177
- }
@@ -1,106 +0,0 @@
1
- import { DateValue, IdObject, ParentsMap } from "./common.js";
2
-
3
- import type EJSONType from "../../EJSONType.js";
4
- import type { Answer } from "../Answer.js";
5
- import type { Organization } from "../Organization.js";
6
- import type { Project } from "../Project.js";
7
- import type { User } from "../User.js";
8
-
9
- type ObjectIDCtor = typeof EJSONType["ObjectID"];
10
- type ObjectID = InstanceType<ObjectIDCtor>;
11
-
12
- /**
13
- * Identifiant d'un Form (string 24 hex). Alias purement sémantique de `string` :
14
- * sert à lever l'ambiguïté dans `Record<FormId, ...>` — sans ce nom, on pourrait croire
15
- * qu'il s'agit d'un answerId ou autre.
16
- *
17
- * ⚠️ Ces formIds proviennent de la config costum (ex: `navigatorDesTierslieux`)
18
- * et ne correspondent **pas toujours** à des docs queriables via `api.form({id}).get()` —
19
- * il s'agit parfois de références internes au costum (templates, sous-forms, etc.).
20
- * À traiter comme un opaque token côté caller.
21
- */
22
- export type FormId = string;
23
-
24
- /**
25
- * Forme JSON brute : Answer docs (MongoDB) groupés par formId.
26
- * Apparaît dans `result.answers` du payload `/costum/navigator/gettl` avant linkage.
27
- */
28
- export type AnswerDocsByFormId = Record<FormId, AnswerItemJson[]>;
29
-
30
- /**
31
- * Forme normalisée : instances `Answer` groupées par formId.
32
- * Construite par `Organization/Project._transformServerData` à partir de `AnswerDocsByFormId`.
33
- */
34
- export type AnswersByFormId = Record<FormId, Answer[]>;
35
-
36
- export interface AnswerLinksBlock {
37
- answered: string[];
38
- }
39
-
40
- export interface AnswerProjectRef {
41
- id?: string;
42
- type?: string;
43
- name?: string;
44
- }
45
-
46
- export interface AnswerItemJson {
47
- _id: IdObject;
48
- collection: "answers";
49
- created?: DateValue;
50
- updated?: DateValue;
51
- user?: string;
52
- links?: AnswerLinksBlock;
53
- draft?: boolean;
54
- answers?: Record<string, unknown>;
55
- context?: ParentsMap;
56
- form?: string;
57
- modified?: DateValue;
58
- voteCount?: Record<string, number>;
59
- vote?: Record<string, {
60
- status: string;
61
- date: DateValue;
62
- }>;
63
- project?: AnswerProjectRef;
64
- [key: string]: unknown;
65
- }
66
-
67
- /**
68
- * Raisons de refus d'édition côté backend, calculées par `coformAnswersById`
69
- * et présentes dans la réponse normalisée. Utilisé par les UI pour distinguer
70
- * les modes readonly/edit et afficher des messages contextuels.
71
- */
72
- export type AnswerEditDeniedReason =
73
- | "not_logged_in"
74
- | "not_owner"
75
- | "form_inactive"
76
- | "form_closed";
77
-
78
- export interface AnswerItemNormalized {
79
- id: string;
80
- _id: ObjectID;
81
- collection: "answers";
82
- created?: Date;
83
- updated?: Date;
84
- user?: string | User;
85
- links?: AnswerLinksBlock;
86
- draft?: boolean;
87
- finished?: boolean;
88
- answers?: Record<string, unknown>;
89
- context?: ParentsMap | Record<string, Organization | Project>;
90
- form?: string;
91
- modified?: Date;
92
- voteCount?: Record<string, number>;
93
- vote?: Record<string, {
94
- status: string;
95
- date: Date;
96
- }>;
97
- project?: AnswerProjectRef;
98
- /**
99
- * L'utilisateur courant peut-il éditer cette réponse ? Calculé côté backend.
100
- * Présent par défaut, ou enrichi avec le contexte si `formId` est fourni.
101
- */
102
- canEdit?: boolean;
103
- /** Raison si `canEdit === false`. `null` si `canEdit === true`. */
104
- editDeniedReason?: AnswerEditDeniedReason | null;
105
- [key: string]: unknown;
106
- }
@@ -1,152 +0,0 @@
1
- import type {
2
- GeoCoordinates,
3
- GeoPosition,
4
- IdObject,
5
- ParentsMap,
6
- PostalAddress,
7
- DateValue
8
- } from "./common.js";
9
- import type EJSONType from "../../EJSONType.js";
10
-
11
- type ObjectIDCtor = typeof EJSONType["ObjectID"];
12
- type ObjectID = InstanceType<ObjectIDCtor>;
13
-
14
- // ============================================================================
15
- // SECTIONS
16
- // ============================================================================
17
-
18
- export const CLASSIFIED_SECTIONS = ["need", "offer"] as const;
19
- export type ClassifiedSection = (typeof CLASSIFIED_SECTIONS)[number];
20
-
21
- // ============================================================================
22
- // CATÉGORIES
23
- // ============================================================================
24
-
25
- export const CLASSIFIED_CATEGORIES = ["service", "competence", "material"] as const;
26
- export type ClassifiedCategory = (typeof CLASSIFIED_CATEGORIES)[number];
27
-
28
- // ============================================================================
29
- // SOUS-CATÉGORIES
30
- // ============================================================================
31
-
32
- export interface ClassifiedSubcatEntry {
33
- key: string;
34
- label: string;
35
- icon: string;
36
- }
37
-
38
- export interface ClassifiedCategoryDef {
39
- key: ClassifiedCategory;
40
- icon: string;
41
- label: string;
42
- subcat: Record<string, ClassifiedSubcatEntry>;
43
- }
44
-
45
- export const CLASSIFIED_SUBCATEGORIES: Record<ClassifiedCategory, ClassifiedCategoryDef> = {
46
- service: {
47
- key: "service",
48
- icon: "cogs",
49
- label: "Service",
50
- subcat: {
51
- charity: { key: "charity", label: "Charité", icon: "heart" },
52
- education: { key: "education", label: "Aide éducative", icon: "book" },
53
- househelp: { key: "househelp", label: "Aide ménagère", icon: "home" },
54
- washing: { key: "washing", label: "Lavage", icon: "droplets" },
55
- gardening: { key: "gardening", label: "Jardinage", icon: "flower" },
56
- farming: { key: "farming", label: "Agriculture", icon: "wheat" },
57
- generalmaintenance: { key: "generalmaintenance", label: "Maintenance générale", icon: "wrench" },
58
- childrencare: { key: "childrencare", label: "Garde d'enfants", icon: "baby" },
59
- ederlycare: { key: "ederlycare", label: "Aide aux personnes âgées", icon: "user" },
60
- disabledcare: { key: "disabledcare", label: "Aide aux personnes en situation de handicap", icon: "accessibility" },
61
- hostinghelp: { key: "hostinghelp", label: "Aide à l'accueil", icon: "handshake" },
62
- animalcare: { key: "animalcare", label: "Soins aux animaux", icon: "paw-print" },
63
- },
64
- },
65
- competence: {
66
- key: "competence",
67
- icon: "bookmark",
68
- label: "Compétence",
69
- subcat: {
70
- artistic: { key: "artistic", label: "Artistique", icon: "palette" },
71
- laws: { key: "laws", label: "Droit", icon: "scale" },
72
- itdevlopment: { key: "itdevlopment", label: "Développement informatique", icon: "code" },
73
- handcraft: { key: "handcraft", label: "Artisanat", icon: "scissors" },
74
- animalcare: { key: "animalcare", label: "Soins aux animaux", icon: "paw-print" },
75
- agriculture: { key: "agriculture", label: "Agriculture", icon: "wheat" },
76
- restauration: { key: "restauration", label: "Restauration", icon: "utensils" },
77
- building: { key: "building", label: "Construction", icon: "hard-hat" },
78
- },
79
- },
80
- material: {
81
- key: "material",
82
- icon: "wrench",
83
- label: "Matériel",
84
- subcat: {
85
- electronic: { key: "electronic", label: "Électronique", icon: "cpu" },
86
- furniture: { key: "furniture", label: "Mobilier", icon: "armchair" },
87
- primaryressources: { key: "primaryressources", label: "Ressources primaires", icon: "leaf" },
88
- buildingtools: { key: "buildingtools", label: "Outils de construction", icon: "hammer" },
89
- gardeningtools: { key: "gardeningtools", label: "Outils de jardinage", icon: "shovel" },
90
- medicalstuff: { key: "medicalstuff", label: "Matériel médical", icon: "stethoscope" },
91
- },
92
- },
93
- };
94
-
95
- // Union des clés de sous-catégories
96
- export type ServiceSubcat = keyof typeof CLASSIFIED_SUBCATEGORIES.service.subcat;
97
- export type CompetenceSubcat = keyof typeof CLASSIFIED_SUBCATEGORIES.competence.subcat;
98
- export type MaterialSubcat = keyof typeof CLASSIFIED_SUBCATEGORIES.material.subcat;
99
- export type ClassifiedSubcat = ServiceSubcat | CompetenceSubcat | MaterialSubcat;
100
-
101
- // ============================================================================
102
- // INTERFACES JSON / NORMALISÉES
103
- // ============================================================================
104
-
105
- export interface ClassifiedItemJson {
106
- _id: IdObject;
107
- collection: "classifieds";
108
- name: string;
109
- section: ClassifiedSection;
110
- category: ClassifiedCategory;
111
- subtype: ClassifiedSubcat;
112
- created?: DateValue;
113
- updated?: DateValue;
114
- modified?: DateValue;
115
- parent?: ParentsMap;
116
- description?: string;
117
- slug?: string;
118
- address?: PostalAddress;
119
- geo?: GeoCoordinates;
120
- geoPosition?: GeoPosition;
121
- tags?: string[];
122
- creator?: string;
123
- profilImageUrl?: string;
124
- profilMediumImageUrl?: string;
125
- profilThumbImageUrl?: string;
126
- [key: string]: unknown;
127
- }
128
-
129
- export interface ClassifiedItemNormalized {
130
- id: string;
131
- _id: ObjectID;
132
- collection: "classifieds";
133
- name: string;
134
- section: ClassifiedSection;
135
- category: ClassifiedCategory;
136
- subtype: ClassifiedSubcat;
137
- created?: Date;
138
- updated?: Date;
139
- modified?: Date;
140
- parent?: ParentsMap;
141
- description?: string;
142
- slug?: string;
143
- address?: PostalAddress;
144
- geo?: GeoCoordinates;
145
- geoPosition?: GeoPosition;
146
- tags?: string[];
147
- creator?: string;
148
- profilImageUrl?: string;
149
- profilMediumImageUrl?: string;
150
- profilThumbImageUrl?: string;
151
- [key: string]: unknown;
152
- }