@communecter/cocolight-api-client 1.0.79 → 1.0.80
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/ApiClient.ts +7 -0
- package/src/api/BaseEntity.ts +26 -1
- package/types/api/BaseEntity.d.ts +2 -1
package/package.json
CHANGED
package/src/ApiClient.ts
CHANGED
|
@@ -1383,6 +1383,13 @@ export default class ApiClient extends EventEmitter {
|
|
|
1383
1383
|
if(item?.author?.typeSig === "people"){
|
|
1384
1384
|
item.author.type = "citoyens";
|
|
1385
1385
|
}
|
|
1386
|
+
|
|
1387
|
+
if(item?.typeSig === "people"){
|
|
1388
|
+
item.collection = "citoyens";
|
|
1389
|
+
}
|
|
1390
|
+
if(item?.typeSig === "organizations"){
|
|
1391
|
+
item.collection = "organizations";
|
|
1392
|
+
}
|
|
1386
1393
|
|
|
1387
1394
|
// Convertit en EJSON si besoin
|
|
1388
1395
|
return this._fromJSONValue ? EJSON.fromJSONValue(item) : item;
|
package/src/api/BaseEntity.ts
CHANGED
|
@@ -42,7 +42,8 @@ import type {
|
|
|
42
42
|
GetSubscribersData,
|
|
43
43
|
GetBadgesData,
|
|
44
44
|
CoformAnswersSearchData,
|
|
45
|
-
ProfilBannerData
|
|
45
|
+
ProfilBannerData,
|
|
46
|
+
SearchMemberAutocompleteData
|
|
46
47
|
} from "./EndpointApi.types.js";
|
|
47
48
|
import type { GetElementsKeyResponse } from "../types/api-responses.js";
|
|
48
49
|
import type { TransformsMap } from "../types/entities.js";
|
|
@@ -4087,6 +4088,30 @@ export class BaseEntity<TServerData = any> {
|
|
|
4087
4088
|
return paginator.next() as Promise<PaginatorPage<any>>;
|
|
4088
4089
|
}
|
|
4089
4090
|
|
|
4091
|
+
async searchMembers(data: SearchMemberAutocompleteData) {
|
|
4092
|
+
// TODO: j'ai l'impression que searchMode : "organizationOnly" ne renvois pas que des organisations
|
|
4093
|
+
const result = await this.endpointApi.searchMemberAutocomplete(data);
|
|
4094
|
+
if (!result || !Array.isArray(result)) {
|
|
4095
|
+
return [];
|
|
4096
|
+
}
|
|
4097
|
+
|
|
4098
|
+
const t = this.getEntityType();
|
|
4099
|
+
if (t === "badges" || t === "news" || t === "poi" || t === "comments") {
|
|
4100
|
+
throw new ApiError(`Le type d'entité "${t}" n'est pas supporté par searchMemberAutocomplete.`, 400);
|
|
4101
|
+
}
|
|
4102
|
+
|
|
4103
|
+
result.forEach(item => {
|
|
4104
|
+
for (const key of Object.keys(item)) {
|
|
4105
|
+
if (!["id", "name", "slug", "profilThumbImageUrl", "profilMarkerImageUrl", "type", "collection"].includes(key)) {
|
|
4106
|
+
delete item[key];
|
|
4107
|
+
}
|
|
4108
|
+
}
|
|
4109
|
+
});
|
|
4110
|
+
|
|
4111
|
+
const rawList = this._linkEntities(result);
|
|
4112
|
+
return rawList;
|
|
4113
|
+
}
|
|
4114
|
+
|
|
4090
4115
|
}
|
|
4091
4116
|
|
|
4092
4117
|
export default BaseEntity;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, GetNewsData, GetGalleryData, GlobalAutocompleteCostumData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestDatesData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetOrganizationsAdminData, GetOrganizationsNoAdminData, GetProjectsAdminData, GetProjectsNoAdminData, GetPoisAdminData, GetPoisNoAdminData, GetSubscribersData, GetBadgesData, CoformAnswersSearchData } from "./EndpointApi.types.js";
|
|
1
|
+
import type { UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, GetNewsData, GetGalleryData, GlobalAutocompleteCostumData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestDatesData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetOrganizationsAdminData, GetOrganizationsNoAdminData, GetProjectsAdminData, GetProjectsNoAdminData, GetPoisAdminData, GetPoisNoAdminData, GetSubscribersData, GetBadgesData, CoformAnswersSearchData, SearchMemberAutocompleteData } from "./EndpointApi.types.js";
|
|
2
2
|
import type { TransformsMap } from "../types/entities.js";
|
|
3
3
|
/**
|
|
4
4
|
* Types pour les méthodes d'entité (organization, project, poi, event, badge, news)
|
|
@@ -1381,5 +1381,6 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1381
1381
|
*/
|
|
1382
1382
|
costumEventRequestLoadContextTag(data?: Partial<Omit<CostumEventRequestLoadContextTagData, "pathParams">>): Promise<unknown>;
|
|
1383
1383
|
coformAnswersSearch(data?: Partial<CoformAnswersSearchData>): Promise<PaginatorPage<any>>;
|
|
1384
|
+
searchMembers(data: SearchMemberAutocompleteData): Promise<any[]>;
|
|
1384
1385
|
}
|
|
1385
1386
|
export default BaseEntity;
|