@communecter/cocolight-api-client 1.0.123 → 1.0.125

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.
@@ -442,7 +442,7 @@ export interface GetElementsAboutData {
442
442
  /**
443
443
  * Type d'entité
444
444
  */
445
- type: "citoyens" | "projects" | "organizations" | "events" | "poi" | "badges" | "answers";
445
+ type: "citoyens" | "projects" | "organizations" | "events" | "poi" | "badges" | "answers" | "classifieds" | "forms";
446
446
  /**
447
447
  * ID de l'utilisateur ou de l'entité
448
448
  */
@@ -991,6 +991,8 @@ export interface GlobalAutocompleteData {
991
991
  | "projects"
992
992
  | "citoyens"
993
993
  | "poi"
994
+ | "answers"
995
+ | "forms"
994
996
  )[];
995
997
  /**
996
998
  * Balises (tags) à utiliser pour filtrer la recherche
@@ -1008,6 +1010,8 @@ export interface GlobalAutocompleteData {
1008
1010
  | "projects"
1009
1011
  | "citoyens"
1010
1012
  | "poi"
1013
+ | "answers"
1014
+ | "forms"
1011
1015
  )[];
1012
1016
  /**
1013
1017
  * Critère de recherche (actuellement vide)
@@ -1604,7 +1608,9 @@ export interface GetOrganizationsAdminData {
1604
1608
  * Flag pour ne pas filtrer sur une clé de source spécifique
1605
1609
  */
1606
1610
  notSourceKey: true;
1607
- filters: {};
1611
+ filters: {
1612
+ [k: string]: unknown;
1613
+ };
1608
1614
  /**
1609
1615
  * Localité vide ou spécifique
1610
1616
  */
@@ -2624,22 +2630,6 @@ export interface AddFavorisData {
2624
2630
  */
2625
2631
  path: "preferences.search";
2626
2632
  arrayForm: true;
2627
- value: {
2628
- url: string;
2629
- name: string;
2630
- description?: string;
2631
- tags?: string[];
2632
- locality?: {
2633
- /**
2634
- * This interface was referenced by `undefined`'s JSON-Schema definition
2635
- * via the `patternProperty` "^[a-f0-9]{24}$".
2636
- */
2637
- [k: string]: {
2638
- name: string;
2639
- type: string;
2640
- };
2641
- };
2642
- };
2643
2633
  [k: string]: unknown;
2644
2634
  }
2645
2635
 
@@ -2777,6 +2767,237 @@ export interface AddOrganizationData {
2777
2767
  streetAddress?: string;
2778
2768
  };
2779
2769
  scope: "";
2770
+ /**
2771
+ * Nom de la structure porteuse (différent du nom du tiers-lieu)
2772
+ */
2773
+ holderOrganization?: string;
2774
+ /**
2775
+ * Mode de gestion (Association, Collectif citoyen, SCIC, etc.)
2776
+ */
2777
+ manageModel?: string;
2778
+ /**
2779
+ * Famille(s) de tiers-lieux (Coworking, Fablab, Foodlab, etc.)
2780
+ */
2781
+ typePlace?: string;
2782
+ /**
2783
+ * Réseau accompagnateur (ex: Compagnon France Tiers-Lieux)
2784
+ */
2785
+ compagnon?: string;
2786
+ /**
2787
+ * Surface bâtie en m²
2788
+ */
2789
+ buildingSurfaceArea?: number;
2790
+ /**
2791
+ * Surface extérieure en m²
2792
+ */
2793
+ siteSurfaceArea?: number;
2794
+ /**
2795
+ * Date d'ouverture du tiers-lieu (format libre, ex: 05/05/2026)
2796
+ */
2797
+ openingDate?: string;
2798
+ /**
2799
+ * Horaires d'ouverture (7 entrées, une par jour de la semaine ; "" pour un jour fermé). Doit rester synchronisé avec VIRTUAL_OPENING_HOURS dans Organization.ts.
2800
+ *
2801
+ * @minItems 7
2802
+ * @maxItems 7
2803
+ */
2804
+ openingHours?: [
2805
+ (
2806
+ | ""
2807
+ | {
2808
+ /**
2809
+ * Jour de la semaine
2810
+ */
2811
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2812
+ /**
2813
+ * Liste des créneaux horaires
2814
+ */
2815
+ hours: {
2816
+ /**
2817
+ * Heure d'ouverture (HH:MM)
2818
+ */
2819
+ opens: string;
2820
+ /**
2821
+ * Heure de fermeture (HH:MM)
2822
+ */
2823
+ closes: string;
2824
+ }[];
2825
+ }
2826
+ ),
2827
+ (
2828
+ | ""
2829
+ | {
2830
+ /**
2831
+ * Jour de la semaine
2832
+ */
2833
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2834
+ /**
2835
+ * Liste des créneaux horaires
2836
+ */
2837
+ hours: {
2838
+ /**
2839
+ * Heure d'ouverture (HH:MM)
2840
+ */
2841
+ opens: string;
2842
+ /**
2843
+ * Heure de fermeture (HH:MM)
2844
+ */
2845
+ closes: string;
2846
+ }[];
2847
+ }
2848
+ ),
2849
+ (
2850
+ | ""
2851
+ | {
2852
+ /**
2853
+ * Jour de la semaine
2854
+ */
2855
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2856
+ /**
2857
+ * Liste des créneaux horaires
2858
+ */
2859
+ hours: {
2860
+ /**
2861
+ * Heure d'ouverture (HH:MM)
2862
+ */
2863
+ opens: string;
2864
+ /**
2865
+ * Heure de fermeture (HH:MM)
2866
+ */
2867
+ closes: string;
2868
+ }[];
2869
+ }
2870
+ ),
2871
+ (
2872
+ | ""
2873
+ | {
2874
+ /**
2875
+ * Jour de la semaine
2876
+ */
2877
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2878
+ /**
2879
+ * Liste des créneaux horaires
2880
+ */
2881
+ hours: {
2882
+ /**
2883
+ * Heure d'ouverture (HH:MM)
2884
+ */
2885
+ opens: string;
2886
+ /**
2887
+ * Heure de fermeture (HH:MM)
2888
+ */
2889
+ closes: string;
2890
+ }[];
2891
+ }
2892
+ ),
2893
+ (
2894
+ | ""
2895
+ | {
2896
+ /**
2897
+ * Jour de la semaine
2898
+ */
2899
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2900
+ /**
2901
+ * Liste des créneaux horaires
2902
+ */
2903
+ hours: {
2904
+ /**
2905
+ * Heure d'ouverture (HH:MM)
2906
+ */
2907
+ opens: string;
2908
+ /**
2909
+ * Heure de fermeture (HH:MM)
2910
+ */
2911
+ closes: string;
2912
+ }[];
2913
+ }
2914
+ ),
2915
+ (
2916
+ | ""
2917
+ | {
2918
+ /**
2919
+ * Jour de la semaine
2920
+ */
2921
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2922
+ /**
2923
+ * Liste des créneaux horaires
2924
+ */
2925
+ hours: {
2926
+ /**
2927
+ * Heure d'ouverture (HH:MM)
2928
+ */
2929
+ opens: string;
2930
+ /**
2931
+ * Heure de fermeture (HH:MM)
2932
+ */
2933
+ closes: string;
2934
+ }[];
2935
+ }
2936
+ ),
2937
+ (
2938
+ | ""
2939
+ | {
2940
+ /**
2941
+ * Jour de la semaine
2942
+ */
2943
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2944
+ /**
2945
+ * Liste des créneaux horaires
2946
+ */
2947
+ hours: {
2948
+ /**
2949
+ * Heure d'ouverture (HH:MM)
2950
+ */
2951
+ opens: string;
2952
+ /**
2953
+ * Heure de fermeture (HH:MM)
2954
+ */
2955
+ closes: string;
2956
+ }[];
2957
+ }
2958
+ )
2959
+ ];
2960
+ /**
2961
+ * URLs de vidéos de présentation
2962
+ */
2963
+ video?: string[];
2964
+ /**
2965
+ * Numéro de téléphone de contact
2966
+ */
2967
+ telephone?: string;
2968
+ /**
2969
+ * Description longue (markdown supporté)
2970
+ */
2971
+ description?: string;
2972
+ /**
2973
+ * Source d'insertion (costum)
2974
+ */
2975
+ source?: {
2976
+ insertOrign?: string;
2977
+ keys?: string[];
2978
+ key?: string;
2979
+ [k: string]: unknown;
2980
+ };
2981
+ /**
2982
+ * Tag principal (ex: TiersLieux)
2983
+ */
2984
+ mainTag?: string;
2985
+ /**
2986
+ * Slug du costum d'origine
2987
+ */
2988
+ costumSlug?: string;
2989
+ /**
2990
+ * ID Mongo du costum d'origine
2991
+ */
2992
+ costumId?: string;
2993
+ /**
2994
+ * Type d'entité du costum (ex: projects)
2995
+ */
2996
+ costumType?: string;
2997
+ /**
2998
+ * Mode édition costum
2999
+ */
3000
+ costumEditMode?: boolean;
2780
3001
  [k: string]: unknown;
2781
3002
  }
