@communecter/cocolight-api-client 1.0.56 → 1.0.58
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.ts +21 -13
- package/src/ApiClient.ts +2 -1
- package/src/api/Answer.ts +69 -0
- package/src/api/BaseEntity.ts +26 -9
- package/src/api/EndpointApi.ts +31 -1
- package/src/api/EndpointApi.types.ts +161 -1
- package/src/api/EntityRegistry.ts +10 -3
- package/src/api/News.ts +2 -4
- package/src/api/Organization.ts +10 -1
- package/src/api/User.ts +42 -1
- package/src/api/serverDataType/Answer.ts +54 -0
- package/src/endpoints.module.ts +97 -8
- package/src/index.ts +6 -0
- package/src/types/entities.ts +25 -1
- package/src/utils/reactive.ts +4 -0
- package/types/Api.d.ts +8 -23
- package/types/api/Answer.d.ts +23 -0
- package/types/api/BaseEntity.d.ts +9 -5
- package/types/api/EndpointApi.d.ts +19 -1
- package/types/api/EndpointApi.types.d.ts +155 -1
- package/types/api/EntityRegistry.d.ts +1 -1
- package/types/api/Organization.d.ts +8 -3
- package/types/api/Project.d.ts +1 -1
- package/types/api/User.d.ts +5 -0
- package/types/api/serverDataType/Answer.d.ts +50 -0
- package/types/endpoints.module.d.ts +330 -10
- package/types/index.d.ts +6 -0
- package/types/types/entities.d.ts +28 -1
package/src/index.ts
CHANGED
|
@@ -69,11 +69,17 @@ export type { Event } from "./api/Event.js";
|
|
|
69
69
|
export type { Poi } from "./api/Poi.js";
|
|
70
70
|
export type { Badge } from "./api/Badge.js";
|
|
71
71
|
export type { News } from "./api/News.js";
|
|
72
|
+
export type { Comment } from "./api/Comment.js";
|
|
73
|
+
export type { Answer } from "./api/Answer.js";
|
|
72
74
|
|
|
73
75
|
// Types ServerData (données normalisées reçues du serveur)
|
|
74
76
|
export type * from "./api/serverDataType/User.js";
|
|
75
77
|
export type * from "./api/serverDataType/Organization.js";
|
|
76
78
|
export type * from "./api/serverDataType/Project.js";
|
|
79
|
+
export type * from "./api/serverDataType/Event.js";
|
|
80
|
+
export type * from "./api/serverDataType/News.js";
|
|
81
|
+
export type * from "./api/serverDataType/Comment.js";
|
|
82
|
+
export type * from "./api/serverDataType/Answer.js";
|
|
77
83
|
export type * from "./api/serverDataType/common.js";
|
|
78
84
|
|
|
79
85
|
// Types utilitaires
|
package/src/types/entities.ts
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
// types/entities.ts - Types partagés pour éviter les dépendances circulaires
|
|
2
2
|
|
|
3
|
+
import type { Answer } from "../api/Answer.js";
|
|
4
|
+
import type { Badge } from "../api/Badge.js";
|
|
5
|
+
import type { Comment } from "../api/Comment.js";
|
|
6
|
+
import type { Event } from "../api/Event.js";
|
|
7
|
+
import type { News } from "../api/News.js";
|
|
8
|
+
import type { Organization } from "../api/Organization.js";
|
|
9
|
+
import type { Poi } from "../api/Poi.js";
|
|
10
|
+
import type { Project } from "../api/Project.js";
|
|
11
|
+
import type { User } from "../api/User.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Union type for all possible entity types
|
|
15
|
+
*/
|
|
16
|
+
export type EntityTypes = User | Organization | Project | Event | Poi | Badge | News | Comment | Answer;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Type pour récupérer une entité existante via l'API publique.
|
|
20
|
+
* Nécessite soit un id, soit un slug.
|
|
21
|
+
* Les propriétés additionnelles sont autorisées mais ignorées lors de la récupération.
|
|
22
|
+
*/
|
|
23
|
+
export type EntityData =
|
|
24
|
+
| { id: string; slug?: string; [key: string]: any }
|
|
25
|
+
| { slug: string; id?: string; [key: string]: any };
|
|
26
|
+
|
|
3
27
|
/**
|
|
4
28
|
* Types de collection possibles
|
|
5
29
|
*/
|
|
6
|
-
export type CollectionType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "badges" | "comments";
|
|
30
|
+
export type CollectionType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "badges" | "comments" | "answers";
|
|
7
31
|
|
|
8
32
|
/**
|
|
9
33
|
* Types pour les références entre entités
|
package/src/utils/reactive.ts
CHANGED
|
@@ -125,6 +125,10 @@ function _wrapReactive(obj: any, path: any = []) {
|
|
|
125
125
|
// Date objects
|
|
126
126
|
if (obj instanceof Date) return obj;
|
|
127
127
|
|
|
128
|
+
// ✨ AJOUT : Ne pas proxifier les instances d'entités BaseEntity
|
|
129
|
+
if (obj.__entityTag) return obj;
|
|
130
|
+
|
|
131
|
+
|
|
128
132
|
const signalMap = new Map();
|
|
129
133
|
const proxy = new Proxy(obj, {
|
|
130
134
|
|
package/types/Api.d.ts
CHANGED
|
@@ -1,33 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Comment } from "./api/Comment.js";
|
|
1
|
+
import { Answer } from "./api/Answer.js";
|
|
3
2
|
import EndpointApi from "./api/EndpointApi.js";
|
|
4
3
|
import { Event } from "./api/Event.js";
|
|
5
|
-
import { News } from "./api/News.js";
|
|
6
4
|
import { Organization } from "./api/Organization.js";
|
|
7
|
-
import { Poi } from "./api/Poi.js";
|
|
8
5
|
import { Project } from "./api/Project.js";
|
|
9
6
|
import { User } from "./api/User.js";
|
|
10
7
|
import { UserApi } from "./api/UserApi.js";
|
|
11
8
|
import type ApiClient from "./ApiClient.js";
|
|
12
9
|
import type { ApiClientOptions } from "./ApiClient.js";
|
|
13
|
-
|
|
14
|
-
* Union type for all possible entity types
|
|
15
|
-
*/
|
|
16
|
-
type EntityTypes = User | Organization | Project | Event | Poi | Badge | News | Comment;
|
|
17
|
-
/**
|
|
18
|
-
* Type pour récupérer une entité existante via l'API publique.
|
|
19
|
-
* Nécessite soit un id, soit un slug.
|
|
20
|
-
* Les propriétés additionnelles sont autorisées mais ignorées lors de la récupération.
|
|
21
|
-
*/
|
|
22
|
-
type EntityData = {
|
|
23
|
-
id: string;
|
|
24
|
-
slug?: string;
|
|
25
|
-
[key: string]: any;
|
|
26
|
-
} | {
|
|
27
|
-
slug: string;
|
|
28
|
-
id?: string;
|
|
29
|
-
[key: string]: any;
|
|
30
|
-
};
|
|
10
|
+
import type { EntityData, EntityTypes } from "./types/entities.js";
|
|
31
11
|
export default class Api {
|
|
32
12
|
private _loggedUser;
|
|
33
13
|
private _client;
|
|
@@ -67,6 +47,12 @@ export default class Api {
|
|
|
67
47
|
* Creates a new Event instance and optionally retrieves its profile.
|
|
68
48
|
*/
|
|
69
49
|
event(eventData: EntityData): Promise<Event>;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new Answer instance and optionally retrieves answer data.
|
|
52
|
+
*/
|
|
53
|
+
answer(answerData: {
|
|
54
|
+
id: string;
|
|
55
|
+
}): Promise<Answer>;
|
|
70
56
|
/**
|
|
71
57
|
* Retourne une entité à partir d'un slug.
|
|
72
58
|
*/
|
|
@@ -84,4 +70,3 @@ export default class Api {
|
|
|
84
70
|
*/
|
|
85
71
|
logout(): void;
|
|
86
72
|
}
|
|
87
|
-
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseEntity } from "./BaseEntity.js";
|
|
2
|
+
import type { AnswerItemNormalized } from "./serverDataType/Answer.js";
|
|
3
|
+
export declare class Answer extends BaseEntity<AnswerItemNormalized> {
|
|
4
|
+
static entityType: string;
|
|
5
|
+
static entityTag: string;
|
|
6
|
+
static SCHEMA_CONSTANTS: string[];
|
|
7
|
+
static ADD_BLOCKS: Map<string, string>;
|
|
8
|
+
static UPDATE_BLOCKS: Map<string, string>;
|
|
9
|
+
defaultFields: Record<string, any>;
|
|
10
|
+
removeFields: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Transforme les champs imbriqués (user, context etc.) en instances d'entités.
|
|
13
|
+
* @param data - Les données brutes du serveur.
|
|
14
|
+
* @returns Les données transformées.
|
|
15
|
+
* @protected
|
|
16
|
+
*/
|
|
17
|
+
protected _transformServerData(data: AnswerItemNormalized): AnswerItemNormalized;
|
|
18
|
+
/**
|
|
19
|
+
* Rafraîchit les données de l'entité depuis l'API.
|
|
20
|
+
* Constant : COFORM_ANSWERS_BY_ID
|
|
21
|
+
*/
|
|
22
|
+
get(): Promise<Record<string, any>>;
|
|
23
|
+
}
|
|
@@ -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 } 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 } 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)
|
|
@@ -40,7 +40,8 @@ type Poi = import("./Poi.js").Poi;
|
|
|
40
40
|
type News = import("./News.js").News;
|
|
41
41
|
type Badge = import("./Badge.js").Badge;
|
|
42
42
|
type Comment = import("./Comment.js").Comment;
|
|
43
|
-
type
|
|
43
|
+
type Answer = import("./Answer.js").Answer;
|
|
44
|
+
type AnyEntity = User | Organization | Project | Poi | EventEntity | Badge | News | Comment | Answer;
|
|
44
45
|
type ParentLike = BaseEntity<any> & {
|
|
45
46
|
apiClient: ApiClient;
|
|
46
47
|
userContext?: User | null;
|
|
@@ -59,6 +60,7 @@ interface Deps {
|
|
|
59
60
|
Badge?: any;
|
|
60
61
|
News?: any;
|
|
61
62
|
Comment?: any;
|
|
63
|
+
Answer?: any;
|
|
62
64
|
}
|
|
63
65
|
interface BaseEntityConfig {
|
|
64
66
|
entityTag?: string;
|
|
@@ -72,6 +74,7 @@ interface EntityTypeMap {
|
|
|
72
74
|
news: News;
|
|
73
75
|
badges: Badge;
|
|
74
76
|
comments: Comment;
|
|
77
|
+
answers: Answer;
|
|
75
78
|
}
|
|
76
79
|
type ReadableWithMeta = import("stream").Readable & {
|
|
77
80
|
path?: string;
|
|
@@ -111,7 +114,7 @@ interface LinkMeta {
|
|
|
111
114
|
}
|
|
112
115
|
type BaseEntityCtor = typeof BaseEntity & {
|
|
113
116
|
entityTag: string;
|
|
114
|
-
entityType: "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments";
|
|
117
|
+
entityType: "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers";
|
|
115
118
|
SCHEMA_CONSTANTS: string | string[];
|
|
116
119
|
};
|
|
117
120
|
interface FilterValueExistsOnly {
|
|
@@ -149,7 +152,7 @@ interface FinalizerResult<TOut> {
|
|
|
149
152
|
total: number;
|
|
150
153
|
} & Record<string, any>;
|
|
151
154
|
}
|
|
152
|
-
type EntityType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news";
|
|
155
|
+
type EntityType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers";
|
|
153
156
|
/**
|
|
154
157
|
* Classe de base pour toutes les entités métiers : utilisateurs, projets, organisations, etc.
|
|
155
158
|
* Fournit un système de brouillon (draft), transformation, appel API sécurisé,
|
|
@@ -229,7 +232,7 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
229
232
|
/** @returns Indique si cette entité représente l'utilisateur connecté */
|
|
230
233
|
get isMe(): boolean;
|
|
231
234
|
/** @returns Type de l'entité (ex: 'citoyens') */
|
|
232
|
-
getEntityType(): "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments";
|
|
235
|
+
getEntityType(): "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers";
|
|
233
236
|
/**
|
|
234
237
|
* Indique si le draft contient des modifications par rapport aux données initiales.
|
|
235
238
|
* @returns {boolean}
|
|
@@ -1318,5 +1321,6 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1318
1321
|
* @throws {Error}
|
|
1319
1322
|
*/
|
|
1320
1323
|
costumEventRequestLoadContextTag(data?: Partial<Omit<CostumEventRequestLoadContextTagData, "pathParams">>): Promise<unknown>;
|
|
1324
|
+
coformAnswersSearch(data?: Partial<CoformAnswersSearchData>): Promise<PaginatorPage<any>>;
|
|
1321
1325
|
}
|
|
1322
1326
|
export default BaseEntity;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type ApiClient from "../ApiClient.js";
|
|
2
|
-
import type { PersonRegisterData, AuthenticateUrlData, RefreshTokenUrlData, PasswordRecoveryData, ServerExchangeTokenData, ChangePasswordData, DeleteAccountData, UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, UpdateBlockSlugData, CheckData, ProfilImageData, GetElementsAboutData, MulticonnectData, GetNewsData, GetNewsByIdData, AddNewsData, AddImageNewsData, AddFileNewsData, DeleteNewsData, UpdateNewsData, ShareNewsData, GetCommentsData, AddCommentsData, DeleteCommentsData, UpdateCommentsData, SearchTagsData, ShowVoteData, GlobalAutocompleteData, CityAutocompleteData, CityAutocompleteByCountryData, SuggestionInputData, GetProjectsNoAdminData, GetProjectsAdminData, GetPoisNoAdminData, GetPoisAdminData, GetOrganizationsNoAdminData, GetOrganizationsAdminData, GetMembersNoAdminData, GetMembersAdminData, GetFriendsAdminData, GetSubscriptionsData, GetSubscriptionsAdminData, GetSubscribersData, GetSubscribersAdminData, GetContributorsNoAdminData, GetContributorsAdminData, GetBadgesData, GetBadgesFiltersData, ConnectData, DisconnectData, GetElementsKeyData, GetFavorisData, DeleteFavorisData, AddFavorisData, AddOrganizationData, AddProjectData, AddPoiData, AddEventData, DeletePoiData, DeleteEventData, DeleteElementData, AddImageElementData, LinkValidateData, SearchMemberAutocompleteData, GetNotificationsData, GetNotificationsCountData, NotificationUpdateData, MarkNotificationAsReadData, ActivitypubSearchData, ActivitypubLinkData, ActivitypubGetCommunityData, GetBadgeData, AddBadgesData, AssignBadgesData, GetEventsData, ShareEventsData, InviteEventData, FollowData, GetCostumJsonData, GlobalAutocompleteCostumData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestDatesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetGalleryData, GetAttendeesNoAdminData, GetAttendeesAdminData } from "./EndpointApi.types.js";
|
|
2
|
+
import type { PersonRegisterData, AuthenticateUrlData, RefreshTokenUrlData, PasswordRecoveryData, ServerExchangeTokenData, ChangePasswordData, DeleteAccountData, UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, UpdateBlockSlugData, CheckData, ProfilImageData, GetElementsAboutData, MulticonnectData, GetNewsData, GetNewsByIdData, AddNewsData, AddImageNewsData, AddFileNewsData, DeleteNewsData, UpdateNewsData, ShareNewsData, GetCommentsData, AddCommentsData, DeleteCommentsData, UpdateCommentsData, SearchTagsData, ShowVoteData, GlobalAutocompleteData, CityAutocompleteData, CityAutocompleteByCountryData, SuggestionInputData, GetProjectsNoAdminData, GetProjectsAdminData, GetPoisNoAdminData, GetPoisAdminData, GetOrganizationsNoAdminData, GetOrganizationsAdminData, GetMembersNoAdminData, GetMembersAdminData, GetFriendsAdminData, GetSubscriptionsData, GetSubscriptionsAdminData, GetSubscribersData, GetSubscribersAdminData, GetContributorsNoAdminData, GetContributorsAdminData, GetBadgesData, GetBadgesFiltersData, ConnectData, DisconnectData, GetElementsKeyData, GetFavorisData, DeleteFavorisData, AddFavorisData, AddOrganizationData, AddProjectData, AddPoiData, AddEventData, DeletePoiData, DeleteEventData, DeleteElementData, AddImageElementData, LinkValidateData, SearchMemberAutocompleteData, GetNotificationsData, GetNotificationsCountData, NotificationUpdateData, MarkNotificationAsReadData, ActivitypubSearchData, ActivitypubLinkData, ActivitypubGetCommunityData, GetBadgeData, AddBadgesData, AssignBadgesData, GetEventsData, ShareEventsData, InviteEventData, FollowData, GetCostumJsonData, GlobalAutocompleteCostumData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestDatesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetGalleryData, GetAttendeesNoAdminData, GetAttendeesAdminData, CoformAnswersSearchData, CoformAnswersByIdData } from "./EndpointApi.types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Classe EndpointApi générée automatiquement depuis endpoints-copie.json
|
|
5
5
|
*/
|
|
@@ -981,5 +981,23 @@ export declare class EndpointApi {
|
|
|
981
981
|
* @throws {Error} - En cas d'erreur inattendue.
|
|
982
982
|
*/
|
|
983
983
|
getAttendeesAdmin(data: GetAttendeesAdminData): Promise<any>;
|
|
984
|
+
/**
|
|
985
|
+
* Recherche des reponses des formulaires basées sur un coform : Effectue une recherche des reponses des formulaires basées sur un coform
|
|
986
|
+
* Constant : COFORM_ANSWERS_SEARCH
|
|
987
|
+
* @param data - Données envoyées à l'API
|
|
988
|
+
* @returns Les données de réponse.
|
|
989
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
990
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
991
|
+
*/
|
|
992
|
+
coformAnswersSearch(data: CoformAnswersSearchData): Promise<any>;
|
|
993
|
+
/**
|
|
994
|
+
* Récuperer une réponse de formulaire par son ID : Récuperer une réponse de formulaire par son ID
|
|
995
|
+
* Constant : COFORM_ANSWERS_BY_ID
|
|
996
|
+
* @param data - Données envoyées à l'API
|
|
997
|
+
* @returns Les données de réponse.
|
|
998
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
999
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1000
|
+
*/
|
|
1001
|
+
coformAnswersById(data: CoformAnswersByIdData): Promise<any>;
|
|
984
1002
|
}
|
|
985
1003
|
export default EndpointApi;
|
|
@@ -372,7 +372,7 @@ export interface GetElementsAboutData {
|
|
|
372
372
|
/**
|
|
373
373
|
* Type d'entité
|
|
374
374
|
*/
|
|
375
|
-
type: "citoyens" | "projects" | "organizations" | "events" | "poi" | "badges";
|
|
375
|
+
type: "citoyens" | "projects" | "organizations" | "events" | "poi" | "badges" | "answers";
|
|
376
376
|
/**
|
|
377
377
|
* ID de l'utilisateur ou de l'entité
|
|
378
378
|
*/
|
|
@@ -4231,3 +4231,157 @@ export interface GetAttendeesAdminData {
|
|
|
4231
4231
|
};
|
|
4232
4232
|
[k: string]: unknown;
|
|
4233
4233
|
}
|
|
4234
|
+
export interface CoformAnswersSearchData {
|
|
4235
|
+
/**
|
|
4236
|
+
* Nom ou mot-clé de la recherche
|
|
4237
|
+
*/
|
|
4238
|
+
name?: string;
|
|
4239
|
+
/**
|
|
4240
|
+
* Liste des localités ciblées avec leur identifiant et leur type (city ou level1)
|
|
4241
|
+
*/
|
|
4242
|
+
locality?: {
|
|
4243
|
+
/**
|
|
4244
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
4245
|
+
* via the `patternProperty` "^[^\s]+$".
|
|
4246
|
+
*/
|
|
4247
|
+
[k: string]: {
|
|
4248
|
+
/**
|
|
4249
|
+
* Identifiant de la localité
|
|
4250
|
+
*/
|
|
4251
|
+
id: string;
|
|
4252
|
+
/**
|
|
4253
|
+
* Type de la localité : 'cities' pour une ville ou 'level1' pour une région
|
|
4254
|
+
*/
|
|
4255
|
+
type: "cities" | "level1";
|
|
4256
|
+
};
|
|
4257
|
+
};
|
|
4258
|
+
/**
|
|
4259
|
+
* Types d'entités à inclure dans la recherche
|
|
4260
|
+
*/
|
|
4261
|
+
searchType: "answers"[];
|
|
4262
|
+
/**
|
|
4263
|
+
* Balises (tags) à utiliser pour filtrer la recherche
|
|
4264
|
+
*/
|
|
4265
|
+
searchTags?: string[];
|
|
4266
|
+
/**
|
|
4267
|
+
* Liste fixe des types à compter dans les résultats
|
|
4268
|
+
*/
|
|
4269
|
+
countType: "answers"[];
|
|
4270
|
+
/**
|
|
4271
|
+
* Critère de recherche (actuellement vide)
|
|
4272
|
+
*/
|
|
4273
|
+
searchBy?: "ALL";
|
|
4274
|
+
/**
|
|
4275
|
+
* Index de départ global pour la pagination
|
|
4276
|
+
*/
|
|
4277
|
+
indexMin: number;
|
|
4278
|
+
/**
|
|
4279
|
+
* Index de fin global pour la pagination
|
|
4280
|
+
*/
|
|
4281
|
+
indexMax?: number;
|
|
4282
|
+
/**
|
|
4283
|
+
* Nombre d’éléments à récupérer (limite de pagination)
|
|
4284
|
+
*/
|
|
4285
|
+
indexStep: number;
|
|
4286
|
+
/**
|
|
4287
|
+
* Configuration des plages de résultats pour chaque type de recherche
|
|
4288
|
+
*/
|
|
4289
|
+
ranges?: {
|
|
4290
|
+
/**
|
|
4291
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
4292
|
+
* via the `patternProperty` "^[^\s]+$".
|
|
4293
|
+
*/
|
|
4294
|
+
[k: string]: {
|
|
4295
|
+
/**
|
|
4296
|
+
* Index de départ pour la pagination
|
|
4297
|
+
*/
|
|
4298
|
+
indexMin: number;
|
|
4299
|
+
/**
|
|
4300
|
+
* Index de fin pour la pagination
|
|
4301
|
+
*/
|
|
4302
|
+
indexMax: number;
|
|
4303
|
+
};
|
|
4304
|
+
};
|
|
4305
|
+
/**
|
|
4306
|
+
* Type initial de la recherche, vide par défaut
|
|
4307
|
+
*/
|
|
4308
|
+
initType: "";
|
|
4309
|
+
/**
|
|
4310
|
+
* Indique si les types doivent être comptés dans les résultats
|
|
4311
|
+
*/
|
|
4312
|
+
count: true;
|
|
4313
|
+
/**
|
|
4314
|
+
* Filtres additionnels appliqués à la recherche (objet ou chaîne vide)
|
|
4315
|
+
*/
|
|
4316
|
+
filters?: {
|
|
4317
|
+
[k: string]: unknown;
|
|
4318
|
+
} | "";
|
|
4319
|
+
/**
|
|
4320
|
+
* Liste des champs à retourner
|
|
4321
|
+
*/
|
|
4322
|
+
fields?: string[];
|
|
4323
|
+
/**
|
|
4324
|
+
* Champ de tri (clé = champ, valeur = 1 ou -1)
|
|
4325
|
+
*/
|
|
4326
|
+
sortBy?: {
|
|
4327
|
+
[k: string]: 1 | -1;
|
|
4328
|
+
};
|
|
4329
|
+
/**
|
|
4330
|
+
* Indique si la recherche doit s'étendre au Fediverse (toujours désactivé)
|
|
4331
|
+
*/
|
|
4332
|
+
fediverse: boolean;
|
|
4333
|
+
/**
|
|
4334
|
+
* Indique si la recherche est effectuée à partir d'une carte (toujours désactivé)
|
|
4335
|
+
*/
|
|
4336
|
+
mapUsed?: true;
|
|
4337
|
+
/**
|
|
4338
|
+
* Indique si on doit exclure les éléments avec une source
|
|
4339
|
+
*/
|
|
4340
|
+
notSourceKey?: true;
|
|
4341
|
+
/**
|
|
4342
|
+
* ID du contexte de recherche (actuellement vide)
|
|
4343
|
+
*/
|
|
4344
|
+
contextId?: string;
|
|
4345
|
+
/**
|
|
4346
|
+
* Type de contexte de recherche (actuellement vide)
|
|
4347
|
+
*/
|
|
4348
|
+
contextType?: "projects" | "organizations";
|
|
4349
|
+
/**
|
|
4350
|
+
* Slug du costume utilisé pour la recherche
|
|
4351
|
+
*/
|
|
4352
|
+
costumSlug?: string;
|
|
4353
|
+
/**
|
|
4354
|
+
* Clés de source pour la recherche
|
|
4355
|
+
*/
|
|
4356
|
+
sourceKey?: string[];
|
|
4357
|
+
/**
|
|
4358
|
+
* Indique si le mode d'édition du costume est activé (toujours désactivé)
|
|
4359
|
+
*/
|
|
4360
|
+
costumEditMode?: boolean;
|
|
4361
|
+
options?: {
|
|
4362
|
+
tags?: {
|
|
4363
|
+
/**
|
|
4364
|
+
* Verbe d'action pour le filtre de recherche
|
|
4365
|
+
*/
|
|
4366
|
+
verb?: string;
|
|
4367
|
+
[k: string]: unknown;
|
|
4368
|
+
};
|
|
4369
|
+
[k: string]: unknown;
|
|
4370
|
+
};
|
|
4371
|
+
[k: string]: unknown;
|
|
4372
|
+
}
|
|
4373
|
+
export interface CoformAnswersByIdData {
|
|
4374
|
+
/**
|
|
4375
|
+
* ID de la réponse à récupérer
|
|
4376
|
+
*/
|
|
4377
|
+
answerId: string;
|
|
4378
|
+
/**
|
|
4379
|
+
* Chemin du finder utilisé pour la recherche (actuellement vide)
|
|
4380
|
+
*/
|
|
4381
|
+
finderPath?: string;
|
|
4382
|
+
/**
|
|
4383
|
+
* Liste des champs à retourner
|
|
4384
|
+
*/
|
|
4385
|
+
fields?: string[];
|
|
4386
|
+
[k: string]: unknown;
|
|
4387
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CollectionType } from "../types/entities.js";
|
|
2
|
-
export type EntityTag = "User" | "Organization" | "Project" | "Event" | "Poi" | "Badge" | "News" | "Comment";
|
|
2
|
+
export type EntityTag = "User" | "Organization" | "Project" | "Event" | "Poi" | "Badge" | "News" | "Comment" | "Answer";
|
|
3
3
|
export type CollectionKey = CollectionType;
|
|
4
4
|
type BaseEntity = import("./BaseEntity.js").BaseEntity<any>;
|
|
5
5
|
type ApiClient = import("../ApiClient.js").default;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { BaseEntity } from "./BaseEntity.js";
|
|
2
2
|
import type { PaginatorPage } from "./BaseEntity.js";
|
|
3
3
|
import type { AddOrganizationData, GetMembersAdminData, GetMembersNoAdminData } from "./EndpointApi.types.js";
|
|
4
|
+
import type { OrganizationItemNormalized } from "./serverDataType/Organization.js";
|
|
4
5
|
import type { User } from "./User.js";
|
|
5
|
-
type OrganizationItemNormalized = import("./serverDataType/Organization.js").OrganizationItemNormalized;
|
|
6
6
|
export declare class Organization extends BaseEntity<OrganizationItemNormalized> {
|
|
7
7
|
static entityType: string;
|
|
8
8
|
static entityTag: string;
|
|
9
9
|
static SCHEMA_CONSTANTS: string[];
|
|
10
|
-
static ADD_BLOCKS: Map<"PROFIL_IMAGE" | "ADD_ORGANIZATION", "
|
|
10
|
+
static ADD_BLOCKS: Map<"PROFIL_IMAGE" | "ADD_ORGANIZATION", "updateImageProfil" | "addOrganization">;
|
|
11
11
|
static UPDATE_BLOCKS: Map<"UPDATE_BLOCK_DESCRIPTION" | "UPDATE_BLOCK_INFO" | "UPDATE_BLOCK_SOCIAL" | "UPDATE_BLOCK_LOCALITY" | "UPDATE_BLOCK_SLUG" | "PROFIL_IMAGE", "updateImageProfil" | "updateDescription" | "updateSocial" | "updateLocality" | "updateInfo" | "updateSlug">;
|
|
12
12
|
defaultFields: Record<string, any>;
|
|
13
13
|
removeFields: string[];
|
|
@@ -199,5 +199,10 @@ export declare class Organization extends BaseEntity<OrganizationItemNormalized>
|
|
|
199
199
|
* Cette surcharge précise que la recherche est faite dans le contexte de l'organisation.
|
|
200
200
|
*/
|
|
201
201
|
searchCostum(data: Parameters<BaseEntity<OrganizationItemNormalized>["searchCostum"]>[0]): Promise<PaginatorPage<any>>;
|
|
202
|
+
/**
|
|
203
|
+
* {@inheritDoc BaseEntity#coformAnswersSearch}
|
|
204
|
+
*
|
|
205
|
+
* Cette méthode est redéfinie ici pour fournir des types spécifiques à l'entité Answer.
|
|
206
|
+
*/
|
|
207
|
+
coformAnswersSearch(data: Parameters<BaseEntity<OrganizationItemNormalized>["coformAnswersSearch"]>[0]): Promise<PaginatorPage<any>>;
|
|
202
208
|
}
|
|
203
|
-
export {};
|
package/types/api/Project.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare class Project extends BaseEntity<ProjectItemNormalized> {
|
|
|
9
9
|
static entityType: string;
|
|
10
10
|
static entityTag: string;
|
|
11
11
|
static SCHEMA_CONSTANTS: string[];
|
|
12
|
-
static ADD_BLOCKS: Map<"PROFIL_IMAGE" | "ADD_PROJECT", "
|
|
12
|
+
static ADD_BLOCKS: Map<"PROFIL_IMAGE" | "ADD_PROJECT", "addProject" | "updateImageProfil">;
|
|
13
13
|
static UPDATE_BLOCKS: Map<"UPDATE_BLOCK_DESCRIPTION" | "UPDATE_BLOCK_INFO" | "UPDATE_BLOCK_SOCIAL" | "UPDATE_BLOCK_LOCALITY" | "UPDATE_BLOCK_SLUG" | "PROFIL_IMAGE", "updateImageProfil" | "updateDescription" | "updateSocial" | "updateLocality" | "updateInfo" | "updateSlug">;
|
|
14
14
|
defaultFields: Record<string, any>;
|
|
15
15
|
removeFields: string[];
|
package/types/api/User.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Badge } from "./Badge.js";
|
|
|
3
3
|
import type { PaginatorPage } from "./BaseEntity.js";
|
|
4
4
|
import type { ChangePasswordData, DeleteAccountData, GetSubscriptionsAdminData, GetSubscriptionsData, GetOrganizationsNoAdminData, GetOrganizationsAdminData, GetFriendsAdminData } from "./EndpointApi.types.js";
|
|
5
5
|
import type { Organization } from "./Organization.js";
|
|
6
|
+
import type { EntityTypes } from "@/types/entities.js";
|
|
6
7
|
type ApiClient = import("../ApiClient.js").default;
|
|
7
8
|
type UserItemNormalized = import("./serverDataType/User.js").UserItemNormalized;
|
|
8
9
|
export declare class User extends BaseEntity<UserItemNormalized> {
|
|
@@ -328,5 +329,9 @@ export declare class User extends BaseEntity<UserItemNormalized> {
|
|
|
328
329
|
* @throws {ApiError}
|
|
329
330
|
*/
|
|
330
331
|
isFollowing(): boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Retourne une entité à partir d'un slug.
|
|
334
|
+
*/
|
|
335
|
+
entitySlug(slug: string): Promise<EntityTypes>;
|
|
331
336
|
}
|
|
332
337
|
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { DateValue, IdObject, ParentsMap } from "./common.js";
|
|
2
|
+
import type EJSONType from "../../EJSONType.js";
|
|
3
|
+
import type { Organization } from "../Organization.js";
|
|
4
|
+
import type { Project } from "../Project.js";
|
|
5
|
+
import type { User } from "../User.js";
|
|
6
|
+
type ObjectIDCtor = typeof EJSONType["ObjectID"];
|
|
7
|
+
type ObjectID = InstanceType<ObjectIDCtor>;
|
|
8
|
+
export interface AnswerLinksBlock {
|
|
9
|
+
answered: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface AnswerItemJson {
|
|
12
|
+
_id: IdObject;
|
|
13
|
+
collection: "answers";
|
|
14
|
+
created?: DateValue;
|
|
15
|
+
updated?: DateValue;
|
|
16
|
+
user?: string;
|
|
17
|
+
links?: AnswerLinksBlock;
|
|
18
|
+
draft?: boolean;
|
|
19
|
+
answers?: Record<string, unknown>;
|
|
20
|
+
context?: ParentsMap;
|
|
21
|
+
form?: string;
|
|
22
|
+
modified?: DateValue;
|
|
23
|
+
voteCount?: Record<string, number>;
|
|
24
|
+
vote: Record<string, {
|
|
25
|
+
status: string;
|
|
26
|
+
date: DateValue;
|
|
27
|
+
}>;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
export interface AnswerItemNormalized {
|
|
31
|
+
id: string;
|
|
32
|
+
_id: ObjectID;
|
|
33
|
+
collection: "answers";
|
|
34
|
+
created?: Date;
|
|
35
|
+
updated?: Date;
|
|
36
|
+
user?: string | User;
|
|
37
|
+
links?: AnswerLinksBlock;
|
|
38
|
+
draft?: boolean;
|
|
39
|
+
answers?: Record<string, unknown>;
|
|
40
|
+
context?: ParentsMap | Record<string, Organization | Project>;
|
|
41
|
+
form?: string;
|
|
42
|
+
modified?: Date;
|
|
43
|
+
voteCount?: Record<string, number>;
|
|
44
|
+
vote: Record<string, {
|
|
45
|
+
status: string;
|
|
46
|
+
date: Date;
|
|
47
|
+
}>;
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
}
|
|
50
|
+
export {};
|