@communecter/cocolight-api-client 1.0.127 → 1.0.129
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 +2 -2
- 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 +6 -4
- package/src/ApiClient.ts +1 -1
- package/src/api/Action.ts +76 -0
- package/src/api/BaseEntity.ts +43 -22
- package/src/api/EndpointApi.types.ts +44 -8
- package/src/api/EntityRegistry.ts +16 -8
- package/src/api/Organization.ts +15 -4
- package/src/api/Project.ts +32 -3
- package/src/api/User.ts +1 -0
- package/src/api/UserApi.ts +3 -2
- package/src/api/serverDataType/Action.ts +177 -0
- package/src/endpoints.module.ts +113 -98
- package/src/index.ts +3 -0
- package/src/types/entities.ts +3 -2
- package/types/api/Action.d.ts +27 -0
- package/types/api/BaseEntity.d.ts +21 -4
- package/types/api/EndpointApi.types.d.ts +27 -7
- package/types/api/EntityRegistry.d.ts +1 -1
- package/types/api/Organization.d.ts +5 -0
- package/types/api/Project.d.ts +13 -0
- package/types/api/User.d.ts +1 -0
- package/types/api/serverDataType/Action.d.ts +150 -0
- package/types/endpoints.module.d.ts +7 -9
- package/types/index.d.ts +3 -0
- package/types/types/entities.d.ts +3 -2
package/src/index.ts
CHANGED
|
@@ -75,6 +75,7 @@ export type { News } from "./api/News.js";
|
|
|
75
75
|
export type { Comment } from "./api/Comment.js";
|
|
76
76
|
export type { Answer } from "./api/Answer.js";
|
|
77
77
|
export type { Form } from "./api/Form.js";
|
|
78
|
+
export type { Action } from "./api/Action.js";
|
|
78
79
|
|
|
79
80
|
// Types ServerData (données normalisées reçues du serveur)
|
|
80
81
|
export type * from "./api/serverDataType/User.js";
|
|
@@ -94,6 +95,8 @@ export type * from "./api/serverDataType/News.js";
|
|
|
94
95
|
export type * from "./api/serverDataType/Comment.js";
|
|
95
96
|
export type * from "./api/serverDataType/Answer.js";
|
|
96
97
|
export type * from "./api/serverDataType/Form.js";
|
|
98
|
+
export { ACTION_STATUSES } from "./api/serverDataType/Action.js";
|
|
99
|
+
export type * from "./api/serverDataType/Action.js";
|
|
97
100
|
export type * from "./api/serverDataType/common.js";
|
|
98
101
|
export type * from "./api/serverDataType/Country.js";
|
|
99
102
|
export type * from "./api/serverDataType/Zone.js";
|
package/src/types/entities.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// types/entities.ts - Types partagés pour éviter les dépendances circulaires
|
|
2
2
|
|
|
3
|
+
import type { Action } from "../api/Action.js";
|
|
3
4
|
import type { Answer } from "../api/Answer.js";
|
|
4
5
|
import type { Badge } from "../api/Badge.js";
|
|
5
6
|
import type { Classified } from "../api/Classified.js";
|
|
@@ -15,7 +16,7 @@ import type { User } from "../api/User.js";
|
|
|
15
16
|
/**
|
|
16
17
|
* Union type for all possible entity types
|
|
17
18
|
*/
|
|
18
|
-
export type EntityTypes = User | Organization | Project | Event | Poi | Badge | News | Comment | Answer | Form | Classified;
|
|
19
|
+
export type EntityTypes = User | Organization | Project | Event | Poi | Badge | News | Comment | Answer | Form | Classified | Action;
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Type union représentant les entités pouvant être retournées par une recherche.
|
|
@@ -35,7 +36,7 @@ export type EntityData =
|
|
|
35
36
|
/**
|
|
36
37
|
* Types de collection possibles
|
|
37
38
|
*/
|
|
38
|
-
export type CollectionType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "badges" | "comments" | "answers" | "forms" | "classifieds";
|
|
39
|
+
export type CollectionType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "badges" | "comments" | "answers" | "forms" | "classifieds" | "actions";
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* Types pour les références entre entités
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseEntity } from "./BaseEntity.js";
|
|
2
|
+
import type { CostumProjectActionRequestNewData } from "./EndpointApi.types.js";
|
|
3
|
+
import type { ActionItemNormalized } from "./serverDataType/Action.js";
|
|
4
|
+
/**
|
|
5
|
+
* Entité Action — tâche/jalon attaché à un Project.
|
|
6
|
+
*
|
|
7
|
+
* Toujours liée à un Project parent (parentType="projects" est const côté backend).
|
|
8
|
+
* S'instancie via `project.action(...)` plutôt que directement.
|
|
9
|
+
*
|
|
10
|
+
* Endpoints utilisés :
|
|
11
|
+
* - `get()` : hérité (GET_ELEMENTS_ABOUT via `/co2/element/about/type/actions/id/{id}`)
|
|
12
|
+
* - `_add()` : COSTUM_PROJECT_ACTION_REQUEST_NEW (parentId/parentType injectés depuis le parent)
|
|
13
|
+
*/
|
|
14
|
+
export declare class Action extends BaseEntity<ActionItemNormalized> {
|
|
15
|
+
static entityType: string;
|
|
16
|
+
static entityTag: string;
|
|
17
|
+
static SCHEMA_CONSTANTS: string[];
|
|
18
|
+
static ADD_BLOCKS: Map<"COSTUM_PROJECT_ACTION_REQUEST_NEW", "addAction">;
|
|
19
|
+
defaultFields: Record<string, any>;
|
|
20
|
+
removeFields: string[];
|
|
21
|
+
_add: (payload: Record<string, any>) => Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Crée une nouvelle action via /costum/project/action/request/new.
|
|
24
|
+
* Méthode de bas niveau — utiliser `save()` après modification du draft à la place.
|
|
25
|
+
*/
|
|
26
|
+
addAction(data?: Partial<CostumProjectActionRequestNewData>): Promise<unknown>;
|
|
27
|
+
}
|
|
@@ -35,6 +35,9 @@ type BadgeInput = {
|
|
|
35
35
|
type NewsInput = {
|
|
36
36
|
id: string;
|
|
37
37
|
} | Record<string, any>;
|
|
38
|
+
type ActionInput = {
|
|
39
|
+
id: string;
|
|
40
|
+
} | Record<string, any>;
|
|
38
41
|
type ApiClient = import("../ApiClient.js").default;
|
|
39
42
|
type EndpointApi = import("./EndpointApi.js").default;
|
|
40
43
|
type User = import("./User.js").User;
|
|
@@ -48,7 +51,8 @@ type Comment = import("./Comment.js").Comment;
|
|
|
48
51
|
type Answer = import("./Answer.js").Answer;
|
|
49
52
|
type Form = import("./Form.js").Form;
|
|
50
53
|
type Classified = import("./Classified.js").Classified;
|
|
51
|
-
type
|
|
54
|
+
type Action = import("./Action.js").Action;
|
|
55
|
+
type AnyEntity = User | Organization | Project | Poi | EventEntity | Badge | News | Comment | Answer | Form | Classified | Action;
|
|
52
56
|
type ParentLike = BaseEntity<any> & {
|
|
53
57
|
apiClient: ApiClient;
|
|
54
58
|
userContext?: User | null;
|
|
@@ -70,6 +74,7 @@ interface Deps {
|
|
|
70
74
|
Answer?: any;
|
|
71
75
|
Form?: any;
|
|
72
76
|
Classified?: any;
|
|
77
|
+
Action?: any;
|
|
73
78
|
}
|
|
74
79
|
interface BaseEntityConfig {
|
|
75
80
|
entityTag?: string;
|
|
@@ -86,6 +91,7 @@ interface EntityTypeMap {
|
|
|
86
91
|
answers: Answer;
|
|
87
92
|
forms: Form;
|
|
88
93
|
classifieds: Classified;
|
|
94
|
+
actions: Action;
|
|
89
95
|
}
|
|
90
96
|
type ReadableWithMeta = import("stream").Readable & {
|
|
91
97
|
path?: string;
|
|
@@ -174,7 +180,7 @@ interface LinkMeta {
|
|
|
174
180
|
}
|
|
175
181
|
type BaseEntityCtor = typeof BaseEntity & {
|
|
176
182
|
entityTag: string;
|
|
177
|
-
entityType: "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers" | "forms" | "classifieds";
|
|
183
|
+
entityType: "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers" | "forms" | "classifieds" | "actions";
|
|
178
184
|
SCHEMA_CONSTANTS: string | string[];
|
|
179
185
|
};
|
|
180
186
|
interface FilterValueExistsOnly {
|
|
@@ -215,7 +221,7 @@ interface FinalizerResult<TOut> {
|
|
|
215
221
|
total: number;
|
|
216
222
|
} & Record<string, any>;
|
|
217
223
|
}
|
|
218
|
-
export type EntityType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers" | "forms" | "classifieds";
|
|
224
|
+
export type EntityType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers" | "forms" | "classifieds" | "actions";
|
|
219
225
|
/**
|
|
220
226
|
* Classe de base pour toutes les entités métiers : utilisateurs, projets, organisations, etc.
|
|
221
227
|
* Fournit un système de brouillon (draft), transformation, appel API sécurisé,
|
|
@@ -300,7 +306,7 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
300
306
|
/** @returns Indique si cette entité représente l'utilisateur connecté */
|
|
301
307
|
get isMe(): boolean;
|
|
302
308
|
/** @returns Type de l'entité (ex: 'citoyens') */
|
|
303
|
-
getEntityType(): "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers" | "forms" | "classifieds";
|
|
309
|
+
getEntityType(): "citoyens" | "organizations" | "projects" | "events" | "poi" | "badges" | "news" | "comments" | "answers" | "forms" | "classifieds" | "actions";
|
|
304
310
|
/**
|
|
305
311
|
* Indique si le draft contient des modifications par rapport aux données initiales.
|
|
306
312
|
* @returns {boolean}
|
|
@@ -1124,6 +1130,17 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1124
1130
|
* @throws {Error} Si une erreur se produit lors de la création de la news.
|
|
1125
1131
|
*/
|
|
1126
1132
|
news(newsData?: NewsInput): Promise<News>;
|
|
1133
|
+
/**
|
|
1134
|
+
* Crée une instance d'Action et la récupère si nécessaire.
|
|
1135
|
+
*
|
|
1136
|
+
* Par défaut une action ne peut être créée que depuis un Project — les autres
|
|
1137
|
+
* entités lèvent une erreur. Override sur Project pour activer le comportement.
|
|
1138
|
+
*
|
|
1139
|
+
* @param actionData - Les données pour initialiser l'action.
|
|
1140
|
+
* @returns Une promesse qui résout l'objet Action créé.
|
|
1141
|
+
* @throws {ApiError} Sur les entités non supportées.
|
|
1142
|
+
*/
|
|
1143
|
+
action(_actionData?: ActionInput): Promise<Action>;
|
|
1127
1144
|
/**
|
|
1128
1145
|
* Récupérer les organisations d'une entitée : la liste des organisations dont l'entité est membre ou admin valide.
|
|
1129
1146
|
* Constant : GET_ORGANIZATIONS_ADMIN | GET_ORGANIZATIONS_NO_ADMIN
|
|
@@ -399,7 +399,7 @@ export interface GetElementsAboutData {
|
|
|
399
399
|
/**
|
|
400
400
|
* Type d'entité
|
|
401
401
|
*/
|
|
402
|
-
type: "citoyens" | "projects" | "organizations" | "events" | "poi" | "badges" | "answers" | "classifieds" | "forms";
|
|
402
|
+
type: "citoyens" | "projects" | "organizations" | "events" | "poi" | "badges" | "answers" | "classifieds" | "forms" | "actions";
|
|
403
403
|
/**
|
|
404
404
|
* ID de l'utilisateur ou de l'entité
|
|
405
405
|
*/
|
|
@@ -1524,8 +1524,13 @@ export interface GetMembersNoAdminData {
|
|
|
1524
1524
|
name?: string;
|
|
1525
1525
|
/**
|
|
1526
1526
|
* Types d'entités à inclure dans la recherche
|
|
1527
|
+
*
|
|
1528
|
+
* @minItems 1
|
|
1527
1529
|
*/
|
|
1528
|
-
searchType:
|
|
1530
|
+
searchType: [
|
|
1531
|
+
"citoyens" | "NGO" | "LocalBusiness" | "Group" | "GovernmentOrganization" | "Cooperative",
|
|
1532
|
+
...("citoyens" | "NGO" | "LocalBusiness" | "Group" | "GovernmentOrganization" | "Cooperative")[]
|
|
1533
|
+
];
|
|
1529
1534
|
/**
|
|
1530
1535
|
* Critère de recherche (actuellement vide)
|
|
1531
1536
|
*/
|
|
@@ -1597,8 +1602,13 @@ export interface GetMembersAdminData {
|
|
|
1597
1602
|
name?: string;
|
|
1598
1603
|
/**
|
|
1599
1604
|
* Types d'entités à inclure dans la recherche
|
|
1605
|
+
*
|
|
1606
|
+
* @minItems 1
|
|
1600
1607
|
*/
|
|
1601
|
-
searchType:
|
|
1608
|
+
searchType: [
|
|
1609
|
+
"citoyens" | "NGO" | "LocalBusiness" | "Group" | "GovernmentOrganization" | "Cooperative",
|
|
1610
|
+
...("citoyens" | "NGO" | "LocalBusiness" | "Group" | "GovernmentOrganization" | "Cooperative")[]
|
|
1611
|
+
];
|
|
1602
1612
|
/**
|
|
1603
1613
|
* Critère de recherche (actuellement vide)
|
|
1604
1614
|
*/
|
|
@@ -2036,8 +2046,13 @@ export interface GetContributorsNoAdminData {
|
|
|
2036
2046
|
name?: string;
|
|
2037
2047
|
/**
|
|
2038
2048
|
* Types d'entités à inclure dans la recherche
|
|
2049
|
+
*
|
|
2050
|
+
* @minItems 1
|
|
2039
2051
|
*/
|
|
2040
|
-
searchType:
|
|
2052
|
+
searchType: [
|
|
2053
|
+
"citoyens" | "NGO" | "LocalBusiness" | "Group" | "GovernmentOrganization" | "Cooperative",
|
|
2054
|
+
...("citoyens" | "NGO" | "LocalBusiness" | "Group" | "GovernmentOrganization" | "Cooperative")[]
|
|
2055
|
+
];
|
|
2041
2056
|
/**
|
|
2042
2057
|
* Critère de recherche (actuellement vide)
|
|
2043
2058
|
*/
|
|
@@ -2109,8 +2124,13 @@ export interface GetContributorsAdminData {
|
|
|
2109
2124
|
name?: string;
|
|
2110
2125
|
/**
|
|
2111
2126
|
* Types d'entités à inclure dans la recherche
|
|
2127
|
+
*
|
|
2128
|
+
* @minItems 1
|
|
2112
2129
|
*/
|
|
2113
|
-
searchType:
|
|
2130
|
+
searchType: [
|
|
2131
|
+
"citoyens" | "NGO" | "LocalBusiness" | "Group" | "GovernmentOrganization" | "Cooperative",
|
|
2132
|
+
...("citoyens" | "NGO" | "LocalBusiness" | "Group" | "GovernmentOrganization" | "Cooperative")[]
|
|
2133
|
+
];
|
|
2114
2134
|
/**
|
|
2115
2135
|
* Critère de recherche (actuellement vide)
|
|
2116
2136
|
*/
|
|
@@ -4834,9 +4854,9 @@ export interface UpdatePathValueData {
|
|
|
4834
4854
|
/**
|
|
4835
4855
|
* Valeur à mettre à jour (peut être un objet, un tableau, une chaîne, etc.)
|
|
4836
4856
|
*/
|
|
4837
|
-
value: {
|
|
4857
|
+
value: string | number | boolean | {
|
|
4838
4858
|
[k: string]: unknown;
|
|
4839
|
-
};
|
|
4859
|
+
} | unknown[] | null;
|
|
4840
4860
|
[k: string]: unknown;
|
|
4841
4861
|
}
|
|
4842
4862
|
export interface DeleteDocumentByContextData {
|
|
@@ -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" | "Answer" | "Form" | "Classified";
|
|
2
|
+
export type EntityTag = "User" | "Organization" | "Project" | "Event" | "Poi" | "Badge" | "News" | "Comment" | "Answer" | "Form" | "Classified" | "Action";
|
|
3
3
|
export type CollectionKey = CollectionType;
|
|
4
4
|
type BaseEntity = import("./BaseEntity.js").BaseEntity<any>;
|
|
5
5
|
type ApiClient = import("../ApiClient.js").default;
|
|
@@ -156,7 +156,11 @@ export declare class Organization extends BaseEntity<OrganizationItemNormalized>
|
|
|
156
156
|
* // Récupérer les membres en attente de validation pour être admin
|
|
157
157
|
* const adminPendingMembers = await organization.getMembers({}, { isAdminPending: true });
|
|
158
158
|
*
|
|
159
|
+
* // Restreindre la recherche : uniquement les citoyens
|
|
160
|
+
* const onlyCitoyens = await organization.getMembers({}, { searchType: "citoyens" });
|
|
159
161
|
*
|
|
162
|
+
* // Restreindre la recherche : uniquement les organisations
|
|
163
|
+
* const onlyOrgas = await organization.getMembers({}, { searchType: "organizations" });
|
|
160
164
|
*/
|
|
161
165
|
getMembers(data?: Partial<GetMembersAdminData | GetMembersNoAdminData>, options?: {
|
|
162
166
|
toBeValidated?: boolean;
|
|
@@ -164,6 +168,7 @@ export declare class Organization extends BaseEntity<OrganizationItemNormalized>
|
|
|
164
168
|
isAdminPending?: boolean;
|
|
165
169
|
isInviting?: boolean;
|
|
166
170
|
roles?: any[];
|
|
171
|
+
searchType?: "all" | "citoyens" | "organizations";
|
|
167
172
|
restoredState?: PaginatorState;
|
|
168
173
|
}): Promise<PaginatorPage<User | Organization>>;
|
|
169
174
|
/**
|
package/types/api/Project.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseEntity } from "./BaseEntity.js";
|
|
2
|
+
import type { Action } from "./Action.js";
|
|
2
3
|
import type { PaginatorPage, PaginatorState } from "./BaseEntity.js";
|
|
3
4
|
import type { AddProjectData, GetContributorsAdminData, GetContributorsNoAdminData } from "./EndpointApi.types.js";
|
|
4
5
|
import type { Organization } from "./Organization.js";
|
|
@@ -90,6 +91,11 @@ export declare class Project extends BaseEntity<ProjectItemNormalized> {
|
|
|
90
91
|
* // Récupérer les contributeurs en attente d'invitation
|
|
91
92
|
* const invitingContributors = await project.getContributors({}, { isInviting: true });
|
|
92
93
|
*
|
|
94
|
+
* // Restreindre la recherche : uniquement les citoyens
|
|
95
|
+
* const onlyCitoyens = await project.getContributors({}, { searchType: "citoyens" });
|
|
96
|
+
*
|
|
97
|
+
* // Restreindre la recherche : uniquement les organisations
|
|
98
|
+
* const onlyOrgas = await project.getContributors({}, { searchType: "organizations" });
|
|
93
99
|
*/
|
|
94
100
|
getContributors(data?: Partial<GetContributorsAdminData | GetContributorsNoAdminData>, options?: {
|
|
95
101
|
toBeValidated?: boolean;
|
|
@@ -97,6 +103,7 @@ export declare class Project extends BaseEntity<ProjectItemNormalized> {
|
|
|
97
103
|
isAdminPending?: boolean;
|
|
98
104
|
isInviting?: boolean;
|
|
99
105
|
roles?: any[];
|
|
106
|
+
searchType?: "all" | "citoyens" | "organizations";
|
|
100
107
|
restoredState?: PaginatorState;
|
|
101
108
|
}): Promise<PaginatorPage<User | Organization>>;
|
|
102
109
|
/**
|
|
@@ -135,6 +142,12 @@ export declare class Project extends BaseEntity<ProjectItemNormalized> {
|
|
|
135
142
|
* Crée une instance de news et la récupère si nécessaire.
|
|
136
143
|
*/
|
|
137
144
|
news(newsData?: Parameters<BaseEntity<ProjectItemNormalized>["news"]>[0]): Promise<import("./News.js").News>;
|
|
145
|
+
/**
|
|
146
|
+
* {@inheritDoc BaseEntity#action}
|
|
147
|
+
*
|
|
148
|
+
* Crée une instance d'Action liée à ce projet et la récupère si nécessaire.
|
|
149
|
+
*/
|
|
150
|
+
action(actionData?: Parameters<BaseEntity<ProjectItemNormalized>["action"]>[0]): Promise<Action>;
|
|
138
151
|
/**
|
|
139
152
|
* ───────────────────────────────
|
|
140
153
|
* Lien utilisateur ↔ projet
|
package/types/api/User.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export declare class User extends BaseEntity<UserItemNormalized> {
|
|
|
46
46
|
Comment: typeof import("./Comment.js").Comment;
|
|
47
47
|
Answer: typeof import("./Answer.js").Answer;
|
|
48
48
|
Classified?: typeof import("./Classified.js").Classified;
|
|
49
|
+
Action?: typeof import("./Action.js").Action;
|
|
49
50
|
});
|
|
50
51
|
get slug(): any;
|
|
51
52
|
get isMe(): boolean;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { IdObject, LinkContributorsRef, ParentsMap, DateValue } from "./common.js";
|
|
2
|
+
import type EJSONType from "../../EJSONType.js";
|
|
3
|
+
type ObjectIDCtor = typeof EJSONType["ObjectID"];
|
|
4
|
+
type ObjectID = InstanceType<ObjectIDCtor>;
|
|
5
|
+
/**
|
|
6
|
+
* Statuts supportés par une action (cf. COSTUM_PROJECT_ACTION_REQUEST_NEW).
|
|
7
|
+
*/
|
|
8
|
+
export declare const ACTION_STATUSES: readonly ["todo", "done", "tracking", "discuter", "next", "totest", "disabled", "closed"];
|
|
9
|
+
export type ActionStatus = (typeof ACTION_STATUSES)[number];
|
|
10
|
+
export interface ActionLinksBlock {
|
|
11
|
+
contributors?: Record<string, LinkContributorsRef>;
|
|
12
|
+
[k: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface ActionMilestoneRef {
|
|
15
|
+
milestoneId: string;
|
|
16
|
+
startDate?: DateValue;
|
|
17
|
+
endDate?: DateValue;
|
|
18
|
+
}
|
|
19
|
+
export interface ActionCounts {
|
|
20
|
+
contributors?: number;
|
|
21
|
+
[k: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Historique des changements de statut (alimenté par /set_status côté backend).
|
|
25
|
+
* `update` est un MongoDate (DateValue côté Json, Date côté Normalized).
|
|
26
|
+
*/
|
|
27
|
+
export interface ActionUpdateStatusEntryJson {
|
|
28
|
+
status: ActionStatus;
|
|
29
|
+
author: string;
|
|
30
|
+
update: DateValue;
|
|
31
|
+
}
|
|
32
|
+
export interface ActionUpdateStatusEntryNormalized {
|
|
33
|
+
status: ActionStatus;
|
|
34
|
+
author: string;
|
|
35
|
+
update: Date;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Sous-tâche d'une action. Stockée dans `tasks[]`.
|
|
39
|
+
*/
|
|
40
|
+
export interface ActionTaskJson {
|
|
41
|
+
taskId?: string;
|
|
42
|
+
task?: string;
|
|
43
|
+
checked?: boolean;
|
|
44
|
+
userId?: string;
|
|
45
|
+
contributors?: Record<string, unknown>;
|
|
46
|
+
timeSpent?: number;
|
|
47
|
+
createdAt?: DateValue;
|
|
48
|
+
checkedAt?: DateValue;
|
|
49
|
+
[key: string]: unknown;
|
|
50
|
+
}
|
|
51
|
+
export interface ActionTaskNormalized {
|
|
52
|
+
taskId?: string;
|
|
53
|
+
task?: string;
|
|
54
|
+
checked?: boolean;
|
|
55
|
+
userId?: string;
|
|
56
|
+
contributors?: Record<string, unknown>;
|
|
57
|
+
timeSpent?: number;
|
|
58
|
+
createdAt?: Date;
|
|
59
|
+
checkedAt?: Date;
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Bloc media : galerie d'images + fichiers attachés (par IDs de documents).
|
|
64
|
+
*/
|
|
65
|
+
export interface ActionMedia {
|
|
66
|
+
type?: string;
|
|
67
|
+
countImages?: number;
|
|
68
|
+
images?: string[];
|
|
69
|
+
files?: string[];
|
|
70
|
+
[k: string]: unknown;
|
|
71
|
+
}
|
|
72
|
+
export interface ActionMediaFile {
|
|
73
|
+
files?: string[];
|
|
74
|
+
[k: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
export interface ActionItemJson {
|
|
77
|
+
_id: IdObject;
|
|
78
|
+
collection: "actions";
|
|
79
|
+
name: string;
|
|
80
|
+
description?: string;
|
|
81
|
+
status?: ActionStatus;
|
|
82
|
+
created?: DateValue;
|
|
83
|
+
updated?: DateValue;
|
|
84
|
+
modified?: DateValue;
|
|
85
|
+
startDate?: DateValue;
|
|
86
|
+
endDate?: DateValue;
|
|
87
|
+
parentId: string;
|
|
88
|
+
parentType: string;
|
|
89
|
+
parent?: ParentsMap;
|
|
90
|
+
tags?: string[];
|
|
91
|
+
links?: ActionLinksBlock;
|
|
92
|
+
creator?: string;
|
|
93
|
+
idUserAuthor?: string;
|
|
94
|
+
credits?: string;
|
|
95
|
+
idParentRoom?: string;
|
|
96
|
+
milestone?: ActionMilestoneRef;
|
|
97
|
+
importance?: string;
|
|
98
|
+
counts?: ActionCounts;
|
|
99
|
+
url?: string;
|
|
100
|
+
min?: number;
|
|
101
|
+
max?: number;
|
|
102
|
+
timeSpent?: number;
|
|
103
|
+
tracking?: boolean;
|
|
104
|
+
updateStatus?: ActionUpdateStatusEntryJson[];
|
|
105
|
+
rc?: unknown[];
|
|
106
|
+
tasks?: ActionTaskJson[];
|
|
107
|
+
media?: ActionMedia;
|
|
108
|
+
mediaFile?: ActionMediaFile;
|
|
109
|
+
[key: string]: unknown;
|
|
110
|
+
}
|
|
111
|
+
export interface ActionItemNormalized {
|
|
112
|
+
id: string;
|
|
113
|
+
_id: ObjectID;
|
|
114
|
+
collection: "actions";
|
|
115
|
+
name: string;
|
|
116
|
+
description?: string;
|
|
117
|
+
status?: ActionStatus;
|
|
118
|
+
created?: Date;
|
|
119
|
+
updated?: Date;
|
|
120
|
+
modified?: Date;
|
|
121
|
+
startDate?: Date;
|
|
122
|
+
endDate?: Date;
|
|
123
|
+
parentId: string;
|
|
124
|
+
parentType: string;
|
|
125
|
+
parent?: ParentsMap;
|
|
126
|
+
tags?: string[];
|
|
127
|
+
links?: ActionLinksBlock;
|
|
128
|
+
creator?: string;
|
|
129
|
+
idUserAuthor?: string;
|
|
130
|
+
credits?: number;
|
|
131
|
+
idParentRoom?: string;
|
|
132
|
+
milestone?: Omit<ActionMilestoneRef, "startDate" | "endDate"> & {
|
|
133
|
+
startDate?: Date;
|
|
134
|
+
endDate?: Date;
|
|
135
|
+
};
|
|
136
|
+
importance?: string;
|
|
137
|
+
counts?: ActionCounts;
|
|
138
|
+
url?: string;
|
|
139
|
+
min?: number;
|
|
140
|
+
max?: number;
|
|
141
|
+
timeSpent?: number;
|
|
142
|
+
tracking?: boolean;
|
|
143
|
+
updateStatus?: ActionUpdateStatusEntryNormalized[];
|
|
144
|
+
rc?: unknown[];
|
|
145
|
+
tasks?: ActionTaskNormalized[];
|
|
146
|
+
media?: ActionMedia;
|
|
147
|
+
mediaFile?: ActionMediaFile;
|
|
148
|
+
[key: string]: unknown;
|
|
149
|
+
}
|
|
150
|
+
export {};
|
|
@@ -11897,7 +11897,6 @@ declare const endpoints: {
|
|
|
11897
11897
|
type: string;
|
|
11898
11898
|
};
|
|
11899
11899
|
countType: {
|
|
11900
|
-
const: string[];
|
|
11901
11900
|
default: string[];
|
|
11902
11901
|
items: {
|
|
11903
11902
|
enum: string[];
|
|
@@ -12094,12 +12093,12 @@ declare const endpoints: {
|
|
|
12094
12093
|
type: string;
|
|
12095
12094
|
};
|
|
12096
12095
|
searchType: {
|
|
12097
|
-
const: string[];
|
|
12098
12096
|
default: string[];
|
|
12099
12097
|
items: {
|
|
12100
12098
|
enum: string[];
|
|
12101
12099
|
type: string;
|
|
12102
12100
|
};
|
|
12101
|
+
minItems: number;
|
|
12103
12102
|
type: string;
|
|
12104
12103
|
};
|
|
12105
12104
|
app?: undefined;
|
|
@@ -12327,7 +12326,6 @@ declare const endpoints: {
|
|
|
12327
12326
|
type: string;
|
|
12328
12327
|
};
|
|
12329
12328
|
countType: {
|
|
12330
|
-
const: string[];
|
|
12331
12329
|
default: string[];
|
|
12332
12330
|
items: {
|
|
12333
12331
|
enum: string[];
|
|
@@ -12566,12 +12564,12 @@ declare const endpoints: {
|
|
|
12566
12564
|
type: string;
|
|
12567
12565
|
};
|
|
12568
12566
|
searchType: {
|
|
12569
|
-
const: string[];
|
|
12570
12567
|
default: string[];
|
|
12571
12568
|
items: {
|
|
12572
12569
|
enum: string[];
|
|
12573
12570
|
type: string;
|
|
12574
12571
|
};
|
|
12572
|
+
minItems: number;
|
|
12575
12573
|
type: string;
|
|
12576
12574
|
};
|
|
12577
12575
|
app?: undefined;
|
|
@@ -14859,7 +14857,6 @@ declare const endpoints: {
|
|
|
14859
14857
|
type: string;
|
|
14860
14858
|
};
|
|
14861
14859
|
countType: {
|
|
14862
|
-
const: string[];
|
|
14863
14860
|
default: string[];
|
|
14864
14861
|
items: {
|
|
14865
14862
|
enum: string[];
|
|
@@ -15056,12 +15053,12 @@ declare const endpoints: {
|
|
|
15056
15053
|
type: string;
|
|
15057
15054
|
};
|
|
15058
15055
|
searchType: {
|
|
15059
|
-
const: string[];
|
|
15060
15056
|
default: string[];
|
|
15061
15057
|
items: {
|
|
15062
15058
|
enum: string[];
|
|
15063
15059
|
type: string;
|
|
15064
15060
|
};
|
|
15061
|
+
minItems: number;
|
|
15065
15062
|
type: string;
|
|
15066
15063
|
};
|
|
15067
15064
|
app?: undefined;
|
|
@@ -15289,7 +15286,6 @@ declare const endpoints: {
|
|
|
15289
15286
|
type: string;
|
|
15290
15287
|
};
|
|
15291
15288
|
countType: {
|
|
15292
|
-
const: string[];
|
|
15293
15289
|
default: string[];
|
|
15294
15290
|
items: {
|
|
15295
15291
|
enum: string[];
|
|
@@ -15528,12 +15524,12 @@ declare const endpoints: {
|
|
|
15528
15524
|
type: string;
|
|
15529
15525
|
};
|
|
15530
15526
|
searchType: {
|
|
15531
|
-
const: string[];
|
|
15532
15527
|
default: string[];
|
|
15533
15528
|
items: {
|
|
15534
15529
|
enum: string[];
|
|
15535
15530
|
type: string;
|
|
15536
15531
|
};
|
|
15532
|
+
minItems: number;
|
|
15537
15533
|
type: string;
|
|
15538
15534
|
};
|
|
15539
15535
|
app?: undefined;
|
|
@@ -27378,7 +27374,9 @@ declare const endpoints: {
|
|
|
27378
27374
|
type: string;
|
|
27379
27375
|
})[];
|
|
27380
27376
|
};
|
|
27381
|
-
value: {
|
|
27377
|
+
value: {
|
|
27378
|
+
type: string[];
|
|
27379
|
+
};
|
|
27382
27380
|
app?: undefined;
|
|
27383
27381
|
email?: undefined;
|
|
27384
27382
|
isInvitation?: undefined;
|
package/types/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export type { News } from "./api/News.js";
|
|
|
56
56
|
export type { Comment } from "./api/Comment.js";
|
|
57
57
|
export type { Answer } from "./api/Answer.js";
|
|
58
58
|
export type { Form } from "./api/Form.js";
|
|
59
|
+
export type { Action } from "./api/Action.js";
|
|
59
60
|
export type * from "./api/serverDataType/User.js";
|
|
60
61
|
export type * from "./api/serverDataType/Organization.js";
|
|
61
62
|
export { ORGANIZATION_TYPES } from "./api/serverDataType/Organization.js";
|
|
@@ -71,6 +72,8 @@ export type * from "./api/serverDataType/News.js";
|
|
|
71
72
|
export type * from "./api/serverDataType/Comment.js";
|
|
72
73
|
export type * from "./api/serverDataType/Answer.js";
|
|
73
74
|
export type * from "./api/serverDataType/Form.js";
|
|
75
|
+
export { ACTION_STATUSES } from "./api/serverDataType/Action.js";
|
|
76
|
+
export type * from "./api/serverDataType/Action.js";
|
|
74
77
|
export type * from "./api/serverDataType/common.js";
|
|
75
78
|
export type * from "./api/serverDataType/Country.js";
|
|
76
79
|
export type * from "./api/serverDataType/Zone.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Action } from "../api/Action.js";
|
|
1
2
|
import type { Answer } from "../api/Answer.js";
|
|
2
3
|
import type { Badge } from "../api/Badge.js";
|
|
3
4
|
import type { Classified } from "../api/Classified.js";
|
|
@@ -12,7 +13,7 @@ import type { User } from "../api/User.js";
|
|
|
12
13
|
/**
|
|
13
14
|
* Union type for all possible entity types
|
|
14
15
|
*/
|
|
15
|
-
export type EntityTypes = User | Organization | Project | Event | Poi | Badge | News | Comment | Answer | Form | Classified;
|
|
16
|
+
export type EntityTypes = User | Organization | Project | Event | Poi | Badge | News | Comment | Answer | Form | Classified | Action;
|
|
16
17
|
/**
|
|
17
18
|
* Type union représentant les entités pouvant être retournées par une recherche.
|
|
18
19
|
* Inclut les utilisateurs, organisations, projets, événements et points d'intérêt.
|
|
@@ -35,7 +36,7 @@ export type EntityData = {
|
|
|
35
36
|
/**
|
|
36
37
|
* Types de collection possibles
|
|
37
38
|
*/
|
|
38
|
-
export type CollectionType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "badges" | "comments" | "answers" | "forms" | "classifieds";
|
|
39
|
+
export type CollectionType = "citoyens" | "organizations" | "projects" | "events" | "poi" | "news" | "badges" | "comments" | "answers" | "forms" | "classifieds" | "actions";
|
|
39
40
|
/**
|
|
40
41
|
* Types pour les références entre entités
|
|
41
42
|
*/
|