2782
3003
 
@@ -4014,6 +4235,9 @@ export interface GlobalAutocompleteCostumData {
4014
4235
  | "events"
4015
4236
  | "citoyens"
4016
4237
  | "poi"
4238
+ | "answers"
4239
+ | "forms"
4240
+ | "classifieds"
4017
4241
  )[];
4018
4242
  /**
4019
4243
  * Balises (tags) à utiliser pour filtrer la recherche
@@ -4033,6 +4257,9 @@ export interface GlobalAutocompleteCostumData {
4033
4257
  | "events"
4034
4258
  | "citoyens"
4035
4259
  | "poi"
4260
+ | "answers"
4261
+ | "forms"
4262
+ | "classifieds"
4036
4263
  )[];
4037
4264
  /**
4038
4265
  * Critère de recherche (actuellement vide)
@@ -5023,12 +5250,22 @@ export interface UpdatePathValueData {
5023
5250
  /**
5024
5251
  * Collection de l’entité
5025
5252
  */
5026
- collection: "citoyens" | "organizations" | "projects" | "events" | "poi" | "answers" | "forms";
5253
+ collection: "citoyens" | "organizations" | "projects" | "events" | "poi" | "answers" | "forms" | "actions";
5027
5254
  /**
5028
5255
  * Chemin de la valeur à mettre à jour
5029
5256
  */
