@communecter/cocolight-api-client 1.0.155 → 1.0.157

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 (337) 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/Answer.d.ts +27 -9
  138. package/types/api/BaseEntity.d.ts +77 -0
  139. package/types/api/EndpointApi.d.ts +51 -3
  140. package/types/api/EndpointApi.types.d.ts +112 -1
  141. package/types/api/User.d.ts +20 -0
  142. package/types/costum/types.d.ts +0 -2
  143. package/types/endpoints.module.d.ts +3039 -1009
  144. package/types/index.d.ts +1 -0
  145. package/types/utils/OfflineClientManager.d.ts +8 -0
  146. package/types/utils/adminImportExport.d.ts +29 -0
  147. package/dist/1035.cocolight-api-client.mjs.js +0 -1
  148. package/dist/1483.cocolight-api-client.mjs.js +0 -1
  149. package/dist/1491.cocolight-api-client.mjs.js +0 -1
  150. package/dist/1494.cocolight-api-client.mjs.js +0 -1
  151. package/dist/1641.cocolight-api-client.mjs.js +0 -1
  152. package/dist/1678.cocolight-api-client.mjs.js +0 -1
  153. package/dist/2041.cocolight-api-client.mjs.js +0 -1
  154. package/dist/2302.cocolight-api-client.mjs.js +0 -1
  155. package/dist/2313.cocolight-api-client.mjs.js +0 -1
  156. package/dist/2379.cocolight-api-client.mjs.js +0 -1
  157. package/dist/2439.cocolight-api-client.mjs.js +0 -1
  158. package/dist/2594.cocolight-api-client.mjs.js +0 -1
  159. package/dist/2766.cocolight-api-client.mjs.js +0 -1
  160. package/dist/2812.cocolight-api-client.mjs.js +0 -1
  161. package/dist/2918.cocolight-api-client.mjs.js +0 -1
  162. package/dist/3028.cocolight-api-client.mjs.js +0 -1
  163. package/dist/3330.cocolight-api-client.mjs.js +0 -1
  164. package/dist/3371.cocolight-api-client.mjs.js +0 -1
  165. package/dist/3401.cocolight-api-client.mjs.js +0 -1
  166. package/dist/3516.cocolight-api-client.mjs.js +0 -1
  167. package/dist/3593.cocolight-api-client.mjs.js +0 -1
  168. package/dist/3764.cocolight-api-client.mjs.js +0 -1
  169. package/dist/3873.cocolight-api-client.mjs.js +0 -1
  170. package/dist/3911.cocolight-api-client.mjs.js +0 -1
  171. package/dist/4031.cocolight-api-client.mjs.js +0 -1
  172. package/dist/4152.cocolight-api-client.mjs.js +0 -1
  173. package/dist/4203.cocolight-api-client.mjs.js +0 -1
  174. package/dist/424.cocolight-api-client.mjs.js +0 -1
  175. package/dist/435.cocolight-api-client.mjs.js +0 -1
  176. package/dist/4402.cocolight-api-client.mjs.js +0 -1
  177. package/dist/4425.cocolight-api-client.mjs.js +0 -1
  178. package/dist/4472.cocolight-api-client.mjs.js +0 -1
  179. package/dist/4914.cocolight-api-client.mjs.js +0 -1
  180. package/dist/4959.cocolight-api-client.mjs.js +0 -1
  181. package/dist/5100.cocolight-api-client.mjs.js +0 -1
  182. package/dist/5111.cocolight-api-client.mjs.js +0 -1
  183. package/dist/5286.cocolight-api-client.mjs.js +0 -1
  184. package/dist/5380.cocolight-api-client.mjs.js +0 -1
  185. package/dist/5383.cocolight-api-client.mjs.js +0 -1
  186. package/dist/5480.cocolight-api-client.mjs.js +0 -1
  187. package/dist/5541.cocolight-api-client.mjs.js +0 -1
  188. package/dist/5839.cocolight-api-client.mjs.js +0 -1
  189. package/dist/5862.cocolight-api-client.mjs.js +0 -1
  190. package/dist/5869.cocolight-api-client.mjs.js +0 -1
  191. package/dist/588.cocolight-api-client.mjs.js +0 -1
  192. package/dist/601.cocolight-api-client.mjs.js +0 -1
  193. package/dist/6012.cocolight-api-client.mjs.js +0 -1
  194. package/dist/6200.cocolight-api-client.mjs.js +0 -1
  195. package/dist/6369.cocolight-api-client.mjs.js +0 -1
  196. package/dist/7009.cocolight-api-client.mjs.js +0 -1
  197. package/dist/725.cocolight-api-client.mjs.js +0 -1
  198. package/dist/7339.cocolight-api-client.mjs.js +0 -1
  199. package/dist/7398.cocolight-api-client.mjs.js +0 -1
  200. package/dist/7888.cocolight-api-client.mjs.js +0 -1
  201. package/dist/7975.cocolight-api-client.mjs.js +0 -1
  202. package/dist/809.cocolight-api-client.mjs.js +0 -1
  203. package/dist/8300.cocolight-api-client.mjs.js +0 -1
  204. package/dist/8317.cocolight-api-client.mjs.js +0 -1
  205. package/dist/8525.cocolight-api-client.mjs.js +0 -1
  206. package/dist/8894.cocolight-api-client.mjs.js +0 -1
  207. package/dist/9301.cocolight-api-client.mjs.js +0 -1
  208. package/dist/9438.cocolight-api-client.mjs.js +0 -1
  209. package/dist/9478.cocolight-api-client.mjs.js +0 -1
  210. package/dist/9568.cocolight-api-client.mjs.js +0 -1
  211. package/dist/cocolight-api-client.mjs.js +0 -1
  212. package/src/Api.ts +0 -348
  213. package/src/ApiClient.ts +0 -1994
  214. package/src/EJSONType.ts +0 -103
  215. package/src/api/Action.ts +0 -665
  216. package/src/api/Answer.ts +0 -1392
  217. package/src/api/Badge.ts +0 -143
  218. package/src/api/BaseEntity.ts +0 -6384
  219. package/src/api/Classified.ts +0 -175
  220. package/src/api/Comment.ts +0 -280
  221. package/src/api/EndpointApi.ts +0 -2270
  222. package/src/api/EndpointApi.types.ts +0 -6566
  223. package/src/api/EntityRegistry.ts +0 -324
  224. package/src/api/Event.ts +0 -360
  225. package/src/api/Form.ts +0 -282
  226. package/src/api/News.ts +0 -547
  227. package/src/api/Notifications.ts +0 -196
  228. package/src/api/Organization.ts +0 -771
  229. package/src/api/Poi.ts +0 -242
  230. package/src/api/Project.ts +0 -545
  231. package/src/api/User.ts +0 -1889
  232. package/src/api/UserApi.ts +0 -192
  233. package/src/api/serverDataType/Action.ts +0 -177
  234. package/src/api/serverDataType/Answer.ts +0 -106
  235. package/src/api/serverDataType/Classified.ts +0 -152
  236. package/src/api/serverDataType/Comment.ts +0 -88
  237. package/src/api/serverDataType/Country.ts +0 -1
  238. package/src/api/serverDataType/Event.ts +0 -112
  239. package/src/api/serverDataType/Form.ts +0 -157
  240. package/src/api/serverDataType/News.ts +0 -138
  241. package/src/api/serverDataType/Notification.ts +0 -81
  242. package/src/api/serverDataType/Organization.ts +0 -111
  243. package/src/api/serverDataType/Poi.ts +0 -75
  244. package/src/api/serverDataType/Project.ts +0 -115
  245. package/src/api/serverDataType/User.ts +0 -112
  246. package/src/api/serverDataType/Zone.ts +0 -33
  247. package/src/api/serverDataType/common.ts +0 -84
  248. package/src/costum/normalize.ts +0 -7
  249. package/src/costum/registry.ts +0 -138
  250. package/src/costum/runtime-map.ts +0 -221
  251. package/src/costum/runtime.ts +0 -274
  252. package/src/costum/schemas/CercleTravailleursSociauxLiberauxLaPlumeSociale.ts +0 -19
  253. package/src/costum/schemas/FabEn.ts +0 -19
  254. package/src/costum/schemas/LivingLabInnovationSocialeBraspanon.ts +0 -19
  255. package/src/costum/schemas/alfph.ts +0 -27
  256. package/src/costum/schemas/campagne.ts +0 -19
  257. package/src/costum/schemas/chtitube.ts +0 -19
  258. package/src/costum/schemas/circuitCourt.ts +0 -19
  259. package/src/costum/schemas/cmcasHauteBretagne.ts +0 -19
  260. package/src/costum/schemas/coFinancementTierslieux.ts +0 -27
  261. package/src/costum/schemas/coeurNumerique.ts +0 -19
  262. package/src/costum/schemas/communLundi.ts +0 -19
  263. package/src/costum/schemas/cressReunion.ts +0 -35
  264. package/src/costum/schemas/cressReunionNetwork.ts +0 -35
  265. package/src/costum/schemas/ctenat.ts +0 -43
  266. package/src/costum/schemas/cyberReunion.ts +0 -19
  267. package/src/costum/schemas/ekisphere.ts +0 -35
  268. package/src/costum/schemas/equipementsSportifs974.ts +0 -19
  269. package/src/costum/schemas/federationDesCae.ts +0 -19
  270. package/src/costum/schemas/formationGenerique.ts +0 -35
  271. package/src/costum/schemas/franceTierslieux.ts +0 -19
  272. package/src/costum/schemas/hinaura.ts +0 -27
  273. package/src/costum/schemas/hubmayotte.ts +0 -19
  274. package/src/costum/schemas/hubnouvellecaledonie.ts +0 -19
  275. package/src/costum/schemas/hubpolynesiefrancaise.ts +0 -19
  276. package/src/costum/schemas/hubreunion.ts +0 -19
  277. package/src/costum/schemas/hubterritoires.ts +0 -19
  278. package/src/costum/schemas/hubwallisetfutuna.ts +0 -19
  279. package/src/costum/schemas/hva.ts +0 -27
  280. package/src/costum/schemas/ibv2.ts +0 -19
  281. package/src/costum/schemas/institutBleu.ts +0 -19
  282. package/src/costum/schemas/journalInsoumisChambery.ts +0 -27
  283. package/src/costum/schemas/kpacite.ts +0 -19
  284. package/src/costum/schemas/laCompagnieDesTierslieux.ts +0 -43
  285. package/src/costum/schemas/laMaisonDesFaiseurs.ts +0 -19
  286. package/src/costum/schemas/laReunionPourUnNumeriqueInclusif.ts +0 -19
  287. package/src/costum/schemas/laSemaineDesTierslieux.ts +0 -19
  288. package/src/costum/schemas/labEnCommuns.ts +0 -19
  289. package/src/costum/schemas/lakou.ts +0 -27
  290. package/src/costum/schemas/lesCommunsDesTierslieux.ts +0 -19
  291. package/src/costum/schemas/mayottePourUnNumeriqueInclusif.ts +0 -19
  292. package/src/costum/schemas/meir.ts +0 -27
  293. package/src/costum/schemas/navigatorDesTierslieux.ts +0 -19
  294. package/src/costum/schemas/notragora.ts +0 -27
  295. package/src/costum/schemas/nouvellecaledoniePourUnNumeriqueInclusif.ts +0 -19
  296. package/src/costum/schemas/openAtlas.ts +0 -19
  297. package/src/costum/schemas/polynesieFrancaisePourUnNumeriqueInclusif.ts +0 -19
  298. package/src/costum/schemas/prdr.ts +0 -19
  299. package/src/costum/schemas/reseauTierslieux.ts +0 -19
  300. package/src/costum/schemas/rfflabs.ts +0 -19
  301. package/src/costum/schemas/ries.ts +0 -19
  302. package/src/costum/schemas/siteDuPactePourLaTransition.ts +0 -27
  303. package/src/costum/schemas/sportSanteBienetre.ts +0 -43
  304. package/src/costum/schemas/suppa.ts +0 -19
  305. package/src/costum/schemas/terramies.ts +0 -19
  306. package/src/costum/schemas/testeTplFormation.ts +0 -35
  307. package/src/costum/schemas/tierslieuxbelgique.ts +0 -19
  308. package/src/costum/schemas/tierslieuxorg1.ts +0 -35
  309. package/src/costum/schemas/transiter.ts +0 -35
  310. package/src/costum/schemas/vhelioPeiTour2025.ts +0 -19
  311. package/src/costum/schemas/wallisetfutunaPourUnNumeriqueInclusif.ts +0 -19
  312. package/src/costum/symbol.ts +0 -26
  313. package/src/costum/types.ts +0 -895
  314. package/src/endpoints.module.ts +0 -4253
  315. package/src/error.ts +0 -86
  316. package/src/forms/entityForm.ts +0 -142
  317. package/src/index.ts +0 -161
  318. package/src/mixin/UserMixin.ts +0 -4
  319. package/src/types/api-responses.ts +0 -217
  320. package/src/types/entities.ts +0 -58
  321. package/src/types/error-guards.ts +0 -230
  322. package/src/types/index.ts +0 -41
  323. package/src/types/payloads.ts +0 -21
  324. package/src/types/transforms.ts +0 -119
  325. package/src/utils/FileOfflineStorageStrategy.node.ts +0 -50
  326. package/src/utils/FileStorageStrategy.node.ts +0 -63
  327. package/src/utils/MultiServerFileStorageStrategy.node.ts +0 -67
  328. package/src/utils/MultiServerTokenStorageStrategy.ts +0 -139
  329. package/src/utils/OfflineClientManager.ts +0 -216
  330. package/src/utils/OfflineQueueStorageStrategy.ts +0 -47
  331. package/src/utils/TokenStorage.ts +0 -77
  332. package/src/utils/compat.ts +0 -12
  333. package/src/utils/createDefaultMultiServerTokenStorageStrategy.ts +0 -35
  334. package/src/utils/createDefaultOfflineStrategy.ts +0 -34
  335. package/src/utils/createDefaultTokenStorageStrategy.ts +0 -33
  336. package/src/utils/reactive.ts +0 -243
  337. package/src/utils/stream-utils.node.ts +0 -12
