@communecter/cocolight-api-client 1.0.150 → 1.0.152
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 +3 -2
- package/src/api/BaseEntity.ts +106 -5
- package/src/api/EndpointApi.ts +16 -1
- package/src/api/EndpointApi.types.ts +293 -202
- package/src/api/User.ts +13 -4
- package/src/api/UserApi.ts +16 -5
- package/src/costum/runtime.ts +65 -12
- package/src/endpoints.module.ts +370 -210
- package/types/api/BaseEntity.d.ts +56 -2
- package/types/api/EndpointApi.d.ts +10 -1
- package/types/api/EndpointApi.types.d.ts +91 -44
- package/types/api/User.d.ts +9 -2
- package/types/api/UserApi.d.ts +7 -1
- package/types/costum/runtime.d.ts +14 -5
- package/types/endpoints.module.d.ts +1634 -1086
|
@@ -2782,7 +2782,7 @@ export interface AddOrganizationData {
|
|
|
2782
2782
|
* Rôle principal de l’organisation
|
|
2783
2783
|
*/
|
|
2784
2784
|
role: "admin" | "member";
|
|
2785
|
-
tags?: string[];
|
|
2785
|
+
tags?: "" | string[];
|
|
2786
2786
|
/**
|
|
2787
2787
|
* Email de l’organisation
|
|
2788
2788
|
*/
|
|
@@ -2806,35 +2806,33 @@ export interface AddOrganizationData {
|
|
|
2806
2806
|
isOpenEdition: boolean;
|
|
2807
2807
|
[k: string]: unknown;
|
|
2808
2808
|
};
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
[k: string]: unknown;
|
|
2837
|
-
};
|
|
2809
|
+
geo?:
|
|
2810
|
+
| ""
|
|
2811
|
+
| {
|
|
2812
|
+
"@type"?: "GeoCoordinates";
|
|
2813
|
+
latitude: string | number;
|
|
2814
|
+
longitude: string | number;
|
|
2815
|
+
};
|
|
2816
|
+
geoPosition?:
|
|
2817
|
+
| ""
|
|
2818
|
+
| {
|
|
2819
|
+
/**
|
|
2820
|
+
* Type GeoJSON (doit être 'Point')
|
|
2821
|
+
*/
|
|
2822
|
+
type: "Point";
|
|
2823
|
+
/**
|
|
2824
|
+
* Tableau contenant [longitude, latitude]
|
|
2825
|
+
*
|
|
2826
|
+
* @minItems 2
|
|
2827
|
+
* @maxItems 2
|
|
2828
|
+
*/
|
|
2829
|
+
coordinates: [number, number];
|
|
2830
|
+
/**
|
|
2831
|
+
* Indicateur pour forcer la conversion en float côté serveur
|
|
2832
|
+
*/
|
|
2833
|
+
float?: true;
|
|
2834
|
+
[k: string]: unknown;
|
|
2835
|
+
};
|
|
2838
2836
|
/**
|
|
2839
2837
|
* Thématiques de l’organisation
|
|
2840
2838
|
*/
|
|
@@ -2849,33 +2847,35 @@ export interface AddOrganizationData {
|
|
|
2849
2847
|
tags: string[];
|
|
2850
2848
|
};
|
|
2851
2849
|
};
|
|
2852
|
-
address?:
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2850
|
+
address?:
|
|
2851
|
+
| ""
|
|
2852
|
+
| {
|
|
2853
|
+
"@type": "PostalAddress";
|
|
2854
|
+
addressCountry: string;
|
|
2855
|
+
codeInsee: string;
|
|
2856
|
+
addressLocality: string;
|
|
2857
|
+
localityId: string;
|
|
2858
|
+
level1: string;
|
|
2859
|
+
level1Name: string;
|
|
2860
|
+
/**
|
|
2861
|
+
* ID du département. Peut être vide pour les pays étrangers.
|
|
2862
|
+
*/
|
|
2863
|
+
level3?: string;
|
|
2864
|
+
/**
|
|
2865
|
+
* Nom du département. Peut être vide pour les pays étrangers.
|
|
2866
|
+
*/
|
|
2867
|
+
level3Name?: string;
|
|
2868
|
+
/**
|
|
2869
|
+
* ID de la commune. Peut être vide pour les pays étrangers.
|
|
2870
|
+
*/
|
|
2871
|
+
level4?: string;
|
|
2872
|
+
/**
|
|
2873
|
+
* Nom de la commune. Peut être vide pour les pays étrangers.
|
|
2874
|
+
*/
|
|
2875
|
+
level4Name?: string;
|
|
2876
|
+
postalCode?: string;
|
|
2877
|
+
streetAddress?: string;
|
|
2878
|
+
};
|
|
2879
2879
|
scope: "";
|
|
2880
2880
|
/**
|
|
2881
2881
|
* Horaires d'ouverture (7 entrées, une par jour de la semaine ; "" pour un jour fermé). Doit rester synchronisé avec VIRTUAL_OPENING_HOURS dans Organization.ts.
|
|
@@ -3102,7 +3102,7 @@ export interface AddProjectData {
|
|
|
3102
3102
|
* Visibilité (true/false)
|
|
3103
3103
|
*/
|
|
3104
3104
|
public: boolean;
|
|
3105
|
-
tags?: string[];
|
|
3105
|
+
tags?: "" | string[];
|
|
3106
3106
|
/**
|
|
3107
3107
|
* Description courte
|
|
3108
3108
|
*/
|
|
@@ -3126,62 +3126,62 @@ export interface AddProjectData {
|
|
|
3126
3126
|
crowdfunding?: boolean;
|
|
3127
3127
|
[k: string]: unknown;
|
|
3128
3128
|
};
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3129
|
+
geo?:
|
|
3130
|
+
| ""
|
|
3131
|
+
| {
|
|
3132
|
+
"@type"?: "GeoCoordinates";
|
|
3133
|
+
latitude: string | number;
|
|
3134
|
+
longitude: string | number;
|
|
3135
|
+
};
|
|
3136
|
+
geoPosition?:
|
|
3137
|
+
| ""
|
|
3138
|
+
| {
|
|
3139
|
+
/**
|
|
3140
|
+
* Type GeoJSON (doit être 'Point')
|
|
3141
|
+
*/
|
|
3142
|
+
type: "Point";
|
|
3143
|
+
/**
|
|
3144
|
+
* Tableau contenant [longitude, latitude]
|
|
3145
|
+
*
|
|
3146
|
+
* @minItems 2
|
|
3147
|
+
* @maxItems 2
|
|
3148
|
+
*/
|
|
3149
|
+
coordinates: [number, number];
|
|
3150
|
+
/**
|
|
3151
|
+
* Indicateur pour forcer la conversion en float côté serveur
|
|
3152
|
+
*/
|
|
3153
|
+
float?: true;
|
|
3154
|
+
[k: string]: unknown;
|
|
3155
|
+
};
|
|
3156
|
+
address?:
|
|
3157
|
+
| ""
|
|
3158
|
+
| {
|
|
3159
|
+
"@type": "PostalAddress";
|
|
3160
|
+
addressCountry: string;
|
|
3161
|
+
codeInsee: string;
|
|
3162
|
+
addressLocality: string;
|
|
3163
|
+
localityId: string;
|
|
3164
|
+
level1: string;
|
|
3165
|
+
level1Name: string;
|
|
3166
|
+
/**
|
|
3167
|
+
* ID du département. Peut être vide pour les pays étrangers.
|
|
3168
|
+
*/
|
|
3169
|
+
level3?: string;
|
|
3170
|
+
/**
|
|
3171
|
+
* Nom du département. Peut être vide pour les pays étrangers.
|
|
3172
|
+
*/
|
|
3173
|
+
level3Name?: string;
|
|
3174
|
+
/**
|
|
3175
|
+
* ID de la commune. Peut être vide pour les pays étrangers.
|
|
3176
|
+
*/
|
|
3177
|
+
level4?: string;
|
|
3178
|
+
/**
|
|
3179
|
+
* Nom de la commune. Peut être vide pour les pays étrangers.
|
|
3180
|
+
*/
|
|
3181
|
+
level4Name?: string;
|
|
3182
|
+
postalCode?: string;
|
|
3183
|
+
streetAddress?: string;
|
|
3184
|
+
};
|
|
3185
3185
|
scope: "";
|
|
3186
3186
|
[k: string]: unknown;
|
|
3187
3187
|
}
|
|
@@ -3261,67 +3261,67 @@ export interface AddPoiData {
|
|
|
3261
3261
|
* Description
|
|
3262
3262
|
*/
|
|
3263
3263
|
description?: string;
|
|
3264
|
-
tags?: string[];
|
|
3264
|
+
tags?: "" | string[];
|
|
3265
3265
|
/**
|
|
3266
3266
|
* URLs externes associées
|
|
3267
3267
|
*/
|
|
3268
3268
|
urls?: string[];
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3269
|
+
geo?:
|
|
3270
|
+
| ""
|
|
3271
|
+
| {
|
|
3272
|
+
"@type"?: "GeoCoordinates";
|
|
3273
|
+
latitude: string | number;
|
|
3274
|
+
longitude: string | number;
|
|
3275
|
+
};
|
|
3276
|
+
geoPosition?:
|
|
3277
|
+
| ""
|
|
3278
|
+
| {
|
|
3279
|
+
/**
|
|
3280
|
+
* Type GeoJSON (doit être 'Point')
|
|
3281
|
+
*/
|
|
3282
|
+
type: "Point";
|
|
3283
|
+
/**
|
|
3284
|
+
* Tableau contenant [longitude, latitude]
|
|
3285
|
+
*
|
|
3286
|
+
* @minItems 2
|
|
3287
|
+
* @maxItems 2
|
|
3288
|
+
*/
|
|
3289
|
+
coordinates: [number, number];
|
|
3290
|
+
/**
|
|
3291
|
+
* Indicateur pour forcer la conversion en float côté serveur
|
|
3292
|
+
*/
|
|
3293
|
+
float?: true;
|
|
3294
|
+
[k: string]: unknown;
|
|
3295
|
+
};
|
|
3296
|
+
address?:
|
|
3297
|
+
| ""
|
|
3298
|
+
| {
|
|
3299
|
+
"@type": "PostalAddress";
|
|
3300
|
+
addressCountry: string;
|
|
3301
|
+
codeInsee: string;
|
|
3302
|
+
addressLocality: string;
|
|
3303
|
+
localityId: string;
|
|
3304
|
+
level1: string;
|
|
3305
|
+
level1Name: string;
|
|
3306
|
+
/**
|
|
3307
|
+
* ID du département. Peut être vide pour les pays étrangers.
|
|
3308
|
+
*/
|
|
3309
|
+
level3?: string;
|
|
3310
|
+
/**
|
|
3311
|
+
* Nom du département. Peut être vide pour les pays étrangers.
|
|
3312
|
+
*/
|
|
3313
|
+
level3Name?: string;
|
|
3314
|
+
/**
|
|
3315
|
+
* ID de la commune. Peut être vide pour les pays étrangers.
|
|
3316
|
+
*/
|
|
3317
|
+
level4?: string;
|
|
3318
|
+
/**
|
|
3319
|
+
* Nom de la commune. Peut être vide pour les pays étrangers.
|
|
3320
|
+
*/
|
|
3321
|
+
level4Name?: string;
|
|
3322
|
+
postalCode?: string;
|
|
3323
|
+
streetAddress?: string;
|
|
3324
|
+
};
|
|
3325
3325
|
scope?: "";
|
|
3326
3326
|
[k: string]: unknown;
|
|
3327
3327
|
}
|
|
@@ -3611,35 +3611,33 @@ export interface AddEventData {
|
|
|
3611
3611
|
}
|
|
3612
3612
|
)
|
|
3613
3613
|
];
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
[k: string]: unknown;
|
|
3642
|
-
};
|
|
3614
|
+
geo?:
|
|
3615
|
+
| ""
|
|
3616
|
+
| {
|
|
3617
|
+
"@type"?: "GeoCoordinates";
|
|
3618
|
+
latitude: string | number;
|
|
3619
|
+
longitude: string | number;
|
|
3620
|
+
};
|
|
3621
|
+
geoPosition?:
|
|
3622
|
+
| ""
|
|
3623
|
+
| {
|
|
3624
|
+
/**
|
|
3625
|
+
* Type GeoJSON (doit être 'Point')
|
|
3626
|
+
*/
|
|
3627
|
+
type: "Point";
|
|
3628
|
+
/**
|
|
3629
|
+
* Tableau contenant [longitude, latitude]
|
|
3630
|
+
*
|
|
3631
|
+
* @minItems 2
|
|
3632
|
+
* @maxItems 2
|
|
3633
|
+
*/
|
|
3634
|
+
coordinates: [number, number];
|
|
3635
|
+
/**
|
|
3636
|
+
* Indicateur pour forcer la conversion en float côté serveur
|
|
3637
|
+
*/
|
|
3638
|
+
float?: true;
|
|
3639
|
+
[k: string]: unknown;
|
|
3640
|
+
};
|
|
3643
3641
|
address?:
|
|
3644
3642
|
| ""
|
|
3645
3643
|
| {
|
|
@@ -4094,9 +4092,9 @@ export interface GetEventsData {
|
|
|
4094
4092
|
countType?: unknown[];
|
|
4095
4093
|
fediverse: boolean;
|
|
4096
4094
|
/**
|
|
4097
|
-
*
|
|
4095
|
+
* GARDE PARITÉ legacy (identique à SEARCH_EVENTS_COSTUM) : seule valeur autorisée `false` (= exclure les récurrents) OU champ omis (= inclure, défaut). NE JAMAIS envoyer `true` — le legacy teste STRICTEMENT $recurrency === true (AgendaAction.php:65) qui échoue sur la string POST → exclut les récurrents, alors que notre backend les inclurait (divergence assumée). En interdisant `true`, omis→inclus et false→exclus se comportent pareil sur les 2 serveurs.
|
|
4098
4096
|
*/
|
|
4099
|
-
recurrency?:
|
|
4097
|
+
recurrency?: false;
|
|
4100
4098
|
filters?: {
|
|
4101
4099
|
$or?: Record<string, unknown>;
|
|
4102
4100
|
/**
|
|
@@ -4109,6 +4107,99 @@ export interface GetEventsData {
|
|
|
4109
4107
|
}
|
|
4110
4108
|
|
|
4111
4109
|
|
|
4110
|
+
export interface SearchEventsCostumData {
|
|
4111
|
+
searchType: "events"[];
|
|
4112
|
+
indexMin: number;
|
|
4113
|
+
indexStep: number;
|
|
4114
|
+
/**
|
|
4115
|
+
* Date de début (UTC)
|
|
4116
|
+
*/
|
|
4117
|
+
startDateUTC?: string;
|
|
4118
|
+
/**
|
|
4119
|
+
* Date de fin (UTC)
|
|
4120
|
+
*/
|
|
4121
|
+
endDateUTC?: string;
|
|
4122
|
+
/**
|
|
4123
|
+
* Nom ou terme
|
|
4124
|
+
*/
|
|
4125
|
+
name?: string;
|
|
4126
|
+
/**
|
|
4127
|
+
* Type d’événement
|
|
4128
|
+
*/
|
|
4129
|
+
type?:
|
|
4130
|
+
| "workshop"
|
|
4131
|
+
| "competition"
|
|
4132
|
+
| "concert"
|
|
4133
|
+
| "contest"
|
|
4134
|
+
| "conference"
|
|
4135
|
+
| "debate"
|
|
4136
|
+
| "exhibition"
|
|
4137
|
+
| "festival"
|
|
4138
|
+
| "crowdfunding"
|
|
4139
|
+
| "fair"
|
|
4140
|
+
| "course"
|
|
4141
|
+
| "protest"
|
|
4142
|
+
| "market"
|
|
4143
|
+
| "film"
|
|
4144
|
+
| "getTogether"
|
|
4145
|
+
| "meeting"
|
|
4146
|
+
| "spectacle"
|
|
4147
|
+
| "internship"
|
|
4148
|
+
| "stand"
|
|
4149
|
+
| "others";
|
|
4150
|
+
/**
|
|
4151
|
+
* Liste des localités ciblées
|
|
4152
|
+
*/
|
|
4153
|
+
locality?: {
|
|
4154
|
+
/**
|
|
4155
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
4156
|
+
* via the `patternProperty` "^[^\s]+$".
|
|
4157
|
+
*/
|
|
4158
|
+
[k: string]: {
|
|
4159
|
+
[k: string]: unknown;
|
|
4160
|
+
};
|
|
4161
|
+
};
|
|
4162
|
+
count?: boolean;
|
|
4163
|
+
countType?: unknown[];
|
|
4164
|
+
fediverse: boolean;
|
|
4165
|
+
/**
|
|
4166
|
+
* GARDE PARITÉ legacy : seule valeur autorisée `false` (= exclure les récurrents) OU champ omis (= inclure, défaut). NE JAMAIS envoyer `true` — le legacy teste STRICTEMENT $recurrency === true (AgendaAction.php:65) qui échoue sur la string POST → exclut les récurrents, alors que notre backend les inclurait (divergence assumée). En interdisant `true`, omis→inclus et false→exclus se comportent pareil sur les 2 serveurs.
|
|
4167
|
+
*/
|
|
4168
|
+
recurrency?: false;
|
|
4169
|
+
/**
|
|
4170
|
+
* Filtres Mongo additionnels (buildFilters).
|
|
4171
|
+
*/
|
|
4172
|
+
filters?: {
|
|
4173
|
+
[k: string]: unknown;
|
|
4174
|
+
};
|
|
4175
|
+
/**
|
|
4176
|
+
* Scope costum : events dont source.keys/reference.costum ∈ sourceKey (agenda multi-sites/réseau). Auto-injecté = [slug de l’entité] si absent.
|
|
4177
|
+
*/
|
|
4178
|
+
sourceKey?: string[];
|
|
4179
|
+
/**
|
|
4180
|
+
* Filtre par tags ($in, ou $all via options.tags.verb).
|
|
4181
|
+
*/
|
|
4182
|
+
searchTags?: string[];
|
|
4183
|
+
/**
|
|
4184
|
+
* Events liés (links.<type>.<id>).
|
|
4185
|
+
*/
|
|
4186
|
+
links?: {
|
|
4187
|
+
type: string;
|
|
4188
|
+
id: string;
|
|
4189
|
+
[k: string]: unknown;
|
|
4190
|
+
}[];
|
|
4191
|
+
subType?: string;
|
|
4192
|
+
category?: string;
|
|
4193
|
+
section?: string | string[];
|
|
4194
|
+
contextId?: string;
|
|
4195
|
+
contextType?: string;
|
|
4196
|
+
costumSlug?: string;
|
|
4197
|
+
costumId?: string;
|
|
4198
|
+
costumType?: string;
|
|
4199
|
+
[k: string]: unknown;
|
|
4200
|
+
}
|
|
4201
|
+
|
|
4202
|
+
|
|
4112
4203
|
export interface ShareEventsData {
|
|
4113
4204
|
/**
|
|
4114
4205
|
* ID de l’événement à partager
|
package/src/api/User.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApiError } from "../error.js";
|
|
2
2
|
import { BaseEntity } from "./BaseEntity.js";
|
|
3
3
|
import { Notifications } from "./Notifications.js";
|
|
4
|
-
import { resolveCostumScope, type CostumScope } from "../costum/runtime.js";
|
|
4
|
+
import { resolveCostumScope, costumScopeFromEntity, type CostumScope } from "../costum/runtime.js";
|
|
5
5
|
import { UserMixin } from "../mixin/UserMixin.js";
|
|
6
6
|
import { createSocialTransform } from "../types/transforms.js";
|
|
7
7
|
|
|
@@ -733,10 +733,19 @@ export class User extends BaseEntity<UserItemNormalized> {
|
|
|
733
733
|
* const org = await tl.organization({ name: "Mon TL", manageModel: "Association", buildingSurfaceArea: "120" });
|
|
734
734
|
* await org.save();
|
|
735
735
|
*
|
|
736
|
-
*
|
|
736
|
+
* Deux formes :
|
|
737
|
+
* - `me.costum(slug)` : slug d'un costum du registry (autocomplété) OU n'importe quel slug (`string`) —
|
|
738
|
+
* le backend reste l'autorité de validité (`found`). Slug hors registry sans champ → inc1b (résolution live).
|
|
739
|
+
* - `me.costum(entity)` : ouvre un scope FIELDLESS depuis une entité DÉJÀ CHARGÉE (org/projet/event qui porte
|
|
740
|
+
* un costum), zéro fetch — `source.key` = slug de l'entité. Cas « créer sous ce site nu ».
|
|
741
|
+
*
|
|
742
|
+
* @param arg - slug (`KnownCostumSlug | string`) OU une entité chargée porteuse d'un costum.
|
|
737
743
|
*/
|
|
738
|
-
async costum(slug: KnownCostumSlug): Promise<CostumScope
|
|
739
|
-
|
|
744
|
+
async costum(slug: KnownCostumSlug | (string & {})): Promise<CostumScope>;
|
|
745
|
+
async costum(entity: BaseEntity): Promise<CostumScope>;
|
|
746
|
+
async costum(arg: KnownCostumSlug | (string & {}) | BaseEntity): Promise<CostumScope> {
|
|
747
|
+
if (typeof arg === "string") return resolveCostumScope(this, arg);
|
|
748
|
+
return costumScopeFromEntity(this, arg);
|
|
740
749
|
}
|
|
741
750
|
|
|
742
751
|
/**
|
package/src/api/UserApi.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import ApiClient from "../ApiClient.js";
|
|
2
|
-
import { ApiError, ApiResponseError } from "../error.js";
|
|
3
2
|
import { Action } from "./Action.js";
|
|
4
3
|
import { Answer } from "./Answer.js";
|
|
5
4
|
import { Badge } from "./Badge.js";
|
|
@@ -12,6 +11,8 @@ import { Organization } from "./Organization.js";
|
|
|
12
11
|
import { Poi } from "./Poi.js";
|
|
13
12
|
import { Project } from "./Project.js";
|
|
14
13
|
import { User } from "./User.js";
|
|
14
|
+
import { COSTUM_REQUEST_ENVELOPE } from "../costum/symbol.js";
|
|
15
|
+
import { ApiError, ApiResponseError } from "../error.js";
|
|
15
16
|
|
|
16
17
|
type AxiosResponse = import("axios").AxiosResponse;
|
|
17
18
|
|
|
@@ -105,14 +106,24 @@ export class UserApi {
|
|
|
105
106
|
* @param params.username - Nom d'utilisateur.
|
|
106
107
|
* @param params.email - Adresse email.
|
|
107
108
|
* @param params.pwd - Mot de passe.
|
|
109
|
+
* @param params.costumSlug - (option) slug du costum de déploiement → estampille `source.key` du citoyen
|
|
110
|
+
* côté backend (port Person::insert). `costumId`/`costumType` = entité porteuse (requis si le slug n'est
|
|
111
|
+
* pas un doc `costum`, ex. un site porté par une org).
|
|
108
112
|
* @returns Réponse brute de l'API.
|
|
109
113
|
* @throws {ApiResponseError} Si l'API retourne un échec (`result === false`).
|
|
110
114
|
*/
|
|
111
|
-
async register({ name, username, email, pwd }: { name: string; username: string; email: string; pwd: string }): Promise<any> {
|
|
115
|
+
async register({ name, username, email, pwd, costumSlug, costumId, costumType }: { name: string; username: string; email: string; pwd: string; costumSlug?: string; costumId?: string; costumType?: string }): Promise<any> {
|
|
112
116
|
return this.client.safeCall(async () => {
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
const data: Record<string, unknown> = { name, username, email, pwd };
|
|
118
|
+
// Contexte costum (déploiement) injecté via l'enveloppe (cf. element/save) : `callEndpoint` fusionne le
|
|
119
|
+
// `context` dans le body + relâche l'AJV. Le backend lit costumSlug/Id/Type → estampille `source` (origin/key/keys).
|
|
120
|
+
if (costumSlug) {
|
|
121
|
+
(data as Record<symbol, unknown>)[COSTUM_REQUEST_ENVELOPE] = {
|
|
122
|
+
properties: {},
|
|
123
|
+
context: { costumSlug, ...(costumId ? { costumId } : {}), ...(costumType ? { costumType } : {}) },
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const response = await this.client.callEndpoint("PERSON_REGISTER", data);
|
|
116
127
|
|
|
117
128
|
if (!isAxiosResponse(response)) {
|
|
118
129
|
throw new ApiError("Requête mise en file (offline/circuit breaker)", 503, response);
|