5030
5257
  path: string;
5258
+ /**
5259
+ * Chemin parent utilise pour une suppression (pull)
5260
+ */
5261
+ pull?: string;
5031
5262
  arrayForm?: boolean;
5263
+ setType?:
5264
+ | string
5265
+ | {
5266
+ path: string;
5267
+ type: string;
5268
+ }[];
5032
5269
  /**
5033
5270
  * Valeur à mettre à jour (peut être un objet, un tableau, une chaîne, etc.)
5034
5271
  */
@@ -5234,3 +5471,274 @@ export interface FundingEnvelopeData {
5234
5471
  };
5235
5472
  [k: string]: unknown;
5236
5473
  }
5474
+
5475
+
5476
+ export interface CoremuOperationData {
5477
+ /**
5478
+ * ID du formulaire
5479
+ */
5480
+ form: string;
5481
+ /**
5482
+ * Nouvelle réponse à créer
5483
+ */
5484
+ answer: "new";
5485
+ /**
5486
+ * Action à exécuter
5487
+ */
5488
+ action: "generateproposition";
5489
+ /**
5490
+ * ID du projet
5491
+ */
5492
+ project: string;
5493
+ [k: string]: unknown;
5494
+ }
5495
+
5496
+
5497
+ export interface CostumProjectActionRequestNewData {
5498
+ /**
5499
+ * Nom de l'action
5500
+ */
5501
+ name: string;
5502
+ /**
5503
+ * Statut de l'action
5504
+ */
5505
+ status: string;
5506
+ /**
5507
+ * ID du projet parent
5508
+ */
5509
+ parentId: string;
5510
+ /**
5511
+ * Type du parent
5512
+ */
5513
+ parentType: "projects";
5514
+ /**
5515
+ * Montant financé
5516
+ */
5517
+ credits: number;
5518
+ /**
5519
+ * ID du jalon associé
5520
+ */
5521
+ "milestone[milestoneId]": string;
5522
+ [k: string]: unknown;
5523
+ }
5524
+
5525
+
5526
+ export interface LinkDiscourseAccountData {
5527
+ /**
5528
+ * Nom d'utilisateur du compte Discourse
5529
+ */
5530
+ username: string;
5531
+ /**
5532
+ * Slug du costume
5533
+ */
5534
+ costumSlug: string;
5535
+ /**
5536
+ * ID du costume
5537
+ */
5538
+ costumId: string;
5539
+ /**
5540
+ * Type du costume
5541
+ */
5542
+ costumType: string;
5543
+ [k: string]: unknown;
5544
+ }
5545
+
5546
+
5547
+ export interface UnlinkDiscourseAccountData {
5548
+ /**
5549
+ * Slug du costume
5550
+ */
5551
+ costumSlug: string;
5552
+ /**
5553
+ * ID du costume
5554
+ */
5555
+ costumId: string;
5556
+ /**
5557
+ * Type du costume
5558
+ */
5559
+ costumType: string;
5560
+ [k: string]: unknown;
5561
+ }
5562
+
5563
+
5564
+ export interface DiscourseProfileData {
5565
+ /**
5566
+ * Nom d'utilisateur du compte Discourse
5567
+ */
5568
+ username: string;
5569
+ /**
5570
+ * Slug du costume
5571
+ */
5572
+ costumSlug: string;
5573
+ /**
5574
+ * ID du costume
5575
+ */
5576
+ costumId: string;
5577
+ /**
5578
+ * Type du costume
5579
+ */
5580
+ costumType: string;
5581
+ [k: string]: unknown;
5582
+ }
5583
+
5584
+
5585
+ export interface DiscourseCheckEmailData {
5586
+ /**
5587
+ * Slug du costume
5588
+ */
5589
+ costumSlug: string;
5590
+ /**
5591
+ * ID du costume
5592
+ */
5593
+ costumId: string;
5594
+ /**
5595
+ * Type du costume
5596
+ */
5597
+ costumType: string;
5598
+ [k: string]: unknown;
5599
+ }
5600
+
5601
+
5602
+ export interface DiscourseDismissLinkData {
5603
+ /**
5604
+ * Slug du costume
5605
+ */
5606
+ costumSlug: string;
5607
+ /**
5608
+ * ID du costume
5609
+ */
5610
+ costumId: string;
5611
+ /**
5612
+ * Type du costume
5613
+ */
5614
+ costumType: string;
5615
+ [k: string]: unknown;
5616
+ }
5617
+
5618
+
5619
+ export interface LinkMediawikiAccountData {
5620
+ /**
5621
+ * Nom d'utilisateur du compte MediaWiki
5622
+ */
5623
+ username: string;
5624
+ /**
5625
+ * Slug du costume
5626
+ */
5627
+ costumSlug: string;
5628
+ /**
5629
+ * ID du costume
5630
+ */
5631
+ costumId: string;
5632
+ /**
5633
+ * Type du costume
5634
+ */
5635
+ costumType: string;
5636
+ [k: string]: unknown;
5637
+ }
5638
+
5639
+
5640
+ export interface UnlinkMediawikiAccountData {
5641
+ /**
5642
+ * Slug du costume
5643
+ */
5644
+ costumSlug: string;
5645
+ /**
5646
+ * ID du costume
5647
+ */
5648
+ costumId: string;
5649
+ /**
5650
+ * Type du costume
5651
+ */
5652
+ costumType: string;
5653
+ [k: string]: unknown;
5654
+ }
5655
+
5656
+
5657
+ export interface GetMediawikiContributionsData {
5658
+ /**
5659
+ * Nom d'utilisateur du compte MediaWiki
5660
+ */
5661
+ username: string;
5662
+ /**
5663
+ * Nombre maximum de contributions à retourner
5664
+ */
5665
+ limit?: number;
5666
+ /**
5667
+ * Slug du costume
5668
+ */
5669
+ costumSlug: string;
5670
+ /**
5671
+ * ID du costume
5672
+ */
5673
+ costumId: string;
5674
+ /**
5675
+ * Type du costume
5676
+ */
5677
+ costumType: string;
5678
+ [k: string]: unknown;
5679
+ }
5680
+
5681
+
5682
+ export interface AddClassifiedData {
5683
+ id: string;
5684
+ collection: "classifieds";
5685
+ key: "classified";
5686
+ name: string;
5687
+ section: "need" | "offer";
5688
+ category: "service" | "competence" | "material";
5689
+ subtype: string;
5690
+ /**
5691
+ * Objet contenant les entités parentes (clé = ID). Si absent, le default pose l'utilisateur connecté comme parent.
5692
+ */
5693
+ parent?: {
5694
+ /**
5695
+ * This interface was referenced by `undefined`'s JSON-Schema definition
5696
+ * via the `patternProperty` "^(?:[a-f0-9]{24}|@userId)$".
5697
+ */
5698
+ [k: string]: {
5699
+ type: string;
5700
+ name?: string;
5701
+ };
5702
+ };
5703
+ description?: string;
5704
+ tags?: string[];
5705
+ preferences?: {
5706
+ isOpenData: boolean;
5707
+ isOpenEdition: boolean;
5708
+ [k: string]: unknown;
5709
+ };
5710
+ geo?: {
5711
+ "@type"?: "GeoCoordinates";
5712
+ latitude: string | number;
5713
+ longitude: string | number;
5714
+ };
5715
+ geoPosition?: {
5716
+ type: "Point";
5717
+ /**
5718
+ * @minItems 2
5719
+ * @maxItems 2
5720
+ */
5721
+ coordinates: [number, number];
5722
+ float: true;
5723
+ [k: string]: unknown;
5724
+ };
5725
+ address?: {
5726
+ "@type": "PostalAddress";
5727
+ addressCountry: string;
5728
+ codeInsee: string;
5729
+ addressLocality: string;
5730
+ localityId: string;
5731
+ level1: string;
5732
+ level1Name: string;
5733
+ level2?: string;
5734
+ level2Name?: string;
5735
+ level3?: string;
5736
+ level3Name?: string;
5737
+ level4?: string;
5738
+ level4Name?: string;
5739
+ postalCode?: string;
5740
+ streetAddress?: string;
5741
+ };
5742
+ scope: "";
5743
+ [k: string]: unknown;
5744
+ }
@@ -1,7 +1,7 @@
1
1
  // TypeScript native types
