@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/api/Form.ts
DELETED
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from "./BaseEntity.js";
|
|
2
|
-
import { ApiError } from "../error.js";
|
|
3
|
-
|
|
4
|
-
import type { Answer } from "./Answer.js";
|
|
5
|
-
import type { PaginatorPage, PaginatorState } from "./BaseEntity.js";
|
|
6
|
-
import type {
|
|
7
|
-
CoformAnswersSearchData,
|
|
8
|
-
GetCoformCatalogsData,
|
|
9
|
-
} from "./EndpointApi.types.js";
|
|
10
|
-
import type { CoformCommonTableContributor, FormItemNormalized } from "./serverDataType/Form.js";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Une entrée de catalogue commonTable (une criteria agrégée cross-réponses).
|
|
14
|
-
* `label`/`usage`/`usageKey`/`coeff`/`count` toujours présents (le backend
|
|
15
|
-
* les construit avec défauts) ; `names`/`name` seulement si au moins une
|
|
16
|
-
* réponse `yesOrNo` non vide existe pour la criteria. Les champs echo
|
|
17
|
-
* (`label`, `usage`…) renvoient la valeur stockée brute, sans coercion.
|
|
18
|
-
*/
|
|
19
|
-
export interface CommonTableCatalogEntry {
|
|
20
|
-
label: unknown;
|
|
21
|
-
usage: unknown;
|
|
22
|
-
usageKey: unknown;
|
|
23
|
-
coeff: number | string | boolean | null;
|
|
24
|
-
count: number;
|
|
25
|
-
/** Distribution `{ solutionName → fréquence }` ; absent si aucune réponse. */
|
|
26
|
-
names?: Record<string, number>;
|
|
27
|
-
/** Mode (plus fréquent) de `names` ; présent ssi `names` présent. */
|
|
28
|
-
name?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Catalogue collaboratif des inputs `commonTable` : map
|
|
33
|
-
* `inputKey → (criteriaId → CommonTableCatalogEntry)`. Les entrées sont
|
|
34
|
-
* DIRECTEMENT sous l'inputKey (pas de niveau intermédiaire `entries`).
|
|
35
|
-
* Format aligné sur la réponse backend de `GET_COFORM_CATALOGS`
|
|
36
|
-
* (`getCatalogs` normalise les `[]` PHP — catalogues vides — en `{}`).
|
|
37
|
-
*/
|
|
38
|
-
export type CommonTableCatalogs = Record<string, Record<string, CommonTableCatalogEntry>>;
|
|
39
|
-
|
|
40
|
-
export class Form extends BaseEntity<FormItemNormalized> {
|
|
41
|
-
static override entityType = "forms";
|
|
42
|
-
|
|
43
|
-
static override entityTag = "Form";
|
|
44
|
-
static override SCHEMA_CONSTANTS: string[] = [];
|
|
45
|
-
|
|
46
|
-
static ADD_BLOCKS: Map<string, string> = new Map([]);
|
|
47
|
-
static UPDATE_BLOCKS: Map<string, string> = new Map([]);
|
|
48
|
-
|
|
49
|
-
override defaultFields: Record<string, any> = {};
|
|
50
|
-
override removeFields: string[] = [];
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Transforme les champs imbriqués en instances d'entités si nécessaire.
|
|
54
|
-
* @param data - Les données brutes du serveur.
|
|
55
|
-
* @returns Les données transformées.
|
|
56
|
-
* @protected
|
|
57
|
-
*/
|
|
58
|
-
protected override _transformServerData(data: FormItemNormalized): FormItemNormalized {
|
|
59
|
-
// Pour l'instant, on ne transforme pas les relations parent
|
|
60
|
-
// car elles peuvent être des Organizations ou Projects
|
|
61
|
-
// On pourrait ajouter cette transformation plus tard si nécessaire
|
|
62
|
-
|
|
63
|
-
return data;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Rafraîchit les données du formulaire depuis l'API.
|
|
68
|
-
* Constant : GET_COFORM_BY_ID
|
|
69
|
-
*/
|
|
70
|
-
override async get(): Promise<Record<string, any>> {
|
|
71
|
-
if (!this.id) throw new ApiError("Impossible de rafraîchir sans ID.", 400);
|
|
72
|
-
const parentFormId = this.id; // Type narrowing
|
|
73
|
-
|
|
74
|
-
const form = await this.endpointApi.getCoformById({
|
|
75
|
-
parentFormId
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
if (form?.data?.id || form?.data?._id) {
|
|
79
|
-
// Normaliser les valeurs nulles en objets/tableaux vides pour cohérence.
|
|
80
|
-
// Injection de `collection: "forms"` : le backend (PHDB::find) ne renvoie pas
|
|
81
|
-
// ce champ ; on l'ajoute côté SDK pour rester cohérent avec les autres entités.
|
|
82
|
-
const normalizedData = {
|
|
83
|
-
...form.data,
|
|
84
|
-
collection: "forms" as const,
|
|
85
|
-
inputs: form.data.inputs ?? {},
|
|
86
|
-
params: form.data.params ?? {},
|
|
87
|
-
subForms: form.data.subForms ?? [],
|
|
88
|
-
parent: form.data.parent ?? undefined,
|
|
89
|
-
config: form.data.config ?? undefined,
|
|
90
|
-
} as FormItemNormalized;
|
|
91
|
-
|
|
92
|
-
this._setData(normalizedData, { forceInitialDraftReset: true });
|
|
93
|
-
return this.serverData;
|
|
94
|
-
}
|
|
95
|
-
throw new ApiError(`Aucun formulaire trouvé pour l'ID ${this.id}`, 404);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Recherche paginée des Answers liées à CE Form, dans le costumContext de son parent.
|
|
100
|
-
*
|
|
101
|
-
* **Délégation au parent** : le Form lui-même n'a pas de costumContext (pas de
|
|
102
|
-
* `slug` côté serverData). Cette méthode remonte `this.parent` (qui doit être
|
|
103
|
-
* une `Organization` ou un `Project` ayant un slug) et délègue à
|
|
104
|
-
* `parent.coformAnswersSearch({ filters: { form: this.id, ... } })`.
|
|
105
|
-
*
|
|
106
|
-
* Pattern identique à `Comment._add` qui remonte `this.parent` pour récupérer
|
|
107
|
-
* le contexte d'ancrage.
|
|
108
|
-
*
|
|
109
|
-
* **Important** : pour utiliser cette méthode, le Form doit avoir été créé via
|
|
110
|
-
* `org.form({id})` ou `project.form({id})` — pas via `api.form({id})` direct
|
|
111
|
-
* (qui crée un Form avec `parent = ApiClient`, sans costumContext).
|
|
112
|
-
*
|
|
113
|
-
* @param data - Paramètres de recherche (`filters`, `fields`, `sortBy`, etc.).
|
|
114
|
-
* Le champ `filters.form` est automatiquement injecté avec `this.id`.
|
|
115
|
-
* @param options - Options de pagination (`restoredState` pour reprendre une navigation)
|
|
116
|
-
* @returns Première page paginée avec `results` (Answer[]), `count`, `hasNext`, etc.
|
|
117
|
-
* @throws {ApiError} si le Form n'a pas d'id ou si son parent n'a pas de costumContext.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* const org = await api.organization({ slug: "navigatorDesTierslieux" });
|
|
121
|
-
* const form = await org.form({ id: "6925e2b05dd63b02ca70d6d9" });
|
|
122
|
-
* const page = await form.getAnswers({ sortBy: { created: -1 } });
|
|
123
|
-
* page.results; // Answer[]
|
|
124
|
-
* page.count.total; // nombre total
|
|
125
|
-
*/
|
|
126
|
-
async getAnswers(
|
|
127
|
-
data: Partial<CoformAnswersSearchData> = {},
|
|
128
|
-
options?: { restoredState?: PaginatorState }
|
|
129
|
-
): Promise<PaginatorPage<Answer>> {
|
|
130
|
-
if (!this.id) throw new ApiError("Form sans id, impossible de chercher ses réponses.", 400);
|
|
131
|
-
|
|
132
|
-
const parent = this.parent;
|
|
133
|
-
if (
|
|
134
|
-
!(parent instanceof BaseEntity)
|
|
135
|
-
|| typeof parent.serverData?.slug !== "string"
|
|
136
|
-
|| typeof parent.serverData?.id !== "string"
|
|
137
|
-
) {
|
|
138
|
-
throw new ApiError(
|
|
139
|
-
"form.getAnswers nécessite un Form créé via `org.form({id})` ou `project.form({id})` "
|
|
140
|
-
+ "(parent avec costumContext). Pour un Form isolé, utilisez "
|
|
141
|
-
+ "`organization.coformAnswersSearch({ filters: { form: form.id } })` directement.",
|
|
142
|
-
400
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Injecte filters.form = this.id et délègue au parent costum
|
|
147
|
-
const mergedFilters = { ...(data.filters ?? {}), form: this.id };
|
|
148
|
-
return parent.coformAnswersSearch(
|
|
149
|
-
{ ...data, filters: mergedFilters },
|
|
150
|
-
options
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* {@inheritDoc BaseEntity#answer}
|
|
156
|
-
*
|
|
157
|
-
* Crée une instance d'Answer **rattachée à ce Form**.
|
|
158
|
-
*
|
|
159
|
-
* - Si `answerData.id` est fourni → fetch l'Answer existante (via `COFORM_ANSWERS_BY_ID`).
|
|
160
|
-
* - Sinon → crée un draft d'Answer avec `form: this.id` pré-rempli, prêt à
|
|
161
|
-
* être complété puis sauvegardé.
|
|
162
|
-
*
|
|
163
|
-
* Le parent de l'Answer renvoyée est ce Form — la chaîne `org > form > answer`
|
|
164
|
-
* est donc préservée, ce qui permet (à terme) à l'Answer de remonter le
|
|
165
|
-
* costumContext via `this.parent.parent` si besoin.
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* // Fetch d'une Answer existante
|
|
169
|
-
* const form = await org.form({ id: "6925e2b05dd63b02ca70d6d9" });
|
|
170
|
-
* const answer = await form.answer({ id: "6925869ad76aaf6c5a2b2f8a" });
|
|
171
|
-
*
|
|
172
|
-
* // Création d'un draft
|
|
173
|
-
* const draft = await form.answer();
|
|
174
|
-
* draft.data.answers = { "field1": "value1" };
|
|
175
|
-
* await draft.save();
|
|
176
|
-
*/
|
|
177
|
-
override async answer(answerData: Parameters<BaseEntity<FormItemNormalized>["answer"]>[0] = {}): Promise<Answer> {
|
|
178
|
-
if (!this.id) {
|
|
179
|
-
throw new ApiError("Form sans id, impossible de créer une Answer rattachée.", 400);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Pré-remplit `form: this.id` uniquement pour les drafts (pas de fetch par id).
|
|
183
|
-
const hasId = typeof (answerData as { id?: string }).id === "string" && (answerData as { id: string }).id.length > 0;
|
|
184
|
-
const payload: Record<string, any> = hasId
|
|
185
|
-
? answerData
|
|
186
|
-
: { form: this.id, ...answerData };
|
|
187
|
-
|
|
188
|
-
const entity = await this.entity("answers", payload);
|
|
189
|
-
return entity as Answer;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Récupère la liste des contributeurs d'une table commune (commonTable) de CE formulaire.
|
|
194
|
-
*
|
|
195
|
-
* Pour un input `commonTable` et une ligne du tableau (un ou plusieurs `criteriaIds`
|
|
196
|
-
* dédupés côté React via `groupKey`), retourne les contributions individuelles
|
|
197
|
-
* (auteur, solution, satisfaction, note).
|
|
198
|
-
*
|
|
199
|
-
* Constant : GET_COFORM_COMMONTABLE_CONTRIBUTORS
|
|
200
|
-
* (POST /survey/coform/getcommontablecontributors, auth bearer).
|
|
201
|
-
*
|
|
202
|
-
* @param params.inputKey - Clé originale de l'input commonTable (sans préfixe yesOrNo).
|
|
203
|
-
* @param params.criteriaIds - criteriaIds de la ligne agrégée : tableau `string[]`
|
|
204
|
-
* (sérialisé automatiquement) ou string JSON déjà sérialisée.
|
|
205
|
-
* @returns La liste des contributions (une entrée par contribution).
|
|
206
|
-
* @throws {ApiError} si le Form n'a pas d'id.
|
|
207
|
-
*
|
|
208
|
-
* @example
|
|
209
|
-
* const form = await org.form({ id: "6925e2b05dd63b02ca70d6d9" });
|
|
210
|
-
* const contributors = await form.getCommonTableContributors({
|
|
211
|
-
* inputKey: "usagesEtSolutions",
|
|
212
|
-
* criteriaIds: ["criteria1778265370227"],
|
|
213
|
-
* });
|
|
214
|
-
*/
|
|
215
|
-
async getCommonTableContributors(
|
|
216
|
-
params: { inputKey: string; criteriaIds: string | string[] }
|
|
217
|
-
): Promise<CoformCommonTableContributor[]> {
|
|
218
|
-
const formId = this.id;
|
|
219
|
-
if (!formId) throw new ApiError("Form sans id, impossible de récupérer les contributeurs.", 400);
|
|
220
|
-
|
|
221
|
-
const criteriaIds = Array.isArray(params.criteriaIds)
|
|
222
|
-
? JSON.stringify(params.criteriaIds)
|
|
223
|
-
: params.criteriaIds;
|
|
224
|
-
|
|
225
|
-
const res = (await this.endpointApi.getCoformCommontableContributors({
|
|
226
|
-
formId,
|
|
227
|
-
inputKey: params.inputKey,
|
|
228
|
-
criteriaIds
|
|
229
|
-
})) as { data?: { contributors?: CoformCommonTableContributor[] } };
|
|
230
|
-
|
|
231
|
-
return res?.data?.contributors ?? [];
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Récupère en UN appel batch les catalogues collaboratifs des inputs
|
|
236
|
-
* `commonTable` de CE formulaire. Pour chaque `inputKey`, retourne les
|
|
237
|
-
* `criterias` agrégées par toutes les réponses + le comptage par
|
|
238
|
-
* `criteriaId`.
|
|
239
|
-
*
|
|
240
|
-
* Constant : `GET_COFORM_CATALOGS` (POST `/survey/coform/getformcatalogs`,
|
|
241
|
-
* auth: none — accessible aux visiteurs anonymes pour pré-remplir les
|
|
242
|
-
* suggestions côté input).
|
|
243
|
-
*
|
|
244
|
-
* Si `inputKeys` est vide, on lève une erreur — le caller doit gate
|
|
245
|
-
* l'appel en amont (cf. `useCoFormCatalogs` qui passe `enabled: false`).
|
|
246
|
-
*
|
|
247
|
-
* @param params.inputKeys - `fieldKey` de tous les inputs commonTable.
|
|
248
|
-
* @returns Map `inputKey → (criteriaId → entry)` ; `{}` pour un inputKey sans données.
|
|
249
|
-
* @throws {ApiError} 400 si Form sans id ou `inputKeys` vide.
|
|
250
|
-
*
|
|
251
|
-
* @example
|
|
252
|
-
* const form = await api.form({ id: formId });
|
|
253
|
-
* const catalogs = await form.getCatalogs({ inputKeys: ["usagesEtSolutions"] });
|
|
254
|
-
* catalogs["usagesEtSolutions"]; // {criteriaId: {label, count, name?, names?, ...}}
|
|
255
|
-
*/
|
|
256
|
-
async getCatalogs(params: { inputKeys: string[] }): Promise<CommonTableCatalogs> {
|
|
257
|
-
if (!this.id) throw new ApiError("Form sans id, impossible de récupérer ses catalogues.", 400);
|
|
258
|
-
if (!Array.isArray(params?.inputKeys) || params.inputKeys.length === 0) {
|
|
259
|
-
throw new ApiError("`inputKeys` requis et non vide pour getCatalogs.", 400);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
const requestData: GetCoformCatalogsData = {
|
|
263
|
-
formId: this.id,
|
|
264
|
-
// contentType form-urlencoded → sérialisation JSON string requise.
|
|
265
|
-
inputKeys: JSON.stringify(params.inputKeys),
|
|
266
|
-
};
|
|
267
|
-
// EndpointApi.call retourne le body HTTP ; succès serveur = {result: true, data: {inputKey: …}}.
|
|
268
|
-
// Quirk json_encode PHP : un catalogue vide (par clé, ou tout `data`) arrive en `[]` au lieu
|
|
269
|
-
// de `{}` — on normalise pour garantir le type map au caller.
|
|
270
|
-
const body = (await this.endpointApi.getCoformCatalogs(requestData)) as {
|
|
271
|
-
result?: boolean;
|
|
272
|
-
data?: Record<string, Record<string, CommonTableCatalogEntry> | []> | [];
|
|
273
|
-
};
|
|
274
|
-
const data = body?.data;
|
|
275
|
-
if (!data || typeof data !== "object" || Array.isArray(data)) return {};
|
|
276
|
-
const catalogs: CommonTableCatalogs = {};
|
|
277
|
-
for (const [inputKey, catalog] of Object.entries(data)) {
|
|
278
|
-
catalogs[inputKey] = catalog && typeof catalog === "object" && !Array.isArray(catalog) ? catalog : {};
|
|
279
|
-
}
|
|
280
|
-
return catalogs;
|
|
281
|
-
}
|
|
282
|
-
}
|