@@ -1,175 +0,0 @@
1
- import { ApiError } from "../error.js";
2
- import { BaseEntity } from "./BaseEntity.js";
3
- import { transformEntityRefs } from "../types/transforms.js";
4
-
5
- import type { AddClassifiedData } from "./EndpointApi.types.js";
6
- import type { ClassifiedItemNormalized } from "./serverDataType/Classified.js";
7
-
8
- export class Classified extends BaseEntity<ClassifiedItemNormalized> {
9
- static override entityType = "classifieds";
10
-
11
- static override entityTag = "Classified";
12
-
13
- static override SCHEMA_CONSTANTS: string[] = [
14
- "ADD_CLASSIFIED",
15
- ];
16
-
17
- static ADD_BLOCKS = new Map([
18
- ["ADD_CLASSIFIED", "addClassified"],
19
- ] as const);
20
-
21
- override defaultFields: Record<string, unknown> = {
22
- typeElement: "classified",
23
- };
24
-
25
- override removeFields: string[] = [
26
- "typeElement",
27
- ];
28
-
29
- // Le serveur enrichit `parent` avec _id/slug/id/profilThumbImageUrl/etc.
30
- // qui ne sont pas dans le schéma d'envoi (additionalProperties: false → name, type seuls).
31
- // On filtre via transformEntityRefs à la construction du draft pour rester compatible
32
- // côté update (pattern identique à Event.transforms).
33
- override transforms: Record<string, (val: any, full?: any) => any> = {
34
- parent: transformEntityRefs,
35
- };
36
-
37
- override _add = async (payload: Record<string, unknown>): Promise<void> => {
38
- if (!this._calledFromSave) {
39
- throw new ApiError("utilisation invalide de _add, utilisez save", 400);
40
- }
41
-
42
- payload.id = this._newId?.();
43
- // if (payload.slug) delete payload.slug;
44
-
45
- for (const [constant, methodName] of Array.from(Classified.ADD_BLOCKS)) {
46
- const blockData = this._extractChangedFieldsFromSchema(
47
- this.apiClient,
48
- constant,
49
- { ...payload, ...this.defaultFields },
50
- () => {}
51
- );
52
- if (blockData && Object.keys(blockData).length > 0) {
53
- const data = await (this as any)[methodName](blockData);
54
- if (!this.id && data?.map?.id) {
55
- this._draftData.id = data.map.id;
56
- this._draftData.slug = data.map.slug;
57
- }
58
- }
59
- }
60
- };
61
-
62
- // L'endpoint /co2/element/save (ADD_CLASSIFIED) gère création ET mise à jour selon que
63
- // l'id existe ou pas côté serveur. On réutilise donc le même schéma pour valider les
64
- // champs en update (pattern identique à Event._update).
65
- // Droit de modifier : auteur du classified OU admin d'un parent (orga/projet) si le
66
- // classified est rattaché.
67
- override _update = async (payload: Record<string, unknown>): Promise<boolean> => {
68
- if (!this._calledFromSave) {
69
- throw new ApiError("utilisation invalide de _update, utilisez save", 400);
70
- }
71
- if (!this.isAuthor() && !this.isAdmin({ checkHierarchy: true })) {
72
- throw new ApiError("Vous n'êtes pas autorisé à modifier cette ressource", 403);
73
- }
74
-
75
- let hasChanged = false;
76
-
77
- const blockData = this._extractAllValidFieldsFromSchema(
78
- this.apiClient,
79
- "ADD_CLASSIFIED",
80
- { ...payload, ...this.defaultFields },
81
- () => this.initialDraftData,
82
- this.removeFields
83
- );
84
- if (blockData && Object.keys(blockData).length > 0) {
85
- await this.addClassified(blockData);
86
- hasChanged = true;
87
- }
88
-
89
- return hasChanged;
90
- };
91
-
92
- async addClassified(data: Partial<AddClassifiedData> = {}): Promise<unknown> {
93
- // Si le parent direct n'est pas l'utilisateur connecté (ex: création via une org),
94
- // on injecte le parent dans le payload. Sans ça, le default schéma `{ "@userId": ... }`
95
- // pose me comme parent — ce qui est faux pour `me.org().classified()`.
96
- // NB: this.isMe est trompeur ici car userContext propage jusqu'au User connecté
97
- // (donc isMe=true même quand le parent direct est une org).
98
- // Si le caller fournit déjà `data.parent`, on respecte sa valeur (pas de merge automatique).
99
- const parentData = data as Record<string, unknown>;
100
- if (this.parent && this.parent.id && this.parent.id !== this.userId && !parentData.parent) {
101
- parentData.parent = {};
102
- const parentMap = parentData.parent as Record<string, unknown>;
103
- parentMap[`${this.parent.id}`] = {
104
- type: this.parent.getEntityType(),
105
- name: (this.parent as unknown as Record<string, unknown>).name,
106
- };
107
- }
108
-
109
- return this.callIsConnected(() => this.endpointApi.addClassified(data as AddClassifiedData));
110
- }
111
-
112
- override async getOrganizations(): Promise<never> {
113
- throw new ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`, 501);
114
- }
115
-
116
- override async getProjects(): Promise<never> {
117
- throw new ApiError(`getProjects n'existe pas dans ${this.constructor.name}`, 501);
118
- }
119
-
120
- override async getEvents(): Promise<never> {
121
- throw new ApiError(`getEvents n'existe pas dans ${this.constructor.name}`, 501);
122
- }
123
-
124
- override async getPois(): Promise<never> {
125
- throw new ApiError(`getPois n'existe pas dans ${this.constructor.name}`, 501);
126
- }
127
-
128
- override async getBadgesIssuer(): Promise<never> {
129
- throw new ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`, 501);
130
- }
131
-
132
- override async getNews(): Promise<never> {
133
- throw new ApiError(`getNews n'existe pas dans ${this.constructor.name}`, 501);
134
- }
135
-
136
- override async project(): Promise<never> {
137
- throw new ApiError(`project n'existe pas dans ${this.constructor.name}`, 501);
138
- }
139
-
140
- override async poi(): Promise<never> {
141
- throw new ApiError(`poi n'existe pas dans ${this.constructor.name}`, 501);
142
- }
143
-
144
- override async event(): Promise<never> {
145
- throw new ApiError(`event n'existe pas dans ${this.constructor.name}`, 501);
146
- }
147
-
148
- override async badge(): Promise<never> {
149
- throw new ApiError(`badge n'existe pas dans ${this.constructor.name}`, 501);
150
- }
151
-
152
- override async news(): Promise<never> {
153
- throw new ApiError(`news n'existe pas dans ${this.constructor.name}`, 501);
154
- }
155
-
156
- override async classified(): Promise<never> {
157
- throw new ApiError(`classified n'existe pas dans ${this.constructor.name}`, 501);
158
- }
159
-
160
- override async form(): Promise<never> {
161
- throw new ApiError(`form n'existe pas dans ${this.constructor.name}`, 501);
162
- }
163
-
164
- override async follow(): Promise<never> {
165
- throw new ApiError(`follow n'existe pas dans ${this.constructor.name}`, 501);
166
- }
167
-
168
- override async unfollow(): Promise<never> {
169
- throw new ApiError(`unfollow n'existe pas dans ${this.constructor.name}`, 501);
170
- }
171
-
172
- override async getGallery(): Promise<never> {
173
- throw new ApiError(`getGallery n'existe pas dans ${this.constructor.name}`, 501);
174
- }
175
- }
@@ -1,280 +0,0 @@
1
- import { ApiError } from "../error.js";
2
- import { BaseEntity } from "./BaseEntity.js";
3
-
4
- import type { AddCommentsData, AddReportAbuseData, AddVoteData, DeleteCommentsData, ShowVoteData, UpdateCommentsData } from "./EndpointApi.types.js";
5
- import type { CommentItemNormalized } from "./serverDataType/Comment.js";
6
-
7
- export class Comment extends BaseEntity<CommentItemNormalized> {
8
- static override entityType = "comments";
9
-
10
- static override entityTag = "Comment";
11
-
12
- static override SCHEMA_CONSTANTS: string[] = [
13
- "ADD_COMMENTS"
14
- ];
15
-
16
- static ADD_BLOCKS = new Map([
17
- ["ADD_COMMENTS", "addComments"]
18
- ] as const);
19
-
20
- static UPDATE_BLOCKS = new Map([
21
- ["ADD_COMMENTS", "updateComments"]
22
- ] as const);
23
-
24
- override defaultFields: Record<string, any> = {};
25
-
26
- override removeFields: string[] = ["contextId", "contextType", "parentCommentId", "argval"];
27
-
28
- /**
29
- * Transforme les champs imbriqués (author) en instances d'entités.
30
- * @param data - Les données brutes du serveur.
31
- * @returns Les données transformées.
32
- * @protected
33
- */
34
- protected override _transformServerData(data: CommentItemNormalized): CommentItemNormalized {
35
- // Transformer author en instance User/Organization
36
- if (data.author) {
37
- data.author = this._linkNestedEntity(data.author);
38
- }
39
-
40
- if (Array.isArray(data.replies)) {
41
- data.replies = data.replies.map(reply => {
42
- // Ajouter les propriétés nécessaires pour _linkNestedEntity
43
- if (reply && typeof reply === "object" && !reply.type) {
44
- reply.type = "comments";
45
- reply.collection = "comments";
46
- }
47
- return this._linkNestedEntity(reply);
48
- });
49
- }
50
-
51
- return data;
52
- }
53
-
54
- override async get(): Promise<never> {
55
- throw new ApiError(`get n'existe pas dans ${this.constructor.name}`, 501);
56
- }
57
-
58
- override async save(): Promise<Record<string, any>> {
59
- // Pour les commentaires, on ne peut pas refresh après save
60
- // car il n'y a pas d'endpoint GET_COMMENT
61
- const originalRefresh = this.refresh;
62
- this.refresh = async () => this._serverData; // No-op
63
-
64
- try {
65
- return await super.save();
66
- } finally {
67
- this.refresh = originalRefresh;
68
- }
69
- }
70
-
71
- override _add = async (payload: Record<string, any>): Promise<void> => {
72
- if (!this._calledFromSave) {
73
- throw new Error("utilisation invalide de _add, utilisez save");
74
- }
75
-
76
- if(!this.parent?.id){
77
- throw new Error("Le parent doit être défini pour ajouter un commentaire.");
78
- }
79
-
80
- if(payload.text === ""){
81
- payload.text = " ";
82
- }
83
-
84
- // Si le parent est un Comment, on met son ID dans parentCommentId
85
- if(this.parent.getEntityType() === "comments"){
86
- payload.parentCommentId = this.parent.id;
87
- // Le contextId et contextType doivent pointer vers l'entité racine (news, etc.)
88
- // Il faut remonter jusqu'à trouver le parent qui n'est pas un commentaire
89
- let rootParent = this.parent.parent;
90
- while(rootParent && rootParent.getEntityType && rootParent.getEntityType() === "comments"){
91
- rootParent = rootParent.parent;
92
- }
93
- if(rootParent){
94
- payload.contextId = rootParent.id;
95
- payload.contextType = rootParent.getEntityType();
96
- } else {
97
- throw new Error("Impossible de trouver l'entité racine pour le commentaire.");
98
- }
99
- } else {
100
- // bug doit mettre une chaîne vide si pas de parentCommentId car dans getComments il y a un bug sur l'api dans la requete
101
- payload.parentCommentId = payload.parentCommentId || "";
102
- payload.contextId = this.parent.id;
103
- payload.contextType = this.parent.getEntityType();
104
- }
105
-
106
-
107
- for (const [constant, methodName] of Array.from(Comment.ADD_BLOCKS)) {
108
- const blockData = this._extractChangedFieldsFromSchema(
109
- this.apiClient,
110
- constant,
111
- { ...payload, ...this.defaultFields },
112
- () => {},
113
- []
114
- );
115
-
116
- if (blockData && Object.keys(blockData).length > 0) {
117
- const data = await this._invokeBlockMethod(Comment.ADD_BLOCKS, methodName, blockData);
118
- // L'API retourne l'ID soit dans data.object.id, soit dans data.id
119
- const responseId = data?.object?.id || data?.id?.$id || data?.id;
120
- if (!this.id && responseId) {
121
- this._draftData.id = responseId;
122
- this._setData(data.newComment as any, { forceInitialDraftReset: true });
123
- }
124
- }
125
- }
126
- };
127
-
128
- override _update = async (payload: Record<string, any>): Promise<boolean> => {
129
- if (!this._calledFromSave) {
130
- throw new Error("utilisation invalide de _update, utilisez save");
131
- }
132
-
133
- if(!this.parent?.id){
134
- throw new Error("Le parent doit être défini pour ajouter un commentaire.");
135
- }
136
-
137
- // si le texte est vide, on met un espace pour que le champ soit pris en compte car sur le serveur
138
- // il y a une vérification de la taille du texte je pense
139
- if(payload?.text === ""){
140
- payload.text = " ";
141
- }
142
-
143
- payload.params = {
144
- text: payload.text
145
- };
146
-
147
- delete payload.text;
148
-
149
- let hasChanged = false;
150
- const data = await this.callIsConnected(() => this.endpointApi.updateComments(payload as UpdateCommentsData)) as any;
151
- if(data?.comment){
152
- this._setData(data.comment as any, { forceInitialDraftReset: true });
153
- }
154
- hasChanged = true;
155
- return hasChanged;
156
- };
157
-
158
- async addComments(data: Partial<AddCommentsData> = {}): Promise<unknown> {
159
- return this.callIsConnected(() => this.endpointApi.addComments(data as AddCommentsData));
160
- }
161
-
162
- async updateComments(data: Partial<UpdateCommentsData> = {}): Promise<unknown> {
163
- return this.callIsConnected(() => this.endpointApi.updateComments(data as UpdateCommentsData));
164
- }
165
-
166
- /**
167
- * Supprimer un commentaire : Supprime un commentaire existant.
168
- * Constant : DELETE_COMMENT
169
- */
170
- async delete(): Promise<void> {
171
- if(!this.id) {
172
- throw new ApiError("Vous devez fournir un id pour supprimer un commentaire.", 400);
173
- }
174
- const data = {
175
- pathParams: { id: this.id },
176
- };
177
- await this.callIsConnected(() => this.endpointApi.deleteComments(data as DeleteCommentsData));
178
-
179
- // Vider les objets réactifs sans casser la réactivité
180
- Object.keys(this._draftData).forEach(key => delete this._draftData[key]);
181
- Object.keys(this._serverData).forEach(key => delete (this._serverData as any)[key]);
182
-
183
- // Marquer comme supprimé
184
- this._isDeleted = true;
185
- }
186
-
187
- /**
188
- * Créer une réponse à ce commentaire (commentaire sur commentaire).
189
- * @param commentData - Données du commentaire.
190
- * @returns Instance de Comment.
191
- */
192
- async comment(commentData: Record<string, any> = {}): Promise<Comment> {
193
- if(!this.isConnected){
194
- throw new ApiError("Vous devez être connecté.", 401);
195
- }
196
-
197
- const entity = await this.entity("comments", commentData);
198
- return entity as Comment;
199
- }
200
-
201
- /**
202
- * Ajoute un vote sur ce commentaire
203
- *
204
- * @param status - Statut du vote (ex: 'like', 'dislike', 'love', etc.)
205
- * @returns Promise contenant la réponse de l'API après l'ajout du vote
206
- * @throws {ApiError} Si la news n'a pas d'ID (non enregistrée)
207
- */
208
- async addVote(status: string){
209
- if (!this.id) {
210
- throw new ApiError(`${this.constructor.name} non enregistrée.`, 404);
211
- }
212
-
213
- const payload: AddVoteData = {
214
- collection: "comments",
215
- id: this.id,
216
- action: "vote",
217
- details: {
218
- status
219
- }
220
- };
221
-
222
- return await this.callIsConnected(() => this.endpointApi.addVote(payload));
223
- }
224
-
225
- /**
226
- * Récupère la liste des votes (like, love, etc.) sur ce commentaire.
227
- *
228
- * Wrap de `SHOW_VOTE` avec auto-injection du `type` (`"comments"`) et de
229
- * `this.id` dans `pathParams`. Le retour contient `vote` (votes individuels
230
- * indexés par userId) et `voteCount` (compteurs par statut).
231
- *
232
- * @returns Réponse API : `{ _id, vote, voteCount }` ou variante d'erreur.
233
- * @throws {ApiError} 404 si le commentaire n'a pas d'id (non enregistré).
234
- *
235
- * @example
236
- * const votes = await comment.getVotes();
237
- * votes.voteCount?.like; // nombre de likes
238
- * votes.vote?.[userId]; // vote détaillé d'un user
239
- */
240
- async getVotes(): Promise<unknown> {
241
- if (!this.id) {
242
- throw new ApiError(`${this.constructor.name} non enregistré.`, 404);
243
- }
244
- const payload: ShowVoteData = {
245
- pathParams: { type: "comments", id: this.id },
246
- };
247
- return this.endpointApi.showVote(payload);
248
- }
249
-
250
- /**
251
- * Signale un abus sur ce commentaire
252
- *
253
- * @param params - Paramètres du signalement
254
- * @param params.reason - Raison du signalement
255
- * @param params.comment - Commentaire expliquant le signalement (optionnel)
256
- * @returns Promise contenant la réponse de l'API après le signalement
257
- * @throws {ApiError} Si la news n'a pas d'ID (non enregistrée)
258
- */
259
- async addReportAbuse({ reason, comment }: { reason: string, comment?: string}){
260
- if (!this.id) {
261
- throw new ApiError(`${this.constructor.name} non enregistrée.`, 404);
262
- }
263
-
264
- const payload: AddReportAbuseData = {
265
- collection: "comments",
266
- id: this.id,
267
- action: "reportAbuse",
268
- details: {
269
- reason,
270
- comment
271
- }
272
- };
273
-
274
- return await this.callIsConnected(() => this.endpointApi.addReportAbuse(payload));
275
- }
276
-
277
- override async form(): Promise<never> {
278
- throw new ApiError(`form n'existe pas dans ${this.constructor.name}`, 501);
279
- }
280
- }