2
2
  import type { CollectionType } from "../types/entities.js";
3
3
 
4
- export type EntityTag = "User" | "Organization" | "Project" | "Event" | "Poi" | "Badge" | "News" | "Comment" | "Answer" | "Form";
4
+ export type EntityTag = "User" | "Organization" | "Project" | "Event" | "Poi" | "Badge" | "News" | "Comment" | "Answer" | "Form" | "Classified";
5
5
  export type CollectionKey = CollectionType; // Alias pour compatibilité
6
6
  type BaseEntity = import("./BaseEntity.js").BaseEntity<any>;
7
7
  type ApiClient = import("../ApiClient.js").default;
@@ -112,7 +112,8 @@ function _getCollectionFromTag(tag: EntityTag): CollectionKey | null {
112
112
  "Badge": "badges",
113
113
  "Comment": "comments",
114
114
  "Answer": "answers",
115
- "Form": "forms"
115
+ "Form": "forms",
116
+ "Classified": "classifieds"
116
117
  };
117
118
  return map[tag] || null;
118
119
  }
@@ -136,6 +137,7 @@ function _getEntityMeta(entityType: CollectionKey, __entityTag: EntityTag): Enti
136
137
  Comment: selfTag === "Comment" ? selfClass : EntityRegistry.get("Comment"),
