@communecter/cocolight-api-client 1.0.91 → 1.0.93

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.91",
3
+ "version": "1.0.93",
4
4
  "description": "Client Axios simplifié pour l'API cocolight",
5
5
  "repository": {
6
6
  "type": "git",
package/src/ApiClient.ts CHANGED
@@ -1593,6 +1593,12 @@ export default class ApiClient extends EventEmitter {
1593
1593
  return { $date: value.sec * 1000 };
1594
1594
  } else if (typeof value === "number") {
1595
1595
  return { $date: value * 1000 };
1596
+ } else if (typeof value === "string" && value.trim() !== "") {
1597
+ const date = new Date(value);
1598
+ // Vérifier que la date est valide (pas NaN)
1599
+ if (!isNaN(date.getTime())) {
1600
+ return EJSON.toJSONValue(date);
1601
+ }
1596
1602
  }
1597
1603
  return value;
1598
1604
  }
@@ -1667,7 +1673,9 @@ export default class ApiClient extends EventEmitter {
1667
1673
 
1668
1674
  // Si la clé correspond à un champ de date, on applique la normalisation de date.
1669
1675
  if (this._dateFields.includes(key)) {
1676
+ console.log(key, value);
1670
1677
  value = this._normalizeDate(value);
1678
+ console.log("Date", key, value);
1671
1679
  }
1672
1680
 
1673
1681
  // Si la clé correspond à un champ d'image, on applique la normalisation d'image.
@@ -3088,7 +3088,7 @@ export interface AddEventData {
3088
3088
  * Description courte
3089
3089
  */
3090
3090
  shortDescription?: string;
3091
- tags?: string[];
3091
+ tags?: string[] | "";
3092
3092
  /**
3093
3093
  * Site web
3094
3094
  */
@@ -3096,7 +3096,7 @@ export interface AddEventData {
3096
3096
  /**
3097
3097
  * Email de l’organisation
3098
3098
  */
3099
- email?: string;
3099
+ email?: string | "";
3100
3100
  preferences?: {
3101
3101
  /**
3102
3102
  * Open data (true/false)
@@ -3315,33 +3315,35 @@ export interface AddEventData {
3315
3315
  float: true;
3316
3316
  [k: string]: unknown;
3317
3317
  };
3318
- address?: {
3319
- "@type": "PostalAddress";
3320
- addressCountry: string;
3321
- codeInsee: string;
3322
- addressLocality: string;
3323
- localityId: string;
3324
- level1: string;
3325
- level1Name: string;
3326
- /**
3327
- * ID du département. Peut être vide pour les pays étrangers.
3328
- */
3329
- level3?: string;
3330
- /**
3331
- * Nom du département. Peut être vide pour les pays étrangers.
3332
- */
3333
- level3Name?: string;
3334
- /**
3335
- * ID de la commune. Peut être vide pour les pays étrangers.
3336
- */
3337
- level4?: string;
3338
- /**
3339
- * Nom de la commune. Peut être vide pour les pays étrangers.
3340
- */
3341
- level4Name?: string;
3342
- postalCode?: string;
3343
- streetAddress?: string;
3344
- };
3318
+ address?:
3319
+ | ""
3320
+ | {
3321
+ "@type": "PostalAddress";
3322
+ addressCountry: string;
3323
+ codeInsee: string;
3324
+ addressLocality: string;
3325
+ localityId: string;
3326
+ level1: string;
3327
+ level1Name: string;
3328
+ /**
3329
+ * ID du département. Peut être vide pour les pays étrangers.
3330
+ */
3331
+ level3?: string;
3332
+ /**
3333
+ * Nom du département. Peut être vide pour les pays étrangers.
3334
+ */
3335
+ level3Name?: string;
3336
+ /**
3337
+ * ID de la commune. Peut être vide pour les pays étrangers.
3338
+ */
3339
+ level4?: string;
3340
+ /**
3341
+ * Nom de la commune. Peut être vide pour les pays étrangers.
3342
+ */
3343
+ level4Name?: string;
3344
+ postalCode?: string;
3345
+ streetAddress?: string;
3346
+ };
3345
3347
  scope: "";
3346
3348
  [k: string]: unknown;
3347
3349
  }