@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.
- package/dist/1035.cocolight-api-client.browser.js +1 -1
- package/dist/1035.cocolight-api-client.cjs +1 -1
- package/dist/1483.cocolight-api-client.browser.js +1 -1
- package/dist/1483.cocolight-api-client.cjs +1 -1
- package/dist/1491.cocolight-api-client.browser.js +1 -1
- package/dist/1491.cocolight-api-client.cjs +1 -1
- package/dist/1494.cocolight-api-client.browser.js +1 -1
- package/dist/1494.cocolight-api-client.cjs +1 -1
- package/dist/1641.cocolight-api-client.browser.js +1 -1
- package/dist/1641.cocolight-api-client.cjs +1 -1
- package/dist/1678.cocolight-api-client.browser.js +1 -1
- package/dist/1678.cocolight-api-client.cjs +1 -1
- package/dist/2041.cocolight-api-client.browser.js +1 -1
- package/dist/2041.cocolight-api-client.cjs +1 -1
- package/dist/2302.cocolight-api-client.browser.js +1 -1
- package/dist/2302.cocolight-api-client.cjs +1 -1
- package/dist/2313.cocolight-api-client.browser.js +1 -1
- package/dist/2313.cocolight-api-client.cjs +1 -1
- package/dist/2379.cocolight-api-client.browser.js +1 -1
- package/dist/2379.cocolight-api-client.cjs +1 -1
- package/dist/2439.cocolight-api-client.browser.js +1 -1
- package/dist/2439.cocolight-api-client.cjs +1 -1
- package/dist/2594.cocolight-api-client.browser.js +1 -1
- package/dist/2594.cocolight-api-client.cjs +1 -1
- package/dist/2766.cocolight-api-client.browser.js +1 -1
- package/dist/2766.cocolight-api-client.cjs +1 -1
- package/dist/2812.cocolight-api-client.browser.js +1 -1
- package/dist/2812.cocolight-api-client.cjs +1 -1
- package/dist/2918.cocolight-api-client.browser.js +1 -1
- package/dist/2918.cocolight-api-client.cjs +1 -1
- package/dist/3028.cocolight-api-client.browser.js +1 -1
- package/dist/3028.cocolight-api-client.cjs +1 -1
- package/dist/3330.cocolight-api-client.browser.js +1 -1
- package/dist/3330.cocolight-api-client.cjs +1 -1
- package/dist/3371.cocolight-api-client.browser.js +1 -1
- package/dist/3371.cocolight-api-client.cjs +1 -1
- package/dist/3401.cocolight-api-client.browser.js +1 -1
- package/dist/3401.cocolight-api-client.cjs +1 -1
- package/dist/3516.cocolight-api-client.browser.js +1 -1
- package/dist/3516.cocolight-api-client.cjs +1 -1
- package/dist/3593.cocolight-api-client.browser.js +1 -1
- package/dist/3593.cocolight-api-client.cjs +1 -1
- package/dist/3764.cocolight-api-client.browser.js +1 -1
- package/dist/3764.cocolight-api-client.cjs +1 -1
- package/dist/3873.cocolight-api-client.browser.js +1 -1
- package/dist/3873.cocolight-api-client.cjs +1 -1
- package/dist/3911.cocolight-api-client.browser.js +1 -1
- package/dist/3911.cocolight-api-client.cjs +1 -1
- package/dist/4031.cocolight-api-client.browser.js +1 -1
- package/dist/4031.cocolight-api-client.cjs +1 -1
- package/dist/4152.cocolight-api-client.browser.js +1 -1
- package/dist/4152.cocolight-api-client.cjs +1 -1
- package/dist/4203.cocolight-api-client.browser.js +1 -1
- package/dist/4203.cocolight-api-client.cjs +1 -1
- package/dist/424.cocolight-api-client.browser.js +1 -1
- package/dist/424.cocolight-api-client.cjs +1 -1
- package/dist/435.cocolight-api-client.browser.js +1 -1
- package/dist/435.cocolight-api-client.cjs +1 -1
- package/dist/4402.cocolight-api-client.browser.js +1 -1
- package/dist/4402.cocolight-api-client.cjs +1 -1
- package/dist/4425.cocolight-api-client.browser.js +1 -1
- package/dist/4425.cocolight-api-client.cjs +1 -1
- package/dist/4472.cocolight-api-client.browser.js +1 -1
- package/dist/4472.cocolight-api-client.cjs +1 -1
- package/dist/4914.cocolight-api-client.browser.js +1 -1
- package/dist/4914.cocolight-api-client.cjs +1 -1
- package/dist/4959.cocolight-api-client.browser.js +1 -1
- package/dist/4959.cocolight-api-client.cjs +1 -1
- package/dist/5100.cocolight-api-client.browser.js +1 -1
- package/dist/5100.cocolight-api-client.cjs +1 -1
- package/dist/5111.cocolight-api-client.browser.js +1 -1
- package/dist/5111.cocolight-api-client.cjs +1 -1
- package/dist/5286.cocolight-api-client.browser.js +1 -1
- package/dist/5286.cocolight-api-client.cjs +1 -1
- package/dist/5380.cocolight-api-client.browser.js +1 -1
- package/dist/5380.cocolight-api-client.cjs +1 -1
- package/dist/5383.cocolight-api-client.browser.js +1 -1
- package/dist/5383.cocolight-api-client.cjs +1 -1
- package/dist/5480.cocolight-api-client.browser.js +1 -1
- package/dist/5480.cocolight-api-client.cjs +1 -1
- package/dist/5541.cocolight-api-client.browser.js +1 -1
- package/dist/5541.cocolight-api-client.cjs +1 -1
- package/dist/5839.cocolight-api-client.browser.js +1 -1
- package/dist/5839.cocolight-api-client.cjs +1 -1
- package/dist/5862.cocolight-api-client.browser.js +1 -1
- package/dist/5862.cocolight-api-client.cjs +1 -1
- package/dist/5869.cocolight-api-client.browser.js +1 -1
- package/dist/5869.cocolight-api-client.cjs +1 -1
- package/dist/588.cocolight-api-client.browser.js +1 -1
- package/dist/588.cocolight-api-client.cjs +1 -1
- package/dist/601.cocolight-api-client.browser.js +1 -1
- package/dist/601.cocolight-api-client.cjs +1 -1
- package/dist/6012.cocolight-api-client.browser.js +1 -1
- package/dist/6012.cocolight-api-client.cjs +1 -1
- package/dist/6200.cocolight-api-client.browser.js +1 -1
- package/dist/6200.cocolight-api-client.cjs +1 -1
- package/dist/6369.cocolight-api-client.browser.js +1 -1
- package/dist/6369.cocolight-api-client.cjs +1 -1
- package/dist/7009.cocolight-api-client.browser.js +1 -1
- package/dist/7009.cocolight-api-client.cjs +1 -1
- package/dist/725.cocolight-api-client.browser.js +1 -1
- package/dist/725.cocolight-api-client.cjs +1 -1
- package/dist/7320.cocolight-api-client.browser.js +1 -1
- package/dist/7339.cocolight-api-client.browser.js +1 -1
- package/dist/7339.cocolight-api-client.cjs +1 -1
- package/dist/7398.cocolight-api-client.browser.js +1 -1
- package/dist/7398.cocolight-api-client.cjs +1 -1
- package/dist/7888.cocolight-api-client.browser.js +1 -1
- package/dist/7888.cocolight-api-client.cjs +1 -1
- package/dist/7975.cocolight-api-client.browser.js +1 -1
- package/dist/7975.cocolight-api-client.cjs +1 -1
- package/dist/809.cocolight-api-client.browser.js +1 -1
- package/dist/809.cocolight-api-client.cjs +1 -1
- package/dist/8300.cocolight-api-client.browser.js +1 -1
- package/dist/8300.cocolight-api-client.cjs +1 -1
- package/dist/8317.cocolight-api-client.browser.js +1 -1
- package/dist/8317.cocolight-api-client.cjs +1 -1
- package/dist/8525.cocolight-api-client.browser.js +1 -1
- package/dist/8525.cocolight-api-client.cjs +1 -1
- package/dist/8894.cocolight-api-client.browser.js +1 -1
- package/dist/8894.cocolight-api-client.cjs +1 -1
- package/dist/9301.cocolight-api-client.browser.js +1 -1
- package/dist/9301.cocolight-api-client.cjs +1 -1
- package/dist/9438.cocolight-api-client.browser.js +1 -1
- package/dist/9438.cocolight-api-client.cjs +1 -1
- package/dist/9478.cocolight-api-client.browser.js +1 -1
- package/dist/9478.cocolight-api-client.cjs +1 -1
- package/dist/9568.cocolight-api-client.browser.js +1 -1
- package/dist/9568.cocolight-api-client.cjs +1 -1
- package/dist/cocolight-api-client.browser.js +6 -6
- package/dist/cocolight-api-client.cjs +1 -1
- package/dist/cocolight-api-client.vite.mjs.js +1 -1
- package/dist/cocolight-api-client.vite.mjs.js.map +1 -1
- package/package.json +7 -17
- package/types/Api.d.ts +1 -0
- package/types/ApiClient.d.ts +10 -1
- package/types/api/BaseEntity.d.ts +24 -0
- package/types/api/EndpointApi.d.ts +4 -4
- package/types/api/EndpointApi.types.d.ts +3 -3
- package/types/utils/OfflineClientManager.d.ts +8 -0
- package/dist/1035.cocolight-api-client.mjs.js +0 -1
- package/dist/1483.cocolight-api-client.mjs.js +0 -1
- package/dist/1491.cocolight-api-client.mjs.js +0 -1
- package/dist/1494.cocolight-api-client.mjs.js +0 -1
- package/dist/1641.cocolight-api-client.mjs.js +0 -1
- package/dist/1678.cocolight-api-client.mjs.js +0 -1
- package/dist/2041.cocolight-api-client.mjs.js +0 -1
- package/dist/2302.cocolight-api-client.mjs.js +0 -1
- package/dist/2313.cocolight-api-client.mjs.js +0 -1
- package/dist/2379.cocolight-api-client.mjs.js +0 -1
- package/dist/2439.cocolight-api-client.mjs.js +0 -1
- package/dist/2594.cocolight-api-client.mjs.js +0 -1
- package/dist/2766.cocolight-api-client.mjs.js +0 -1
- package/dist/2812.cocolight-api-client.mjs.js +0 -1
- package/dist/2918.cocolight-api-client.mjs.js +0 -1
- package/dist/3028.cocolight-api-client.mjs.js +0 -1
- package/dist/3330.cocolight-api-client.mjs.js +0 -1
- package/dist/3371.cocolight-api-client.mjs.js +0 -1
- package/dist/3401.cocolight-api-client.mjs.js +0 -1
- package/dist/3516.cocolight-api-client.mjs.js +0 -1
- package/dist/3593.cocolight-api-client.mjs.js +0 -1
- package/dist/3764.cocolight-api-client.mjs.js +0 -1
- package/dist/3873.cocolight-api-client.mjs.js +0 -1
- package/dist/3911.cocolight-api-client.mjs.js +0 -1
- package/dist/4031.cocolight-api-client.mjs.js +0 -1
- package/dist/4152.cocolight-api-client.mjs.js +0 -1
- package/dist/4203.cocolight-api-client.mjs.js +0 -1
- package/dist/424.cocolight-api-client.mjs.js +0 -1
- package/dist/435.cocolight-api-client.mjs.js +0 -1
- package/dist/4402.cocolight-api-client.mjs.js +0 -1
- package/dist/4425.cocolight-api-client.mjs.js +0 -1
- package/dist/4472.cocolight-api-client.mjs.js +0 -1
- package/dist/4914.cocolight-api-client.mjs.js +0 -1
- package/dist/4959.cocolight-api-client.mjs.js +0 -1
- package/dist/5100.cocolight-api-client.mjs.js +0 -1
- package/dist/5111.cocolight-api-client.mjs.js +0 -1
- package/dist/5286.cocolight-api-client.mjs.js +0 -1
- package/dist/5380.cocolight-api-client.mjs.js +0 -1
- package/dist/5383.cocolight-api-client.mjs.js +0 -1
- package/dist/5480.cocolight-api-client.mjs.js +0 -1
- package/dist/5541.cocolight-api-client.mjs.js +0 -1
- package/dist/5839.cocolight-api-client.mjs.js +0 -1
- package/dist/5862.cocolight-api-client.mjs.js +0 -1
- package/dist/5869.cocolight-api-client.mjs.js +0 -1
- package/dist/588.cocolight-api-client.mjs.js +0 -1
- package/dist/601.cocolight-api-client.mjs.js +0 -1
- package/dist/6012.cocolight-api-client.mjs.js +0 -1
- package/dist/6200.cocolight-api-client.mjs.js +0 -1
- package/dist/6369.cocolight-api-client.mjs.js +0 -1
- package/dist/7009.cocolight-api-client.mjs.js +0 -1
- package/dist/725.cocolight-api-client.mjs.js +0 -1
- package/dist/7339.cocolight-api-client.mjs.js +0 -1
- package/dist/7398.cocolight-api-client.mjs.js +0 -1
- package/dist/7888.cocolight-api-client.mjs.js +0 -1
- package/dist/7975.cocolight-api-client.mjs.js +0 -1
- package/dist/809.cocolight-api-client.mjs.js +0 -1
- package/dist/8300.cocolight-api-client.mjs.js +0 -1
- package/dist/8317.cocolight-api-client.mjs.js +0 -1
- package/dist/8525.cocolight-api-client.mjs.js +0 -1
- package/dist/8894.cocolight-api-client.mjs.js +0 -1
- package/dist/9301.cocolight-api-client.mjs.js +0 -1
- package/dist/9438.cocolight-api-client.mjs.js +0 -1
- package/dist/9478.cocolight-api-client.mjs.js +0 -1
- package/dist/9568.cocolight-api-client.mjs.js +0 -1
- package/dist/cocolight-api-client.mjs.js +0 -1
- package/src/Api.ts +0 -348
- package/src/ApiClient.ts +0 -1994
- package/src/EJSONType.ts +0 -103
- package/src/api/Action.ts +0 -665
- package/src/api/Answer.ts +0 -1392
- package/src/api/Badge.ts +0 -143
- package/src/api/BaseEntity.ts +0 -6338
- package/src/api/Classified.ts +0 -175
- package/src/api/Comment.ts +0 -280
- package/src/api/EndpointApi.ts +0 -2270
- package/src/api/EndpointApi.types.ts +0 -6566
- package/src/api/EntityRegistry.ts +0 -324
- package/src/api/Event.ts +0 -360
- package/src/api/Form.ts +0 -282
- package/src/api/News.ts +0 -547
- package/src/api/Notifications.ts +0 -196
- package/src/api/Organization.ts +0 -771
- package/src/api/Poi.ts +0 -242
- package/src/api/Project.ts +0 -545
- package/src/api/User.ts +0 -1889
- package/src/api/UserApi.ts +0 -192
- package/src/api/serverDataType/Action.ts +0 -177
- package/src/api/serverDataType/Answer.ts +0 -106
- package/src/api/serverDataType/Classified.ts +0 -152
- package/src/api/serverDataType/Comment.ts +0 -88
- package/src/api/serverDataType/Country.ts +0 -1
- package/src/api/serverDataType/Event.ts +0 -112
- package/src/api/serverDataType/Form.ts +0 -157
- package/src/api/serverDataType/News.ts +0 -138
- package/src/api/serverDataType/Notification.ts +0 -81
- package/src/api/serverDataType/Organization.ts +0 -111
- package/src/api/serverDataType/Poi.ts +0 -75
- package/src/api/serverDataType/Project.ts +0 -115
- package/src/api/serverDataType/User.ts +0 -112
- package/src/api/serverDataType/Zone.ts +0 -33
- package/src/api/serverDataType/common.ts +0 -84
- package/src/costum/normalize.ts +0 -7
- package/src/costum/registry.ts +0 -138
- package/src/costum/runtime-map.ts +0 -221
- package/src/costum/runtime.ts +0 -274
- package/src/costum/schemas/CercleTravailleursSociauxLiberauxLaPlumeSociale.ts +0 -19
- package/src/costum/schemas/FabEn.ts +0 -19
- package/src/costum/schemas/LivingLabInnovationSocialeBraspanon.ts +0 -19
- package/src/costum/schemas/alfph.ts +0 -27
- package/src/costum/schemas/campagne.ts +0 -19
- package/src/costum/schemas/chtitube.ts +0 -19
- package/src/costum/schemas/circuitCourt.ts +0 -19
- package/src/costum/schemas/cmcasHauteBretagne.ts +0 -19
- package/src/costum/schemas/coFinancementTierslieux.ts +0 -27
- package/src/costum/schemas/coeurNumerique.ts +0 -19
- package/src/costum/schemas/communLundi.ts +0 -19
- package/src/costum/schemas/cressReunion.ts +0 -35
- package/src/costum/schemas/cressReunionNetwork.ts +0 -35
- package/src/costum/schemas/ctenat.ts +0 -43
- package/src/costum/schemas/cyberReunion.ts +0 -19
- package/src/costum/schemas/ekisphere.ts +0 -35
- package/src/costum/schemas/equipementsSportifs974.ts +0 -19
- package/src/costum/schemas/federationDesCae.ts +0 -19
- package/src/costum/schemas/formationGenerique.ts +0 -35
- package/src/costum/schemas/franceTierslieux.ts +0 -19
- package/src/costum/schemas/hinaura.ts +0 -27
- package/src/costum/schemas/hubmayotte.ts +0 -19
- package/src/costum/schemas/hubnouvellecaledonie.ts +0 -19
- package/src/costum/schemas/hubpolynesiefrancaise.ts +0 -19
- package/src/costum/schemas/hubreunion.ts +0 -19
- package/src/costum/schemas/hubterritoires.ts +0 -19
- package/src/costum/schemas/hubwallisetfutuna.ts +0 -19
- package/src/costum/schemas/hva.ts +0 -27
- package/src/costum/schemas/ibv2.ts +0 -19
- package/src/costum/schemas/institutBleu.ts +0 -19
- package/src/costum/schemas/journalInsoumisChambery.ts +0 -27
- package/src/costum/schemas/kpacite.ts +0 -19
- package/src/costum/schemas/laCompagnieDesTierslieux.ts +0 -43
- package/src/costum/schemas/laMaisonDesFaiseurs.ts +0 -19
- package/src/costum/schemas/laReunionPourUnNumeriqueInclusif.ts +0 -19
- package/src/costum/schemas/laSemaineDesTierslieux.ts +0 -19
- package/src/costum/schemas/labEnCommuns.ts +0 -19
- package/src/costum/schemas/lakou.ts +0 -27
- package/src/costum/schemas/lesCommunsDesTierslieux.ts +0 -19
- package/src/costum/schemas/mayottePourUnNumeriqueInclusif.ts +0 -19
- package/src/costum/schemas/meir.ts +0 -27
- package/src/costum/schemas/navigatorDesTierslieux.ts +0 -19
- package/src/costum/schemas/notragora.ts +0 -27
- package/src/costum/schemas/nouvellecaledoniePourUnNumeriqueInclusif.ts +0 -19
- package/src/costum/schemas/openAtlas.ts +0 -19
- package/src/costum/schemas/polynesieFrancaisePourUnNumeriqueInclusif.ts +0 -19
- package/src/costum/schemas/prdr.ts +0 -19
- package/src/costum/schemas/reseauTierslieux.ts +0 -19
- package/src/costum/schemas/rfflabs.ts +0 -19
- package/src/costum/schemas/ries.ts +0 -19
- package/src/costum/schemas/siteDuPactePourLaTransition.ts +0 -27
- package/src/costum/schemas/sportSanteBienetre.ts +0 -43
- package/src/costum/schemas/suppa.ts +0 -19
- package/src/costum/schemas/terramies.ts +0 -19
- package/src/costum/schemas/testeTplFormation.ts +0 -35
- package/src/costum/schemas/tierslieuxbelgique.ts +0 -19
- package/src/costum/schemas/tierslieuxorg1.ts +0 -35
- package/src/costum/schemas/transiter.ts +0 -35
- package/src/costum/schemas/vhelioPeiTour2025.ts +0 -19
- package/src/costum/schemas/wallisetfutunaPourUnNumeriqueInclusif.ts +0 -19
- package/src/costum/symbol.ts +0 -26
- package/src/costum/types.ts +0 -895
- package/src/endpoints.module.ts +0 -4253
- package/src/error.ts +0 -86
- package/src/forms/entityForm.ts +0 -142
- package/src/index.ts +0 -161
- package/src/mixin/UserMixin.ts +0 -4
- package/src/types/api-responses.ts +0 -217
- package/src/types/entities.ts +0 -58
- package/src/types/error-guards.ts +0 -230
- package/src/types/index.ts +0 -41
- package/src/types/payloads.ts +0 -21
- package/src/types/transforms.ts +0 -119
- package/src/utils/FileOfflineStorageStrategy.node.ts +0 -50
- package/src/utils/FileStorageStrategy.node.ts +0 -63
- package/src/utils/MultiServerFileStorageStrategy.node.ts +0 -67
- package/src/utils/MultiServerTokenStorageStrategy.ts +0 -139
- package/src/utils/OfflineClientManager.ts +0 -216
- package/src/utils/OfflineQueueStorageStrategy.ts +0 -47
- package/src/utils/TokenStorage.ts +0 -77
- package/src/utils/compat.ts +0 -12
- package/src/utils/createDefaultMultiServerTokenStorageStrategy.ts +0 -35
- package/src/utils/createDefaultOfflineStrategy.ts +0 -34
- package/src/utils/createDefaultTokenStorageStrategy.ts +0 -33
- package/src/utils/reactive.ts +0 -243
- package/src/utils/stream-utils.node.ts +0 -12
package/src/error.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type générique pour les détails d'erreur bruts
|
|
3
|
-
*/
|
|
4
|
-
export type GenericErrorDetails = Record<string, any>;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Classe de base pour toutes les erreurs de l'API.
|
|
8
|
-
*/
|
|
9
|
-
export class ApiError extends Error {
|
|
10
|
-
public override readonly name: string = "ApiError";
|
|
11
|
-
public readonly status: number;
|
|
12
|
-
public readonly details?: GenericErrorDetails;
|
|
13
|
-
|
|
14
|
-
constructor(message: string, status: number, details?: GenericErrorDetails) {
|
|
15
|
-
super(message);
|
|
16
|
-
this.status = status;
|
|
17
|
-
this.details = details;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Erreur levée par le client API lorsqu'un appel échoue (réseau, config, etc.).
|
|
23
|
-
*/
|
|
24
|
-
export class ApiClientError extends ApiError {
|
|
25
|
-
public override readonly name: string = "ApiClientError";
|
|
26
|
-
|
|
27
|
-
constructor(message: string, status: number, details?: GenericErrorDetails) {
|
|
28
|
-
super(message, status, details);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Erreur de validation AJV (schemas de requête/réponse).
|
|
34
|
-
*/
|
|
35
|
-
export class ApiValidationError extends Error {
|
|
36
|
-
public override readonly name: string = "ApiValidationError";
|
|
37
|
-
public readonly status: number;
|
|
38
|
-
public readonly messages: string[];
|
|
39
|
-
public readonly details: any;
|
|
40
|
-
|
|
41
|
-
constructor(message: string, status: number, messages: string[], details: any = null) {
|
|
42
|
-
super(message);
|
|
43
|
-
this.status = status;
|
|
44
|
-
this.messages = messages;
|
|
45
|
-
this.details = details;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Levée lorsqu'on bloque l'accès à l'API (circuit breaker).
|
|
51
|
-
*/
|
|
52
|
-
export class CircuitBreakerError extends ApiError {
|
|
53
|
-
public override readonly name: string = "CircuitBreakerError";
|
|
54
|
-
|
|
55
|
-
constructor(message: string) {
|
|
56
|
-
super(message, 503);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Erreur "métier" retour de l'API (ex: result=false) même si HTTP=200.
|
|
62
|
-
*/
|
|
63
|
-
export class ApiResponseError extends Error {
|
|
64
|
-
public override readonly name: string = "ApiResponseError";
|
|
65
|
-
public readonly status: number;
|
|
66
|
-
public readonly responseData: object;
|
|
67
|
-
public readonly details: any;
|
|
68
|
-
|
|
69
|
-
constructor(message: string, status: number, responseData: object, details: any = null) {
|
|
70
|
-
super(message);
|
|
71
|
-
this.status = status;
|
|
72
|
-
this.responseData = responseData;
|
|
73
|
-
this.details = details;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Erreur d'authentification (ex: 401/403).
|
|
79
|
-
*/
|
|
80
|
-
export class ApiAuthenticationError extends ApiError {
|
|
81
|
-
public override readonly name: string = "ApiAuthenticationError";
|
|
82
|
-
|
|
83
|
-
constructor(message: string, status: number, details?: GenericErrorDetails) {
|
|
84
|
-
super(message, status, details);
|
|
85
|
-
}
|
|
86
|
-
}
|
package/src/forms/entityForm.ts
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Descripteur de FORMULAIRE de BASE d'une entité (création) — NEUTRE (zéro dépendance UI/site).
|
|
3
|
-
*
|
|
4
|
-
* Pendant de `CostumScope.describeForm` (qui décrit l'OVERLAY costum), pour les champs de BASE de
|
|
5
|
-
* l'entité (name/email/url/address/tags/telephone/openingHours/socialNetwork/image…). Le consommateur
|
|
6
|
-
* (site-json) compose `describeEntityForm(collection)` ⊕ `describeForm(collection)` → un form complet
|
|
7
|
-
* base+costum, SANS dupliquer la base par costum.
|
|
8
|
-
*
|
|
9
|
-
* Décision (B) : la base est **curée UNE FOIS par entité** ici, pas auto-extraite des schémas. Le
|
|
10
|
-
* modèle lib étale la base sur plusieurs schémas hétérogènes (`ADD_*` + `UPDATE_BLOCK_*` +
|
|
11
|
-
* `VIRTUAL_SCHEMAS` + `PROFIL_IMAGE`) avec des dualités (social objet vs à plat, image hors-ADD,
|
|
12
|
-
* virtuals déclarés en CODE) → une auto-extraction propre est fragile. La curation reste « from the
|
|
13
|
-
* lib build » (exportée par la lib) et « définie une fois ». La config générée est ensuite ÉDITABLE.
|
|
14
|
-
*
|
|
15
|
-
* NEUTRE : aucun `widget` ici (vocabulaire UI du site). On porte un `format` (indice sémantique) que le
|
|
16
|
-
* consommateur mappe vers son widget (`address`→location, `image`→image, `social`→editSocial, …).
|
|
17
|
-
*/
|
|
18
|
-
import { EVENT_TYPES } from "../api/serverDataType/Event.js";
|
|
19
|
-
import { ORGANIZATION_TYPES } from "../api/serverDataType/Organization.js";
|
|
20
|
-
import { POI_TYPES } from "../api/serverDataType/Poi.js";
|
|
21
|
-
|
|
22
|
-
import type { Collection } from "../costum/types.js";
|
|
23
|
-
|
|
24
|
-
/** Type logique d'un champ de base (aligné sur `CostumFieldType`). */
|
|
25
|
-
export type EntityFieldType = "string" | "number" | "boolean" | "date" | "array" | "object";
|
|
26
|
-
|
|
27
|
-
/** Indice sémantique de rendu — le site le mappe vers son widget (la lib reste UI-neutre). */
|
|
28
|
-
export type EntityFieldFormat =
|
|
29
|
-
| "email" | "url" | "tel" | "markdown"
|
|
30
|
-
| "address" | "image" | "social" | "openingHours";
|
|
31
|
-
|
|
32
|
-
/** Champ de base décrit pour un formulaire (curé, neutre). */
|
|
33
|
-
export interface BaseFieldDescriptor {
|
|
34
|
-
name: string;
|
|
35
|
-
type: EntityFieldType;
|
|
36
|
-
multiple: boolean;
|
|
37
|
-
/** Options de choix (select/multiselect). */
|
|
38
|
-
enum?: (string | number)[];
|
|
39
|
-
/** Libellé humain curé (la source schéma n'en a pas de fiable). */
|
|
40
|
-
label?: string;
|
|
41
|
-
required?: boolean;
|
|
42
|
-
/** Indice de rendu pour le consommateur (widget spécialisé). */
|
|
43
|
-
format?: EntityFieldFormat;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** Formulaire de BASE d'une entité (champs curés) — pendant neutre de `CostumFormDescriptor`. */
|
|
47
|
-
export interface EntityFormDescriptor {
|
|
48
|
-
collection: Collection;
|
|
49
|
-
fields: BaseFieldDescriptor[];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Base ORGANIZATIONS (création) — curée depuis `Organization.ts` (SCHEMA_CONSTANTS `ADD_ORGANIZATION` +
|
|
54
|
-
* `PROFIL_IMAGE` + `VIRTUAL_*`), réconciliée : champs système/plumbing retirés, social pris en OBJET
|
|
55
|
-
* (`socialNetwork`, pas la variante à plat de `UPDATE_BLOCK_SOCIAL`), image `profil_avatar` ajoutée
|
|
56
|
-
* (absente d'`ADD_ORGANIZATION`). `type` enum ← `ADD_ORGANIZATION.type`.
|
|
57
|
-
*/
|
|
58
|
-
const ORGANIZATION_BASE: BaseFieldDescriptor[] = [
|
|
59
|
-
{ name: "name", type: "string", multiple: false, label: "Nom", required: true },
|
|
60
|
-
{ name: "type", type: "string", multiple: false, label: "Type", enum: [...ORGANIZATION_TYPES] },
|
|
61
|
-
{ name: "email", type: "string", multiple: false, label: "Email", format: "email" },
|
|
62
|
-
{ name: "url", type: "string", multiple: false, label: "Site web", format: "url" },
|
|
63
|
-
{ name: "telephone", type: "string", multiple: false, label: "Téléphone", format: "tel" },
|
|
64
|
-
{ name: "shortDescription", type: "string", multiple: false, label: "Description courte" },
|
|
65
|
-
{ name: "description", type: "string", multiple: false, label: "Description", format: "markdown" },
|
|
66
|
-
{ name: "tags", type: "array", multiple: true, label: "Tags" },
|
|
67
|
-
{ name: "address", type: "object", multiple: false, label: "Adresse", format: "address" },
|
|
68
|
-
{ name: "socialNetwork", type: "object", multiple: false, label: "Réseaux sociaux", format: "social" },
|
|
69
|
-
{ name: "openingHours", type: "array", multiple: false, label: "Horaires d'ouverture", format: "openingHours" },
|
|
70
|
-
{ name: "profil_avatar", type: "object", multiple: false, label: "Logo / image", format: "image" },
|
|
71
|
-
];
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Base PROJECTS (création) — curée depuis `Project.ts` (`ADD_PROJECT` + `UPDATE_BLOCK_DESCRIPTION/SOCIAL` +
|
|
75
|
-
* `PROFIL_IMAGE`). `public` (visibilité) est propre au projet (absent de l'org). Pas de `type` (le contrat
|
|
76
|
-
* projet n'en a pas), pas d'`email`/`telephone`/`openingHours`. Exclus système/plumbing : id/collection/
|
|
77
|
-
* key/parent/preferences/geo/geoPosition/scope.
|
|
78
|
-
*/
|
|
79
|
-
const PROJECT_BASE: BaseFieldDescriptor[] = [
|
|
80
|
-
{ name: "name", type: "string", multiple: false, label: "Nom du projet", required: true },
|
|
81
|
-
{ name: "shortDescription", type: "string", multiple: false, label: "Description courte" },
|
|
82
|
-
{ name: "description", type: "string", multiple: false, label: "Description", format: "markdown" },
|
|
83
|
-
{ name: "url", type: "string", multiple: false, label: "Site web", format: "url" },
|
|
84
|
-
{ name: "public", type: "boolean", multiple: false, label: "Projet public" },
|
|
85
|
-
{ name: "tags", type: "array", multiple: true, label: "Tags" },
|
|
86
|
-
{ name: "address", type: "object", multiple: false, label: "Adresse", format: "address" },
|
|
87
|
-
{ name: "socialNetwork", type: "object", multiple: false, label: "Réseaux sociaux", format: "social" },
|
|
88
|
-
{ name: "profil_avatar", type: "object", multiple: false, label: "Logo / image", format: "image" },
|
|
89
|
-
];
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Base POI (création) — curée depuis `Poi.ts` (`ADD_POI` + `UPDATE_BLOCK_DESCRIPTION` + `PROFIL_IMAGE`).
|
|
93
|
-
* `type` enum ← `POI_TYPES` ; `urls` (liens externes) propre au POI. Pas de social/openingHours/email.
|
|
94
|
-
* Exclus système/plumbing : id/source/collection/key/parent/geo/geoPosition/scope.
|
|
95
|
-
*/
|
|
96
|
-
const POI_BASE: BaseFieldDescriptor[] = [
|
|
97
|
-
{ name: "name", type: "string", multiple: false, label: "Nom", required: true },
|
|
98
|
-
{ name: "type", type: "string", multiple: false, label: "Type", enum: [...POI_TYPES] },
|
|
99
|
-
{ name: "description", type: "string", multiple: false, label: "Description", format: "markdown" },
|
|
100
|
-
{ name: "tags", type: "array", multiple: true, label: "Tags" },
|
|
101
|
-
{ name: "urls", type: "array", multiple: true, label: "Liens / URLs" },
|
|
102
|
-
{ name: "address", type: "object", multiple: false, label: "Adresse", format: "address" },
|
|
103
|
-
{ name: "profil_avatar", type: "object", multiple: false, label: "Logo / image", format: "image" },
|
|
104
|
-
];
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Base EVENTS (création) — curée depuis `Event.ts` (`ADD_EVENT` + `PROFIL_IMAGE`). `type` enum ← `EVENT_TYPES` ;
|
|
108
|
-
* `startDate`/`endDate` (dates) + `openingHours` (récurrence) propres à l'événement. Pas de `description`
|
|
109
|
-
* longue (le contrat event n'en a pas), pas de social/telephone. Exclus système/plumbing : id/collection/
|
|
110
|
-
* key/organizer/parent/preferences/timeZone/recurrency.
|
|
111
|
-
*/
|
|
112
|
-
const EVENT_BASE: BaseFieldDescriptor[] = [
|
|
113
|
-
{ name: "name", type: "string", multiple: false, label: "Nom de l'événement", required: true },
|
|
114
|
-
{ name: "type", type: "string", multiple: false, label: "Type d'événement", enum: [...EVENT_TYPES] },
|
|
115
|
-
{ name: "public", type: "boolean", multiple: false, label: "Événement public" },
|
|
116
|
-
{ name: "shortDescription", type: "string", multiple: false, label: "Description courte" },
|
|
117
|
-
{ name: "url", type: "string", multiple: false, label: "Site web", format: "url" },
|
|
118
|
-
{ name: "email", type: "string", multiple: false, label: "Email", format: "email" },
|
|
119
|
-
{ name: "tags", type: "array", multiple: true, label: "Tags" },
|
|
120
|
-
{ name: "startDate", type: "date", multiple: false, label: "Date de début" },
|
|
121
|
-
{ name: "endDate", type: "date", multiple: false, label: "Date de fin" },
|
|
122
|
-
{ name: "openingHours", type: "array", multiple: false, label: "Horaires d'ouverture", format: "openingHours" },
|
|
123
|
-
{ name: "address", type: "object", multiple: false, label: "Adresse", format: "address" },
|
|
124
|
-
{ name: "profil_avatar", type: "object", multiple: false, label: "Logo / image", format: "image" },
|
|
125
|
-
];
|
|
126
|
-
|
|
127
|
-
/** Base curée par collection (entités créables via formulaire ; citoyen = inscription, hors périmètre). */
|
|
128
|
-
const ENTITY_FORMS: Partial<Record<Collection, BaseFieldDescriptor[]>> = {
|
|
129
|
-
organizations: ORGANIZATION_BASE,
|
|
130
|
-
projects: PROJECT_BASE,
|
|
131
|
-
poi: POI_BASE,
|
|
132
|
-
events: EVENT_BASE,
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Décrit le formulaire de BASE (création) d'une entité — curé, neutre. `null` si non couverte
|
|
137
|
-
* (le consommateur retombe alors sur le costum seul). Statique : aucune dépendance réseau/instance.
|
|
138
|
-
*/
|
|
139
|
-
export function describeEntityForm(collection: Collection): EntityFormDescriptor | null {
|
|
140
|
-
const fields = ENTITY_FORMS[collection];
|
|
141
|
-
return fields ? { collection, fields } : null;
|
|
142
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from "./api/BaseEntity.js";
|
|
2
|
-
import { fromEntityJSON, reviveEntities } from "./api/EntityRegistry.js";
|
|
3
|
-
import Api from "./Api.js";
|
|
4
|
-
import ApiClient from "./ApiClient.js";
|
|
5
|
-
import * as error from "./error.js";
|
|
6
|
-
import { createDefaultMultiServerTokenStorageStrategy } from "./utils/createDefaultMultiServerTokenStorageStrategy.js";
|
|
7
|
-
import { createDefaultTokenStorageStrategy } from "./utils/createDefaultTokenStorageStrategy.js";
|
|
8
|
-
import { MultiServerTokenStorageStrategy } from "./utils/MultiServerTokenStorageStrategy.js";
|
|
9
|
-
import OfflineClientManager from "./utils/OfflineClientManager.js";
|
|
10
|
-
import * as reactive from "./utils/reactive.js";
|
|
11
|
-
import { TokenStorageStrategy } from "./utils/TokenStorage.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const cocolightApiClient = {
|
|
15
|
-
ApiClient,
|
|
16
|
-
Api,
|
|
17
|
-
error,
|
|
18
|
-
reactive,
|
|
19
|
-
effect: reactive.effect,
|
|
20
|
-
batch: reactive.batch,
|
|
21
|
-
isSignal: reactive.isSignal,
|
|
22
|
-
reactiveObject: reactive.reactive,
|
|
23
|
-
isReactive: reactive.isReactive,
|
|
24
|
-
computed: reactive.computed,
|
|
25
|
-
watch: reactive.watch,
|
|
26
|
-
getSignals: reactive.getSignals,
|
|
27
|
-
subscribeTo: reactive.subscribeTo,
|
|
28
|
-
tokenStorageStrategy: {
|
|
29
|
-
createDefaultTokenStorageStrategy,
|
|
30
|
-
TokenStorageStrategy,
|
|
31
|
-
createDefaultMultiServerTokenStorageStrategy,
|
|
32
|
-
MultiServerTokenStorageStrategy
|
|
33
|
-
},
|
|
34
|
-
helper: {
|
|
35
|
-
fromEntityJSON,
|
|
36
|
-
reviveEntities,
|
|
37
|
-
restorePaginationFromJSON: BaseEntity.restorePaginationFromJSON
|
|
38
|
-
},
|
|
39
|
-
OfflineClientManager
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export default cocolightApiClient;
|
|
43
|
-
|
|
44
|
-
// Helpers réactifs en exports nommés (permet `import { effect, subscribeTo } from "..."`)
|
|
45
|
-
export { batch, computed, effect, getSignals, isReactive, isSignal, reactive, subscribeTo, watch } from "./utils/reactive.js";
|
|
46
|
-
|
|
47
|
-
// Export des types pour faciliter l'utilisation
|
|
48
|
-
|
|
49
|
-
// Classes principales
|
|
50
|
-
export type { default as Api } from "./Api.js";
|
|
51
|
-
export type { default as ApiClient } from "./ApiClient.js";
|
|
52
|
-
export type { default as EndpointApi } from "./api/EndpointApi.js";
|
|
53
|
-
export type { UserApi } from "./api/UserApi.js";
|
|
54
|
-
|
|
55
|
-
// Types ApiClient (configuration et résultats d'appels)
|
|
56
|
-
export type {
|
|
57
|
-
ApiClientOptions,
|
|
58
|
-
CallEndpointData,
|
|
59
|
-
CallEndpointResult,
|
|
60
|
-
CallEndpointResponse,
|
|
61
|
-
ApiClientOfflineEnqueueResult
|
|
62
|
-
} from "./ApiClient.js";
|
|
63
|
-
|
|
64
|
-
// Stratégies de stockage
|
|
65
|
-
export type { TokenStorageStrategy } from "./utils/TokenStorage.js";
|
|
66
|
-
export type { MultiServerTokenStorageStrategy } from "./utils/MultiServerTokenStorageStrategy.js";
|
|
67
|
-
export type { default as OfflineClientManager } from "./utils/OfflineClientManager.js";
|
|
68
|
-
export type { OfflineAction } from "./utils/OfflineClientManager.js";
|
|
69
|
-
|
|
70
|
-
// Classes d'entités
|
|
71
|
-
export type { User } from "./api/User.js";
|
|
72
|
-
export type { Organization } from "./api/Organization.js";
|
|
73
|
-
export type { Project } from "./api/Project.js";
|
|
74
|
-
export type { Event } from "./api/Event.js";
|
|
75
|
-
export type { Poi } from "./api/Poi.js";
|
|
76
|
-
export type { Classified } from "./api/Classified.js";
|
|
77
|
-
export type { Badge } from "./api/Badge.js";
|
|
78
|
-
export type { News } from "./api/News.js";
|
|
79
|
-
export type { Comment } from "./api/Comment.js";
|
|
80
|
-
export type { Answer } from "./api/Answer.js";
|
|
81
|
-
export type { Form } from "./api/Form.js";
|
|
82
|
-
export type { Action } from "./api/Action.js";
|
|
83
|
-
|
|
84
|
-
// Types ServerData (données normalisées reçues du serveur)
|
|
85
|
-
export type * from "./api/serverDataType/User.js";
|
|
86
|
-
export type * from "./api/serverDataType/Organization.js";
|
|
87
|
-
|
|
88
|
-
// Export des constantes de types d'entités
|
|
89
|
-
export { ORGANIZATION_TYPES } from "./api/serverDataType/Organization.js";
|
|
90
|
-
export { PROJECT_AVANCEMENTS } from "./api/serverDataType/Project.js";
|
|
91
|
-
export { EVENT_TYPES } from "./api/serverDataType/Event.js";
|
|
92
|
-
export { POI_TYPES } from "./api/serverDataType/Poi.js";
|
|
93
|
-
export type * from "./api/serverDataType/Project.js";
|
|
94
|
-
export { CLASSIFIED_SECTIONS, CLASSIFIED_CATEGORIES, CLASSIFIED_SUBCATEGORIES } from "./api/serverDataType/Classified.js";
|
|
95
|
-
export type * from "./api/serverDataType/Classified.js";
|
|
96
|
-
export type * from "./api/serverDataType/Event.js";
|
|
97
|
-
export type * from "./api/serverDataType/Poi.js";
|
|
98
|
-
export type * from "./api/serverDataType/News.js";
|
|
99
|
-
export type * from "./api/serverDataType/Comment.js";
|
|
100
|
-
export type * from "./api/serverDataType/Answer.js";
|
|
101
|
-
export type * from "./api/serverDataType/Form.js";
|
|
102
|
-
export { ACTION_STATUSES } from "./api/serverDataType/Action.js";
|
|
103
|
-
export type * from "./api/serverDataType/Action.js";
|
|
104
|
-
export type * from "./api/serverDataType/common.js";
|
|
105
|
-
export type * from "./api/serverDataType/Country.js";
|
|
106
|
-
export type * from "./api/serverDataType/Zone.js";
|
|
107
|
-
export type * from "./api/serverDataType/Notification.js";
|
|
108
|
-
|
|
109
|
-
// Classes notifications (type-only, comme les entités) — instances obtenues via me.notifications
|
|
110
|
-
export type { Notification, Notifications } from "./api/Notifications.js";
|
|
111
|
-
|
|
112
|
-
// Types utilitaires BaseEntity
|
|
113
|
-
export type {
|
|
114
|
-
PaginatorPage,
|
|
115
|
-
PaginatorState,
|
|
116
|
-
FundingEnvelopeResult,
|
|
117
|
-
FundingEnvelopeProjectItem,
|
|
118
|
-
SearchCostumVariant,
|
|
119
|
-
SetTypeValue,
|
|
120
|
-
CostumContextFields,
|
|
121
|
-
WithCostumContext,
|
|
122
|
-
EntityType,
|
|
123
|
-
CoformThematicValue,
|
|
124
|
-
CoformFilterByPathResult,
|
|
125
|
-
} from "./api/BaseEntity.js";
|
|
126
|
-
|
|
127
|
-
// Constantes BaseEntity
|
|
128
|
-
export { UPDATE_PATH_MAGIC } from "./api/BaseEntity.js";
|
|
129
|
-
|
|
130
|
-
// Costum runtime : scope + descripteur de formulaire (pour générer un form depuis le runtime distribué)
|
|
131
|
-
export type {
|
|
132
|
-
CostumScope,
|
|
133
|
-
CostumRuntimeContext,
|
|
134
|
-
CostumFormDescriptor,
|
|
135
|
-
CostumFieldDescriptor,
|
|
136
|
-
CostumFieldType,
|
|
137
|
-
} from "./costum/runtime.js";
|
|
138
|
-
export type { Collection, KnownCostumSlug } from "./costum/types.js";
|
|
139
|
-
|
|
140
|
-
// Formulaire de BASE d'une entité (curé, neutre) — composé avec l'overlay costum (describeForm).
|
|
141
|
-
export { describeEntityForm } from "./forms/entityForm.js";
|
|
142
|
-
export type { EntityFormDescriptor, BaseFieldDescriptor, EntityFieldType, EntityFieldFormat } from "./forms/entityForm.js";
|
|
143
|
-
|
|
144
|
-
// Types Answer (file-source, en plus des types serverData)
|
|
145
|
-
export type {
|
|
146
|
-
AllStepsData,
|
|
147
|
-
PendingUploadValue,
|
|
148
|
-
PendingUpload,
|
|
149
|
-
ProcessUploadsOptions,
|
|
150
|
-
AnswerGetOptions,
|
|
151
|
-
UploadAnswerFileOptions,
|
|
152
|
-
UploadAnswerFileResult,
|
|
153
|
-
GetFilesOptions,
|
|
154
|
-
AnswerFileItem,
|
|
155
|
-
} from "./api/Answer.js";
|
|
156
|
-
|
|
157
|
-
// Types de réponses, payloads, entités, et transforms
|
|
158
|
-
export type * from "./types/index.js";
|
|
159
|
-
|
|
160
|
-
// Export de tous les types générés depuis EndpointApi.types.ts
|
|
161
|
-
export type * from "./api/EndpointApi.types.js";
|
package/src/mixin/UserMixin.ts
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
// types/api-responses.ts - Types pour les réponses API et amélioration du type safety
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-namespace */
|
|
4
|
-
|
|
5
|
-
import type { CollectionKey } from "../api/EntityRegistry.js";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Interface de base pour toutes les réponses API
|
|
9
|
-
*/
|
|
10
|
-
export interface BaseApiResponse {
|
|
11
|
-
success?: boolean;
|
|
12
|
-
message?: string;
|
|
13
|
-
timestamp?: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Réponse avec données
|
|
18
|
-
*/
|
|
19
|
-
export interface ApiDataResponse<T = any> extends BaseApiResponse {
|
|
20
|
-
data: T;
|
|
21
|
-
map?: {
|
|
22
|
-
id?: string;
|
|
23
|
-
slug?: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Réponse d'erreur API
|
|
29
|
-
*/
|
|
30
|
-
export interface ApiErrorResponse extends BaseApiResponse {
|
|
31
|
-
error: {
|
|
32
|
-
code: number;
|
|
33
|
-
message: string;
|
|
34
|
-
details?: any;
|
|
35
|
-
stack?: string;
|
|
36
|
-
};
|
|
37
|
-
success: false;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Réponse paginée
|
|
42
|
-
*/
|
|
43
|
-
export interface PaginatedApiResponse<T = any> extends BaseApiResponse {
|
|
44
|
-
data: {
|
|
45
|
-
count: {
|
|
46
|
-
total: number;
|
|
47
|
-
};
|
|
48
|
-
results: T[];
|
|
49
|
-
pageIndex: number;
|
|
50
|
-
pageNumber: number;
|
|
51
|
-
hasNext: boolean;
|
|
52
|
-
hasPrev: boolean;
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Réponse pour les opérations de connexion/déconnexion
|
|
58
|
-
*/
|
|
59
|
-
export interface ConnectionResponse extends BaseApiResponse {
|
|
60
|
-
connection: {
|
|
61
|
-
established: boolean;
|
|
62
|
-
type: string;
|
|
63
|
-
childId: string;
|
|
64
|
-
parentId: string;
|
|
65
|
-
date: number;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Réponse pour l'authentification
|
|
71
|
-
*/
|
|
72
|
-
export interface AuthResponse extends BaseApiResponse {
|
|
73
|
-
user?: {
|
|
74
|
-
id: string;
|
|
75
|
-
username: string;
|
|
76
|
-
email: string;
|
|
77
|
-
roles: any;
|
|
78
|
-
};
|
|
79
|
-
accessToken?: string;
|
|
80
|
-
refreshToken?: string;
|
|
81
|
-
expiresIn?: number;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Réponse pour l'upload de fichiers
|
|
86
|
-
*/
|
|
87
|
-
export interface UploadResponse extends BaseApiResponse {
|
|
88
|
-
file: {
|
|
89
|
-
id: string;
|
|
90
|
-
filename: string;
|
|
91
|
-
originalName: string;
|
|
92
|
-
mimetype: string;
|
|
93
|
-
size: number;
|
|
94
|
-
url: string;
|
|
95
|
-
thumbnailUrl?: string;
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Réponse pour les opérations CRUD simples
|
|
101
|
-
*/
|
|
102
|
-
export interface CrudResponse extends BaseApiResponse {
|
|
103
|
-
operation: "create" | "read" | "update" | "delete";
|
|
104
|
-
entityType: string;
|
|
105
|
-
entityId: string;
|
|
106
|
-
affected: number;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Types pour les endpoints spécifiques
|
|
111
|
-
*/
|
|
112
|
-
export interface GetElementsKeyResponse extends BaseApiResponse {
|
|
113
|
-
contextId?: string;
|
|
114
|
-
contextType?: CollectionKey;
|
|
115
|
-
[key: string]: unknown;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Union de tous les types de réponse
|
|
120
|
-
*/
|
|
121
|
-
export type ApiResponse =
|
|
122
|
-
| BaseApiResponse
|
|
123
|
-
| ApiDataResponse
|
|
124
|
-
| ApiErrorResponse
|
|
125
|
-
| PaginatedApiResponse
|
|
126
|
-
| ConnectionResponse
|
|
127
|
-
| AuthResponse
|
|
128
|
-
| UploadResponse
|
|
129
|
-
| CrudResponse
|
|
130
|
-
| GetElementsKeyResponse;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Types pour les statuts HTTP
|
|
134
|
-
*/
|
|
135
|
-
export type HttpStatusCode =
|
|
136
|
-
| 200 | 201 | 202 | 204 // Success
|
|
137
|
-
| 400 | 401 | 403 | 404 | 409 | 422 // Client errors
|
|
138
|
-
| 500 | 501 | 502 | 503 | 504; // Server errors
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Interface pour les détails d'erreur API
|
|
142
|
-
*/
|
|
143
|
-
export interface ApiErrorDetails {
|
|
144
|
-
code: HttpStatusCode;
|
|
145
|
-
message: string;
|
|
146
|
-
details?: any;
|
|
147
|
-
validationErrors?: Array<{
|
|
148
|
-
field: string;
|
|
149
|
-
message: string;
|
|
150
|
-
value?: any;
|
|
151
|
-
}>;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Types pour les réponses d'endpoint spécifiques
|
|
156
|
-
*/
|
|
157
|
-
export namespace EndpointResponses {
|
|
158
|
-
export interface AddUser extends ApiDataResponse<{
|
|
159
|
-
id: string;
|
|
160
|
-
username: string;
|
|
161
|
-
email: string;
|
|
162
|
-
created: number;
|
|
163
|
-
}> {}
|
|
164
|
-
|
|
165
|
-
export interface AddOrganization extends ApiDataResponse<{
|
|
166
|
-
id: string;
|
|
167
|
-
name: string;
|
|
168
|
-
created: number;
|
|
169
|
-
}> {}
|
|
170
|
-
|
|
171
|
-
export interface AddProject extends ApiDataResponse<{
|
|
172
|
-
id: string;
|
|
173
|
-
name: string;
|
|
174
|
-
created: number;
|
|
175
|
-
}> {}
|
|
176
|
-
|
|
177
|
-
export interface AddEvent extends ApiDataResponse<{
|
|
178
|
-
id: string;
|
|
179
|
-
name: string;
|
|
180
|
-
startDate?: number;
|
|
181
|
-
created: number;
|
|
182
|
-
}> {}
|
|
183
|
-
|
|
184
|
-
export interface AddPoi extends ApiDataResponse<{
|
|
185
|
-
id: string;
|
|
186
|
-
name: string;
|
|
187
|
-
created: number;
|
|
188
|
-
}> {}
|
|
189
|
-
|
|
190
|
-
export interface AddNews extends ApiDataResponse<{
|
|
191
|
-
id: string;
|
|
192
|
-
title: string;
|
|
193
|
-
publishDate?: number;
|
|
194
|
-
created: number;
|
|
195
|
-
}> {}
|
|
196
|
-
|
|
197
|
-
export interface AddBadges extends ApiDataResponse<{
|
|
198
|
-
id: string;
|
|
199
|
-
name: string;
|
|
200
|
-
created: number;
|
|
201
|
-
}> {}
|
|
202
|
-
|
|
203
|
-
export interface Connect extends ConnectionResponse {}
|
|
204
|
-
export interface Disconnect extends ConnectionResponse {}
|
|
205
|
-
export interface Follow extends ConnectionResponse {}
|
|
206
|
-
export interface LinkValidate extends ConnectionResponse {}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Type helper pour extraire le type de données d'une réponse API
|
|
211
|
-
*/
|
|
212
|
-
export type ExtractApiData<T> = T extends ApiDataResponse<infer U> ? U : never;
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Type helper pour les réponses qui peuvent être soit des données soit des erreurs
|
|
216
|
-
*/
|
|
217
|
-
export type ApiResult<T> = ApiDataResponse<T> | ApiErrorResponse;
|
package/src/types/entities.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// types/entities.ts - Types partagés pour éviter les dépendances circulaires
|
|
2
|
-
|
|
3
|
-
import type { Action } from "../api/Action.js";
|
|
4
|
-
import type { Answer } from "../api/Answer.js";
|
|
5
|
-
import type { Badge } from "../api/Badge.js";
|
|
6
|
-
import type { Classified } from "../api/Classified.js";
|
|
7
|
-
import type { Comment } from "../api/Comment.js";
|
|
8
|
-
import type { Event } from "../api/Event.js";
|
|
9
|
-
import type { Form } from "../api/Form.js";
|
|
10
|
-
import type { News } from "../api/News.js";
|
|
11
|
-
import type { Organization } from "../api/Organization.js";
|
|
12
|
-
import type { Poi } from "../api/Poi.js";
|
|
13
|
-
import type { Project } from "../api/Project.js";
|
|
14
|
-
import type { User } from "../api/User.js";
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Union type for all possible entity types
|
|
18
|
-
*/
|
|
19
|
-
export type EntityTypes = User | Organization | Project | Event | Poi | Badge | News | Comment | Answer | Form | Classified | Action;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Type union représentant les entités pouvant être retournées par une recherche.
|
|
23
|
-
* Inclut les utilisateurs, organisations, projets, événements et points d'intérêt.
|
|
24
|
-
*/
|
|
25
|
-
export type SearchEntity = User | Organization | Project | Event | Poi;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Type pour récupérer une entité existante via l'API publique.
|
|
29
|
-
* Nécessite soit un id, soit un slug.
|
|
30
|
-
* Les propriétés additionnelles sont autorisées mais ignorées lors de la récupération.
|
|
31
|
-
*/
|
|
32
|
-
export type EntityData =
|
|
33
|
-
| { id: string; slug?: string; [key: string]: any }
|
|
34
|
-
| { slug: string; id?: string; [key: string]: any };
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Types de collection possibles
|
|
38
|
-
*/
|
|
39
|
-
export type CollectionType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "badges" | "comments" | "answers" | "forms" | "classifieds" | "actions";
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Types pour les références entre entités
|
|
43
|
-
*/
|
|
44
|
-
export interface EntityRef {
|
|
45
|
-
type: string;
|
|
46
|
-
name?: string;
|
|
47
|
-
id?: string;
|
|
48
|
-
slug?: string;
|
|
49
|
-
_id?: any;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export type EntityRefsMap = Record<string, EntityRef>;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Types pour les transformations de données
|
|
56
|
-
*/
|
|
57
|
-
export type TransformFunction<TInput = any, TOutput = any> = (value: TInput, fullObject?: any) => TOutput;
|
|
58
|
-
export type TransformsMap = Record<string, TransformFunction | undefined>;
|