137
138
  Answer: selfTag === "Answer" ? selfClass : EntityRegistry.get("Answer"),
138
139
  Form: selfTag === "Form" ? selfClass : EntityRegistry.get("Form"),
140
+ Classified: selfTag === "Classified" ? selfClass : EntityRegistry.get("Classified"),
139
141
  };
140
142
 
141
143
  const map: Record<CollectionKey, EntityMeta> = {
@@ -154,6 +156,7 @@ function _getEntityMeta(entityType: CollectionKey, __entityTag: EntityTag): Enti
154
156
  comments: { entityClass: commonDeps.Comment as EntityClass, deps: { ...commonDeps } },
155
157
  answers: { entityClass: commonDeps.Answer as EntityClass, deps: { ...commonDeps } },
156
158
  forms: { entityClass: commonDeps.Form as EntityClass, deps: { ...commonDeps } },
159
+ classifieds: { entityClass: commonDeps.Classified as EntityClass, deps: { ...commonDeps, Badge: undefined, News: undefined } },
157
160
  };
158
161
 
159
162
  return map[entityType] || null;
@@ -208,6 +211,10 @@ export function createFromCollection(collection: CollectionKey, parent: ApiClien
208
211
  forms: {
209
212
  entityTag: "Form",
210
213
  meta: tag => _buildMeta(tag, { remove: [] })
214
+ },
215
+ classifieds: {
216
+ entityTag: "Classified",
217
+ meta: tag => _buildMeta(tag, { remove: ["Badge","News"] })
211
218
  }
212
219
  };
