@communecter/cocolight-api-client 1.0.170 → 1.0.172
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/4402.cocolight-api-client.browser.js +1 -1
- package/dist/4402.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/cocolight-api-client.browser.js +1 -1
- 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 +1 -1
- package/types/ApiClient.d.ts +7 -1
- package/types/api/BaseEntity.d.ts +43 -6
- package/types/api/EndpointApi.types.d.ts +6 -0
- package/types/costum/runtime.d.ts +4 -0
- package/types/costum/types.d.ts +5 -6
- package/types/endpoints.module.d.ts +6 -1
- package/types/index.d.ts +1 -0
package/package.json
CHANGED
package/types/ApiClient.d.ts
CHANGED
|
@@ -36,6 +36,12 @@ export interface ApiClientOptions {
|
|
|
36
36
|
*/
|
|
37
37
|
mode?: "legacy" | "clean";
|
|
38
38
|
tokenStorageStrategy?: TokenStorageStrategy | null;
|
|
39
|
+
/**
|
|
40
|
+
* Ignore les schémas costum BUNDLÉS et ne résout que par `getcostumjson` (cf. `setCostumForceLive`).
|
|
41
|
+
* À activer quand la config costum évolue en base plus vite que les artefacts publiés — sans quoi
|
|
42
|
+
* un artefact périmé masque indéfiniment les champs réels. Contrepartie : plus de démarrage à froid.
|
|
43
|
+
*/
|
|
44
|
+
costumForceLive?: boolean;
|
|
39
45
|
}
|
|
40
46
|
/**
|
|
41
47
|
* Structure des données pour les appels d'endpoint
|
|
@@ -96,7 +102,7 @@ export default class ApiClient extends EventEmitter {
|
|
|
96
102
|
private _refreshToken;
|
|
97
103
|
private _setUserId;
|
|
98
104
|
private _mode;
|
|
99
|
-
constructor({ baseURL, accessToken, refreshToken, refreshUrl, endpoints, timeout, debug, maxRetries, circuitBreakerThreshold, circuitBreakerResetTime, fromJSONValue, mode, tokenStorageStrategy }: ApiClientOptions);
|
|
105
|
+
constructor({ baseURL, accessToken, refreshToken, refreshUrl, endpoints, timeout, debug, maxRetries, circuitBreakerThreshold, circuitBreakerResetTime, fromJSONValue, mode, tokenStorageStrategy, costumForceLive }: ApiClientOptions);
|
|
100
106
|
/**
|
|
101
107
|
* Sets the access token for the API client and updates the authorization header.
|
|
102
108
|
*/
|
|
@@ -380,8 +380,22 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
380
380
|
_calledFromSave: boolean;
|
|
381
381
|
_syncReactiveDraft: boolean;
|
|
382
382
|
_isDeleted: boolean;
|
|
383
|
-
/** Contexte costum porté par cette instance (null hors d'un `CostumScope`). Posé au constructeur.
|
|
383
|
+
/** Contexte costum porté par cette instance (null hors d'un `CostumScope`). Posé au constructeur.
|
|
384
|
+
* Sens A — « quel costum définit le SCHÉMA de cet élément » : dérivé du `source.key` (provenance),
|
|
385
|
+
* ré-affirmé à chaque `_setData`. Gouverne draft/proxy, merge de schémas, héritage aux enfants. */
|
|
384
386
|
_costumCtx: CostumRuntimeContext | null;
|
|
387
|
+
/**
|
|
388
|
+
* Scope d'ADMINISTRATION costum — sens B : « au NOM de quel costum j'agis » (`validateGroup`,
|
|
389
|
+
* `addReference`/`removeReference`/`removeFromSource`, `previewImport`/`importElements`,
|
|
390
|
+
* `exportElements`). Distinct de `_costumCtx` (sens A, schéma) : l'hôte d'un site peut porter un
|
|
391
|
+
* `source.key` ÉTRANGER (sa provenance — ex. l'org `institutBleu`, créée sous « meir ») ; la
|
|
392
|
+
* provenance gouverne le schéma, PAS l'administration — sans cette séparation, `validateGroup`
|
|
393
|
+
* postait `costumSlug:"meir"` et (dé)posait `preferences.toBeValidated.meir` : validation sans
|
|
394
|
+
* effet (mesuré 2026-08-03, 7 sites de site-json concernés). Posé UNIQUEMENT par
|
|
395
|
+
* `setCostumScope`/`loadCostumScope` (jamais auto-dérivé), jamais touché par `_setData` :
|
|
396
|
+
* il SURVIT aux refresh/hydratations. @private
|
|
397
|
+
*/
|
|
398
|
+
private _adminScope;
|
|
385
399
|
_add?: ((payload: any) => Promise<void | unknown>) | undefined;
|
|
386
400
|
_update?: ((payload: any) => Promise<boolean>) | undefined;
|
|
387
401
|
_allowedFieldsCache?: string[];
|
|
@@ -1829,6 +1843,11 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1829
1843
|
/**
|
|
1830
1844
|
* L'entité porte-t-elle un contexte costum COMPLET (slug + costumId + costumType) ?
|
|
1831
1845
|
* Vrai pour une entité chargée avec un `source.key` connu, ou après `setCostumScope()`.
|
|
1846
|
+
*
|
|
1847
|
+
* ⚠️ Dit seulement s'IL Y A un scope, pas LEQUEL : un hôte dont le `source.key` est la provenance
|
|
1848
|
+
* d'un AUTRE costum répond `true` avec le mauvais slug. Pour administrer AU NOM d'un costum
|
|
1849
|
+
* précis, appeler `setCostumScope(slug, …)` inconditionnellement (idempotent) plutôt que de
|
|
1850
|
+
* court-circuiter sur ce test.
|
|
1832
1851
|
*/
|
|
1833
1852
|
hasCostumScope(): boolean;
|
|
1834
1853
|
/**
|
|
@@ -1847,6 +1866,12 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1847
1866
|
* Remplace la mutation externe de `_costumCtx` pratiquée par les fronts (champ INTERNE non
|
|
1848
1867
|
* contractuel) — cf. site-json `ensureCostumScope`, à migrer sur cette méthode.
|
|
1849
1868
|
*
|
|
1869
|
+
* ÉPINGLE aussi le scope d'ADMINISTRATION (`_adminScope`) : les méthodes admin agissent au nom
|
|
1870
|
+
* de CE slug, même si l'entité porte un `source.key` étranger (sa provenance, qui ne gouverne
|
|
1871
|
+
* que le schéma) — et le scope SURVIT aux refresh/hydratations (`_setData` re-dérive `_costumCtx`
|
|
1872
|
+
* du `source.key` sans toucher `_adminScope`). Poser le scope est donc à faire UNE fois,
|
|
1873
|
+
* inconditionnellement (idempotent), pas derrière un `if (hasCostumScope())`.
|
|
1874
|
+
*
|
|
1850
1875
|
* @param slug - Slug du costum (ex. `"equipementsSportifs974"`).
|
|
1851
1876
|
* @param opts.costumId / opts.costumType - Identité de l'élément hôte, requise si le costum
|
|
1852
1877
|
* n'est pas dans le registre bundlé (résolue par le front via slug/getinfo).
|
|
@@ -1855,6 +1880,13 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1855
1880
|
costumId?: string;
|
|
1856
1881
|
costumType?: string;
|
|
1857
1882
|
}): void;
|
|
1883
|
+
/**
|
|
1884
|
+
* Épingle le scope d'ADMINISTRATION (sens B) SI l'identité est complète — sinon no-op : les
|
|
1885
|
+
* méthodes admin retombent alors sur `_costumCtx` (comportement historique) et
|
|
1886
|
+
* `_requireCostumCtx` lève sa propre erreur explicite si lui aussi est incomplet.
|
|
1887
|
+
* @private
|
|
1888
|
+
*/
|
|
1889
|
+
private _setAdminScope;
|
|
1858
1890
|
/**
|
|
1859
1891
|
* Charge EN LIVE (via `getcostumjson`) le scope costum d'un slug HORS registre bundlé et pose le
|
|
1860
1892
|
* contexte COMPLET (champs/presets/hidden) sur cette entité — pour l'ÉDITER avec ses champs costum
|
|
@@ -1864,8 +1896,11 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1864
1896
|
*/
|
|
1865
1897
|
loadCostumScope(slug: string): Promise<boolean>;
|
|
1866
1898
|
/**
|
|
1867
|
-
*
|
|
1868
|
-
*
|
|
1899
|
+
* Identité costum au nom de laquelle AGIR (admin : validate/reference/import/export).
|
|
1900
|
+
* Priorité au scope EXPLICITE (`_adminScope`, posé par `setCostumScope`/`loadCostumScope` —
|
|
1901
|
+
* il survit aux re-hydratations), sinon fallback sur `_costumCtx` (provenance `source.key`,
|
|
1902
|
+
* comportement historique : un élément administré « chez lui » n'a rien à poser).
|
|
1903
|
+
* @throws {ApiError} si l'entité n'est rattachée à aucun costum.
|
|
1869
1904
|
* @private
|
|
1870
1905
|
*/
|
|
1871
1906
|
private _requireCostumCtx;
|
|
@@ -1890,7 +1925,8 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1890
1925
|
/**
|
|
1891
1926
|
* Importe en masse des éléments SOUS le costum de cette entité (IMPORT_ELEMENTS / importData).
|
|
1892
1927
|
* Méthode de haut niveau à PRÉFÉRER à `endpointApi.importElements`. `costumSlug/costumId/costumType`
|
|
1893
|
-
*
|
|
1928
|
+
* viennent du scope costum (explicite via `setCostumScope`, sinon dérivé du `source.key`) —
|
|
1929
|
+
* pas de paramètre costum à fournir. Les lignes sont
|
|
1894
1930
|
* découpées en lots (`chunkSize`) pour la progression ; `data` est JSON-encodé en interne. Le backend
|
|
1895
1931
|
* (re)vérifie + déduplique (update si le nom existe déjà) + insère + relie au costum.
|
|
1896
1932
|
*
|
|
@@ -1920,7 +1956,7 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1920
1956
|
private _summarizeImport;
|
|
1921
1957
|
/**
|
|
1922
1958
|
* Exporte les éléments du costum de cette entité (EXPORT_ELEMENTS / getCsvAdmin). Méthode haut niveau.
|
|
1923
|
-
* Scope
|
|
1959
|
+
* Scope = costum de l'entité (explicite via `setCostumScope`, sinon dérivé du `source.key`). RÉSERVÉ aux
|
|
1924
1960
|
* super-admins côté backend (gater l'UI via `me.isSuperAdmin()`). Renvoie `{ results, fields }` ;
|
|
1925
1961
|
* utiliser le helper `toCsv(results, fields)` pour produire le CSV téléchargeable.
|
|
1926
1962
|
*
|
|
@@ -1940,7 +1976,8 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1940
1976
|
}>;
|
|
1941
1977
|
/**
|
|
1942
1978
|
* (Dé)VALIDE un élément POUR le costum de cette entité (VALIDATE_GROUP / ValidateGroupAction). Méthode
|
|
1943
|
-
* haut niveau : `costumSlug`
|
|
1979
|
+
* haut niveau : `costumSlug` vient du scope costum (explicite via `setCostumScope`, sinon dérivé du
|
|
1980
|
+
* `source.key`) — pas de paramètre costum à fournir.
|
|
1944
1981
|
* (Dé)pose `preferences.toBeValidated[slug]` sur l'élément AVEC CASCADE sur les enfants liés
|
|
1945
1982
|
* (`source.keys ∋ slug`, hors citoyens) et les classifieds `parent.<id>`.
|
|
1946
1983
|
*
|
|
@@ -3113,6 +3113,12 @@ export interface AddProjectData {
|
|
|
3113
3113
|
* Site web
|
|
3114
3114
|
*/
|
|
3115
3115
|
url?: string | "";
|
|
3116
|
+
/**
|
|
3117
|
+
* Réseaux sociaux — objet keyé par plateforme (facebook/twitter/instagram/mastodon/telegram/…). dataBinding projet legacy `socialNetwork` (Project.php). La clé OBJET ENTIER manquait à Project là où Organization la déclare (Organization.php:82) : un client qui l'envoyait la voyait retirée à l'extraction, donc perdue en silence. Les réseaux un par un (`facebook`…) restent portés par UPDATE_BLOCK_SOCIAL.
|
|
3118
|
+
*/
|
|
3119
|
+
socialNetwork?: {
|
|
3120
|
+
[k: string]: string;
|
|
3121
|
+
};
|
|
3116
3122
|
preferences?: {
|
|
3117
3123
|
/**
|
|
3118
3124
|
* Open data (true/false)
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { CostumExtensionModule, CostumExtensionField, KnownCostumSlug, Collection } from "./types.js";
|
|
2
2
|
import type { BaseEntity } from "../api/BaseEntity.js";
|
|
3
|
+
/** Active/désactive FORCE-LIVE (cf. `COSTUM_FORCE_LIVE`). */
|
|
4
|
+
export declare function setCostumForceLive(actif: boolean): void;
|
|
5
|
+
/** État courant de FORCE-LIVE. */
|
|
6
|
+
export declare function isCostumForceLive(): boolean;
|
|
3
7
|
/**
|
|
4
8
|
* Invalide le cache costum live — d'UN slug (ex. après avoir modifié ce costum en base), ou de TOUT
|
|
5
9
|
* (`invalidateCostumCache()`). Le prochain accès refetchera `getcostumjson` (C2e). Sans effet sur le bundle.
|
package/types/costum/types.d.ts
CHANGED
|
@@ -328,14 +328,14 @@ export interface CostumFieldMap {
|
|
|
328
328
|
};
|
|
329
329
|
equipementsSportifs974: {
|
|
330
330
|
poi: {
|
|
331
|
-
aps_name?: string
|
|
331
|
+
aps_name?: string;
|
|
332
332
|
categorie?: string;
|
|
333
333
|
equip_acc_libre?: boolean;
|
|
334
334
|
equip_douche?: boolean;
|
|
335
335
|
equip_eclair?: boolean;
|
|
336
336
|
equip_gest_type?: string;
|
|
337
337
|
equip_larg?: number;
|
|
338
|
-
equip_loc_type?: string
|
|
338
|
+
equip_loc_type?: string;
|
|
339
339
|
equip_long?: number;
|
|
340
340
|
equip_maj_date?: string;
|
|
341
341
|
equip_nature?: string;
|
|
@@ -357,14 +357,14 @@ export interface CostumFieldMap {
|
|
|
357
357
|
equip_surf?: number;
|
|
358
358
|
equip_type_famille?: string;
|
|
359
359
|
equip_type_name?: string;
|
|
360
|
-
equip_utilisateur?: string
|
|
360
|
+
equip_utilisateur?: string;
|
|
361
361
|
inst_acc_handi_bool?: boolean;
|
|
362
362
|
inst_acc_handi_type?: string;
|
|
363
363
|
inst_date_creation?: string;
|
|
364
364
|
inst_enqu_date?: string;
|
|
365
365
|
inst_nom?: string;
|
|
366
366
|
inst_part_bool?: boolean;
|
|
367
|
-
inst_part_type?: string
|
|
367
|
+
inst_part_type?: string;
|
|
368
368
|
inst_trans_bool?: boolean;
|
|
369
369
|
inst_trans_type?: string;
|
|
370
370
|
};
|
|
@@ -933,14 +933,13 @@ export interface CostumFieldMap {
|
|
|
933
933
|
personInChargeName?: string;
|
|
934
934
|
personInChargeTelephone?: number;
|
|
935
935
|
personInChargeTitle?: "Président" | "Maire.sse" | "Chef.fe d'entreprise" | "Chef.fe d'établissement" | "Autre...";
|
|
936
|
-
recepisseDeclaration?: string;
|
|
937
936
|
representativeCivility?: string;
|
|
938
937
|
representativeEmail?: string;
|
|
939
938
|
representativeFirstName?: string;
|
|
940
939
|
representativeName?: string;
|
|
941
940
|
representativeTelephone?: number;
|
|
942
941
|
representativeTitle?: "Président" | "Maire.sse" | "Chef.fe d'entreprise" | "Chef.fe d'établissement" | "Autre...";
|
|
943
|
-
responsableCivilePro?: string
|
|
942
|
+
responsableCivilePro?: Record<string, unknown>;
|
|
944
943
|
responsableSameAsRepresent?: boolean;
|
|
945
944
|
sextionInfo?: Record<string, unknown>;
|
|
946
945
|
sextionInfoRepresentant?: Record<string, unknown>;
|
|
@@ -20427,6 +20427,12 @@ declare const endpoints: {
|
|
|
20427
20427
|
shortDescription: {
|
|
20428
20428
|
type: string;
|
|
20429
20429
|
};
|
|
20430
|
+
socialNetwork: {
|
|
20431
|
+
additionalProperties: {
|
|
20432
|
+
type: string;
|
|
20433
|
+
};
|
|
20434
|
+
type: string;
|
|
20435
|
+
};
|
|
20430
20436
|
tags: {
|
|
20431
20437
|
oneOf: ({
|
|
20432
20438
|
const: string;
|
|
@@ -20551,7 +20557,6 @@ declare const endpoints: {
|
|
|
20551
20557
|
mainTag?: undefined;
|
|
20552
20558
|
openingHours?: undefined;
|
|
20553
20559
|
role?: undefined;
|
|
20554
|
-
socialNetwork?: undefined;
|
|
20555
20560
|
telephone?: undefined;
|
|
20556
20561
|
thematic?: undefined;
|
|
20557
20562
|
video?: undefined;
|
package/types/index.d.ts
CHANGED
|
@@ -87,6 +87,7 @@ export { UPDATE_PATH_MAGIC } from "./api/BaseEntity.js";
|
|
|
87
87
|
export type { CostumScope, CostumRuntimeContext, CostumFormDescriptor, CostumFieldDescriptor, CostumFieldType, } from "./costum/runtime.js";
|
|
88
88
|
export type { Collection, KnownCostumSlug } from "./costum/types.js";
|
|
89
89
|
export { describeCostumForms } from "./costum/runtime.js";
|
|
90
|
+
export { resolveCostumScope, setCostumForceLive, isCostumForceLive } from "./costum/runtime.js";
|
|
90
91
|
export { describeEntityForm } from "./forms/entityForm.js";
|
|
91
92
|
export type { EntityFormDescriptor, BaseFieldDescriptor, EntityFieldType, EntityFieldFormat } from "./forms/entityForm.js";
|
|
92
93
|
export type { AllStepsData, PendingUploadValue, PendingUpload, ProcessUploadsOptions, AnswerGetOptions, UploadAnswerFileOptions, UploadAnswerFileResult, GetFilesOptions, AnswerFileItem, } from "./api/Answer.js";
|