@communecter/cocolight-api-client 1.0.70 → 1.0.72

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@communecter/cocolight-api-client",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
4
4
  "description": "Client Axios simplifié pour l'API cocolight",
5
5
  "repository": {
6
6
  "type": "git",
@@ -547,6 +547,11 @@ export class BaseEntity<TServerData = any> {
547
547
  const transformed = this._transformServerData(newData);
548
548
  const incoming = (transformed ?? {});
549
549
  if (this._serverData && isReactive(this._serverData)) {
550
+ // Delete all existing properties to ensure fields removed on the server are also removed locally
551
+ for (const key of Object.keys(this._serverData)) {
552
+ delete this._serverData[key];
553
+ }
554
+ // Assign new properties
550
555
  Object.assign(this._serverData, incoming);
551
556
  } else {
552
557
  this._serverData = reactive({ ...incoming }) as TServerData & ReactiveData;
@@ -589,6 +594,14 @@ export class BaseEntity<TServerData = any> {
589
594
  }
590
595
 
591
596
  _updateDraftPreservingUserChanges(draft: Record<string, any>): void {
597
+ // First, remove keys from draftData that are no longer in the incoming draft
598
+ for (const key of Object.keys(this._draftData || {})) {
599
+ if (!(key in draft)) {
600
+ delete this._draftData[key];
601
+ }
602
+ }
603
+
604
+ // Then, update or add keys from the incoming draft (preserving user modifications)
592
605
  for (const key of Object.keys(draft)) {
593
606
  const current = this._draftData?.[key];
594
607
  const initialValue = this._initialDraftData?.[key];
@@ -2626,7 +2626,7 @@ export interface AddOrganizationData {
2626
2626
  /**
2627
2627
  * Site web
2628
2628
  */
2629
- url?: string;
2629
+ url?: string | "";
2630
2630
  preferences?: {
2631
2631
  /**
2632
2632
  * Open data (true/false)
@@ -2744,7 +2744,7 @@ export interface AddProjectData {
2744
2744
  /**
2745
2745
  * Site web
2746
2746
  */
2747
- url?: string;
2747
+ url?: string | "";
2748
2748
  preferences?: {
2749
2749
  /**
2750
2750
  * Open data (true/false)
@@ -3040,7 +3040,7 @@ export interface AddEventData {
3040
3040
  /**
3041
3041
  * Site web
3042
3042
  */
3043
- url?: string;
3043
+ url?: string | "";
3044
3044
  /**
3045
3045
  * Email de l’organisation
3046
3046
  */