213
220
  const entry = _collectionMap[collection];
@@ -240,7 +247,8 @@ function _buildMeta(tag: EntityTag, options: { remove: string[] }): EntityMeta {
240
247
  News: EntityRegistry.get("News"),
241
248
  Comment: EntityRegistry.get("Comment"),
242
249
  Answer: EntityRegistry.get("Answer"),
243
- Form: EntityRegistry.get("Form")
250
+ Form: EntityRegistry.get("Form"),
251
+ Classified: EntityRegistry.get("Classified")
244
252
  };
245
253
  // inject self
246
254
  (allDeps as any)[tag] = EntityClass;
package/src/api/Event.ts CHANGED
@@ -110,7 +110,12 @@ export class Event extends BaseEntity<EventItemNormalized> {
110
110
 
111
111
  async addEvent(data: Partial<AddEventData> = {}): Promise<unknown> {
112
112
 
113
- if (!this.isMe && !data.organizer && this.parent) {
113
+ // Si le parent direct n'est pas l'utilisateur connecté (ex: création via une org),
114
+ // on injecte l'organizer dans le payload. Sans ça, le default schéma `{ "@userId": ... }`
115
+ // pose me comme organizer — ce qui est faux pour `me.org().event()`.
116
+ // NB: this.isMe est trompeur ici car userContext propage jusqu'au User connecté
117
+ // (donc isMe=true même quand le parent direct est une org).
118
+ if (this.parent && this.parent.id && this.parent.id !== this.userId && !data.organizer) {
114
119
  (data as any).organizer = {};
115
120
  (data as any).organizer[`${this.parent.id}`] = {
116
121
  type: this.parent.getEntityType(),
@@ -93,6 +93,7 @@ export class Organization extends BaseEntity<OrganizationItemNormalized> {
93
93
 
94
94
  static ADD_BLOCKS = new Map([
95
95
  ["ADD_ORGANIZATION", "addOrganization"],
96
+ ["UPDATE_BLOCK_SOCIAL", "updateSocial"],
96
97
  ["PROFIL_IMAGE", "updateImageProfil"]
97
98
  ] as const);
98
99
 
@@ -136,11 +137,23 @@ export class Organization extends BaseEntity<OrganizationItemNormalized> {
136
137
  if (payload.slug) delete payload.slug;
137
138
 
138
139
  for (const [constant, methodName] of Array.from(Organization.ADD_BLOCKS)) {
140
+ const isCreateBlock = constant === "ADD_ORGANIZATION";
141
+
142
+ // Pour les blocks secondaires (UPDATE_BLOCK_SOCIAL, PROFIL_IMAGE), on aligne sur
143
+ // la logique de `_update` : on retire `id` du payload et on filtre via removeFields
144
+ // (typeElement). Ces auto-fields sont ré-injectés par la méthode block via `this.id`
145
+ // / `getEntityType()`. Sans ça, le block est invoqué dès qu'il y a un auto-field
146
+ // dans l'extraction et AJV rejette pour anyOf manquant (ex: UPDATE_BLOCK_SOCIAL
147
+ // sans aucun champ social).
148
+ const blockPayload: Record<string, any> = { ...payload, ...this.defaultFields };
149
+ if (!isCreateBlock) delete blockPayload.id;
150
+
139
151
  const blockData = this._extractChangedFieldsFromSchema(
140
152
  this.apiClient,
141
153
  constant,
142
- { ...payload, ...this.defaultFields },
143
- () => {}
154
+ blockPayload,
155
+ () => {},
156
+ isCreateBlock ? [] : this.removeFields
144
157
  );
145
158
  if (blockData && Object.keys(blockData).length > 0) {
146
159
  const data = await this._invokeBlockMethod(Organization.ADD_BLOCKS, methodName, blockData);