@communecter/cocolight-api-client 1.0.37 → 1.0.39
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/cocolight-api-client.browser.js +1 -1
- package/dist/cocolight-api-client.cjs +1 -1
- package/dist/cocolight-api-client.mjs.js +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/src/api/BaseEntity.js +16 -17
- package/src/api/Event.js +13 -0
- package/src/utils/reactive.js +16 -0
package/package.json
CHANGED
package/src/api/BaseEntity.js
CHANGED
|
@@ -2340,23 +2340,6 @@ export class BaseEntity {
|
|
|
2340
2340
|
return endpoint.request.properties[path].default;
|
|
2341
2341
|
}
|
|
2342
2342
|
|
|
2343
|
-
|
|
2344
|
-
/**
|
|
2345
|
-
* Recherche liée à l'entité, version stateless.
|
|
2346
|
-
*
|
|
2347
|
-
* @param {Object} data - Données initiales de recherche.
|
|
2348
|
-
* @returns {Object} - Un paginateur avec .next(), .prev(), etc.
|
|
2349
|
-
*/
|
|
2350
|
-
async searchCostum(data = {}) {
|
|
2351
|
-
|
|
2352
|
-
const paginator = this._createPaginatorEngine({
|
|
2353
|
-
initialData: data,
|
|
2354
|
-
finalizer: this._withCostumContext((finalData) => this.endpointApi.globalAutocompleteCostum(finalData)),
|
|
2355
|
-
});
|
|
2356
|
-
|
|
2357
|
-
return paginator.next();
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
2343
|
/**
|
|
2361
2344
|
* Coeur de pagination stateless et réutilisable, sans logique métier.
|
|
2362
2345
|
*
|
|
@@ -2491,6 +2474,22 @@ export class BaseEntity {
|
|
|
2491
2474
|
* ───────────────────────────────
|
|
2492
2475
|
*/
|
|
2493
2476
|
|
|
2477
|
+
/**
|
|
2478
|
+
* Recherche liée à l'entité, version stateless.
|
|
2479
|
+
*
|
|
2480
|
+
* @param {Object} data - Données initiales de recherche.
|
|
2481
|
+
* @returns {Object} - Un paginateur avec .next(), .prev(), etc.
|
|
2482
|
+
*/
|
|
2483
|
+
async searchCostum(data = {}) {
|
|
2484
|
+
|
|
2485
|
+
const paginator = this._createPaginatorEngine({
|
|
2486
|
+
initialData: data,
|
|
2487
|
+
finalizer: this._withCostumContext((finalData) => this.endpointApi.globalAutocompleteCostum(finalData)),
|
|
2488
|
+
});
|
|
2489
|
+
|
|
2490
|
+
return paginator.next();
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2494
2493
|
async costumEventRequestActors(data = {}){
|
|
2495
2494
|
|
|
2496
2495
|
data = {
|
package/src/api/Event.js
CHANGED
|
@@ -93,6 +93,19 @@ export class Event extends BaseEntity {
|
|
|
93
93
|
return hasChanged;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
async addEvent(data = {}) {
|
|
97
|
+
|
|
98
|
+
if (!this.isMe && !data.organizer) {
|
|
99
|
+
data.organizer = {};
|
|
100
|
+
data.organizer[`${this.parent.id}`] = {
|
|
101
|
+
type: this.parent.getEntityType(),
|
|
102
|
+
name: this.parent.name
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return this.callIsConnected(() => this.endpointApi.addEvent(data));
|
|
107
|
+
}
|
|
108
|
+
|
|
96
109
|
async getOrganizations() {
|
|
97
110
|
throw new ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`);
|
|
98
111
|
}
|
package/src/utils/reactive.js
CHANGED
|
@@ -186,6 +186,22 @@ export function getSignals(obj) {
|
|
|
186
186
|
return signalRegistry.get(obj);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
/**
|
|
190
|
+
* Permet à React de s'abonner à une propriété réactive (champ simple).
|
|
191
|
+
* @param {object} obj - Objet réactif
|
|
192
|
+
* @param {string} key - Nom de la propriété à écouter
|
|
193
|
+
* @param {(newValue: any, oldValue: any) => void} callback
|
|
194
|
+
* @returns {() => void} fonction de nettoyage
|
|
195
|
+
*/
|
|
196
|
+
export function subscribeTo(obj, key, callback) {
|
|
197
|
+
const signals = getSignals(obj);
|
|
198
|
+
const signal = signals?.get(key);
|
|
199
|
+
if (!signal || !signal.subscribe) {
|
|
200
|
+
return () => {}; // no-op si le champ n'existe pas
|
|
201
|
+
}
|
|
202
|
+
return signal.subscribe(() => callback(signal.value));
|
|
203
|
+
}
|
|
204
|
+
|
|
189
205
|
// --- Helpers internes ---
|
|
190
206
|
function _getPathValue(obj, path) {
|
|
191
207
|
return path.split(".").reduce((o, k) => (o ? o[k] : undefined), obj);
|