@communecter/cocolight-api-client 1.0.185 → 1.0.187
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.vite.mjs.js +1 -1
- package/dist/cocolight-api-client.vite.mjs.js.map +1 -1
- package/package.json +1 -1
- package/types/api/BaseEntity.d.ts +146 -1
- package/types/api/EndpointApi.d.ts +41 -1
- package/types/api/EndpointApi.types.d.ts +192 -0
- package/types/endpoints.module.d.ts +1873 -0
package/package.json
CHANGED
|
@@ -383,8 +383,26 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
383
383
|
_isDeleted: boolean;
|
|
384
384
|
/** Contexte costum porté par cette instance (null hors d'un `CostumScope`). Posé au constructeur.
|
|
385
385
|
* Sens A — « quel costum définit le SCHÉMA de cet élément » : dérivé du `source.key` (provenance),
|
|
386
|
-
* ré-affirmé à chaque `_setData
|
|
386
|
+
* ré-affirmé à chaque `_setData` (sauf épingle, cf. `_costumCtxPinned`). Gouverne draft/proxy,
|
|
387
|
+
* merge de schémas, héritage aux enfants. */
|
|
387
388
|
_costumCtx: CostumRuntimeContext | null;
|
|
389
|
+
/**
|
|
390
|
+
* ÉPINGLE du schéma costum (sens A) : posée par `setCostumScope(slug, {pinSchema:true})` et par
|
|
391
|
+
* `loadCostumScope`, elle SUSPEND la re-dérivation de `_costumCtx` depuis `source.key` dans
|
|
392
|
+
* `_setData` — le costum ÉPINGLÉ gouverne alors la whitelist d'écriture du draft, pas la
|
|
393
|
+
* provenance. Cas d'usage : un costum ANNUAIRE (ex. navigatorDesTierslieux) édite avec SON
|
|
394
|
+
* formulaire des fiches qui ne viennent pas de lui (`source.key` étranger, hors registre, ou
|
|
395
|
+
* absent) — sans l'épingle, chacun de ces cas rejetait l'édition (`[DraftProxy] Le champ "…"
|
|
396
|
+
* n'est pas autorisé.`) alors que la CRÉATION passait, elle, par `me.costum(slug)`. Même statut
|
|
397
|
+
* que `_adminScope` : un choix EXPLICITE de l'appelant, qui survit aux refresh/hydratations.
|
|
398
|
+
*
|
|
399
|
+
* PORTÉE : l'épingle ouvre l'ÉCRITURE (whitelist du draft + enveloppe `element/save`) — elle ne
|
|
400
|
+
* change pas qui gouverne la LECTURE ailleurs (la normalisation suit toujours la provenance) :
|
|
401
|
+
* un champ écrit sous le schéma de l'annuaire reste muet hors de l'annuaire (cf.
|
|
402
|
+
* cocolight-backend docs/28 §6b, triple déclaration). Elle ne déclenche PAS les presets de
|
|
403
|
+
* création du costum épinglé. @private
|
|
404
|
+
*/
|
|
405
|
+
private _costumCtxPinned;
|
|
388
406
|
/**
|
|
389
407
|
* Scope d'ADMINISTRATION costum — sens B : « au NOM de quel costum j'agis » (`validateGroup`,
|
|
390
408
|
* `addReference`/`removeReference`/`removeFromSource`, `previewImport`/`importElements`,
|
|
@@ -404,6 +422,10 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
404
422
|
combinedSchema: any;
|
|
405
423
|
transforms: TransformsMap;
|
|
406
424
|
removeFields: string[];
|
|
425
|
+
/** Constantes de schéma du build — mémorisées pour REJOUER le combinedSchema quand `_costumCtx`
|
|
426
|
+
* change APRÈS le build (épingle `pinSchema`) : sans rejeu, poser un scope est un no-op pour
|
|
427
|
+
* l'édition (le proxy relit un combinedSchema figé au chargement). */
|
|
428
|
+
constants: string[];
|
|
407
429
|
};
|
|
408
430
|
static entityTag: string;
|
|
409
431
|
static entityType?: string;
|
|
@@ -1070,6 +1092,25 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1070
1092
|
* @private
|
|
1071
1093
|
*/
|
|
1072
1094
|
private _extractWritableFields;
|
|
1095
|
+
/**
|
|
1096
|
+
* Construit le schéma COMBINÉ de la whitelist d'écriture : schémas de requête des constantes
|
|
1097
|
+
* (+ VIRTUAL_SCHEMAS, $defs fusionnés) ⊕ schéma du `_costumCtx` COURANT. Extrait de
|
|
1098
|
+
* `_buildDraftAndProxy` pour être REJOUABLE : quand `_costumCtx` change après le build
|
|
1099
|
+
* (épingle `pinSchema`), la whitelist doit être reconstruite — sinon poser un scope est un
|
|
1100
|
+
* no-op visible pour l'édition (le proxy relit un combinedSchema figé au chargement).
|
|
1101
|
+
* @private
|
|
1102
|
+
*/
|
|
1103
|
+
private _buildCombinedSchema;
|
|
1104
|
+
/**
|
|
1105
|
+
* ÉPINGLE le costum courant comme schéma d'ÉCRITURE (cf. `_costumCtxPinned`) et REJOUE la
|
|
1106
|
+
* whitelist : reconstruit le combinedSchema depuis les constantes mémorisées au build (le
|
|
1107
|
+
* `_costumCtx` a changé APRÈS `_buildDraftAndProxy`), puis SÈME les champs nouvellement ouverts
|
|
1108
|
+
* dans le draft ET dans la baseline depuis `serverData` — sans ce semis, la comparaison
|
|
1109
|
+
* draft/baseline les verrait tous « modifiés » (baseline `undefined`) et le save émettrait des
|
|
1110
|
+
* champs intouchés. Invariant vérifié par test : `hasChanges()` reste `false` juste après la pose.
|
|
1111
|
+
* @private
|
|
1112
|
+
*/
|
|
1113
|
+
private _pinCostumSchema;
|
|
1073
1114
|
/**
|
|
1074
1115
|
* Construit un brouillon et un proxy à partir des données et du schéma.
|
|
1075
1116
|
*
|
|
@@ -1876,10 +1917,17 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
1876
1917
|
* @param slug - Slug du costum (ex. `"equipementsSportifs974"`).
|
|
1877
1918
|
* @param opts.costumId / opts.costumType - Identité de l'élément hôte, requise si le costum
|
|
1878
1919
|
* n'est pas dans le registre bundlé (résolue par le front via slug/getinfo).
|
|
1920
|
+
* @param opts.pinSchema - ÉPINGLE le costum comme schéma d'ÉCRITURE (sens A) : la whitelist du
|
|
1921
|
+
* draft est REJOUÉE avec ses champs et la re-dérivation depuis `source.key` est suspendue —
|
|
1922
|
+
* pour ÉDITER, avec le formulaire d'un costum ANNUAIRE, une fiche qui ne vient pas de lui.
|
|
1923
|
+
* Défaut `false`, et ce défaut est LOAD-BEARING : `setCostumScope` est déjà appelée sur le
|
|
1924
|
+
* carrier de nombreux sites (import/export/validation via ensureCostumScope), où la provenance
|
|
1925
|
+
* doit RESTER maîtresse du schéma (contrat des sens A/B). Cf. `_costumCtxPinned`.
|
|
1879
1926
|
*/
|
|
1880
1927
|
setCostumScope(slug: string, opts?: {
|
|
1881
1928
|
costumId?: string;
|
|
1882
1929
|
costumType?: string;
|
|
1930
|
+
pinSchema?: boolean;
|
|
1883
1931
|
}): void;
|
|
1884
1932
|
/**
|
|
1885
1933
|
* Épingle le scope d'ADMINISTRATION (sens B) SI l'identité est complète — sinon no-op : les
|
|
@@ -2012,6 +2060,103 @@ export declare class BaseEntity<TServerData = any> {
|
|
|
2012
2060
|
result: boolean;
|
|
2013
2061
|
msg?: string;
|
|
2014
2062
|
}>;
|
|
2063
|
+
/** Corps commun check/apply — `to` défaut = costum de cette entité (repreneur = site courant). */
|
|
2064
|
+
private _ownershipTransferBody;
|
|
2065
|
+
/**
|
|
2066
|
+
* Analyse (DRY-RUN) d'un transfert d'appropriation — aucune écriture. Renvoie `canApply`, les
|
|
2067
|
+
* contrôles d'uniformité (bloquants/warnings), les compteurs (byLocality/byType), la résolution
|
|
2068
|
+
* du sous-type, la comparaison de schéma costum et un exemple avant/après.
|
|
2069
|
+
*/
|
|
2070
|
+
checkOwnershipTransfer(params: Parameters<BaseEntity["_ownershipTransferBody"]>[0]): Promise<{
|
|
2071
|
+
result: boolean;
|
|
2072
|
+
msg?: string;
|
|
2073
|
+
canApply?: boolean;
|
|
2074
|
+
counts?: {
|
|
2075
|
+
selected: number;
|
|
2076
|
+
byLocality: Record<string, number>;
|
|
2077
|
+
byType: Record<string, number>;
|
|
2078
|
+
};
|
|
2079
|
+
controls?: {
|
|
2080
|
+
id: string;
|
|
2081
|
+
level: "blocking" | "warning";
|
|
2082
|
+
count: number;
|
|
2083
|
+
ids: string[];
|
|
2084
|
+
}[];
|
|
2085
|
+
subType?: {
|
|
2086
|
+
mode: string;
|
|
2087
|
+
value: string | null;
|
|
2088
|
+
types: (string | null)[];
|
|
2089
|
+
};
|
|
2090
|
+
schema?: {
|
|
2091
|
+
fromFields: number;
|
|
2092
|
+
toFields: number;
|
|
2093
|
+
missing: string[];
|
|
2094
|
+
};
|
|
2095
|
+
sample?: {
|
|
2096
|
+
id: string;
|
|
2097
|
+
name: string | null;
|
|
2098
|
+
before: unknown;
|
|
2099
|
+
after: unknown;
|
|
2100
|
+
} | null;
|
|
2101
|
+
}>;
|
|
2102
|
+
/**
|
|
2103
|
+
* APPLIQUE le transfert : re-déroule intégralement le check côté serveur (refus au moindre
|
|
2104
|
+
* bloquant, et si `expectedCount` — le compteur affiché au dry-run — a dérivé), journalise le run
|
|
2105
|
+
* dans `sourceMigrations` (snapshot AVANT écriture), écrit, et renvoie `migrationId` + compteurs
|
|
2106
|
+
* auto-vérifiés. Rollbackable via rollbackOwnershipTransfer(migrationId).
|
|
2107
|
+
*/
|
|
2108
|
+
applyOwnershipTransfer(params: Parameters<BaseEntity["_ownershipTransferBody"]>[0] & {
|
|
2109
|
+
expectedCount?: number;
|
|
2110
|
+
}): Promise<{
|
|
2111
|
+
result: boolean;
|
|
2112
|
+
msg?: string;
|
|
2113
|
+
migrationId?: string;
|
|
2114
|
+
controls?: {
|
|
2115
|
+
id: string;
|
|
2116
|
+
level: "blocking" | "warning";
|
|
2117
|
+
count: number;
|
|
2118
|
+
ids: string[];
|
|
2119
|
+
}[];
|
|
2120
|
+
applied?: {
|
|
2121
|
+
migrated: number;
|
|
2122
|
+
referenceAdded: number;
|
|
2123
|
+
annotated: number;
|
|
2124
|
+
selfReferenceCleaned: number;
|
|
2125
|
+
};
|
|
2126
|
+
verification?: {
|
|
2127
|
+
ownedByTo: number;
|
|
2128
|
+
stillOwnedByFrom: number;
|
|
2129
|
+
};
|
|
2130
|
+
}>;
|
|
2131
|
+
/**
|
|
2132
|
+
* ANNULE un transfert : restaure, depuis le snapshot du run, les racines source/reference de
|
|
2133
|
+
* chaque fiche encore en état post-migration. Rollback PARTIEL accepté (`skipped` : moved =
|
|
2134
|
+
* re-transférée depuis, missing = supprimée). Gate recalculé sur les slugs DU RUN.
|
|
2135
|
+
*/
|
|
2136
|
+
rollbackOwnershipTransfer(migrationId: string): Promise<{
|
|
2137
|
+
result: boolean;
|
|
2138
|
+
msg?: string;
|
|
2139
|
+
restored?: number;
|
|
2140
|
+
skipped?: {
|
|
2141
|
+
id: string;
|
|
2142
|
+
reason: "moved" | "missing";
|
|
2143
|
+
}[];
|
|
2144
|
+
status?: string;
|
|
2145
|
+
}>;
|
|
2146
|
+
/**
|
|
2147
|
+
* HISTORIQUE des transferts dont le costum de cette entité est cédant ou repreneur (created
|
|
2148
|
+
* décroissant, sans snapshot). Avec `migrationId` : le run COMPLET, snapshot inclus — c'est le
|
|
2149
|
+
* téléchargement JSON de rollback côté UI.
|
|
2150
|
+
*/
|
|
2151
|
+
listOwnershipTransfers(params?: {
|
|
2152
|
+
slug?: string;
|
|
2153
|
+
migrationId?: string;
|
|
2154
|
+
}): Promise<{
|
|
2155
|
+
result: boolean;
|
|
2156
|
+
msg?: string;
|
|
2157
|
+
migrations?: Record<string, unknown>[];
|
|
2158
|
+
migration?: Record<string, unknown>;
|
|
2159
|
+
}>;
|
|
2015
2160
|
/** Détache l'élément (type,id) de `source.keys` du costum de cette entité (dé-rattachement). Même
|
|
2016
2161
|
* parité de payload que `removeReference` : jamais `costumId`/`costumType`. */
|
|
2017
2162
|
removeFromSource(type: string, id: string): Promise<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type ApiClient from "../ApiClient.js";
|
|
2
|
-
import type { DocumentListData, PersonRegisterData, AuthenticateUrlData, RefreshTokenUrlData, PasswordRecoveryData, PasswordResetData, ServerExchangeTokenData, ChangePasswordData, DeleteAccountData, UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, UpdateBlockSlugData, CheckData, ProfilImageData, ProfilBannerData, GetElementsAboutData, MulticonnectData, RelaunchInvitationData, GetNewsData, GetNewsByIdData, AddNewsData, AddImageNewsData, AddFileNewsData, DeleteNewsData, UpdateNewsData, ShareNewsData, GetCommentsData, AddCommentsData, DeleteCommentsData, UpdateCommentsData, SearchTagsData, ShowVoteData, GlobalAutocompleteData, CityAutocompleteData, CityAutocompleteByCountryData, SuggestionInputData, GetProjectsNoAdminData, GetProjectsAdminData, GetPoisNoAdminData, GetPoisAdminData, GlobalAutocompleteAdminCostumData, GetOrganizationsNoAdminData, GetOrganizationsAdminData, GetUserEligiblePlacesData, GetMembersNoAdminData, GetMembersAdminData, GetFriendsAdminData, GetSubscriptionsData, GetSubscriptionsAdminData, GetSubscribersData, GetSubscribersAdminData, GetContributorsNoAdminData, GetContributorsAdminData, GetBadgesData, GetBadgesFiltersData, ConnectData, CreateInvitationLinkData, ConnectByRefData, DisconnectData, GetElementsKeyData, GetFavorisData, DeleteFavorisData, AddFavorisData, AddOrganizationData, AddProjectData, AddPoiData, AddEventData, DeleteElementData, AddImageElementData, LinkValidateData, SearchMemberAutocompleteData, GetNotificationsData, GetNotificationsCountData, NotificationUpdateData, MarkNotificationAsReadData, ActivitypubSearchData, ActivitypubLinkData, ActivitypubGetCommunityData, GetBadgeData, AddBadgesData, AssignBadgesData, GetEventsData, SearchEventsCostumData, ShareEventsData, InviteMembersData, FollowData, GetCostumJsonData, GlobalAutocompleteCostumData, NavigatorGettlData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestDatesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetGalleryData, GetAttendeesNoAdminData, GetAttendeesAdminData, CoformAnswersSearchData, CoformAnswersByIdData, GetCoformByIdData, CoformUploadAnswerFileData, DeleteCoformAnswerFileData, CoformGetAnswerFilesData, GetCoformCatalogsData, SaveCoformAnswerData, GetCoformAnswerHistoryData, GetCoformMultievalDataData, GetCoformCommontableContributorsData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DeleteDocumentByIdData, DemoteAdminData, CostumFilterCoformData, CostumFilterCoformByPathData, GetCountriesData, SearchZonesData, CoformAnswersByFormsData, CostumToolsCatalogData, CostumToolUsersData, CostumCommunInfoData, CostumSaveToolEnrichmentData, CostumCommunListData, GenerateAnswerFromFormData, FundingEnvelopeData, CoremuOperationData, CostumProjectActionRequestNewData, CostumProjectActionRequestSetStatusData, CostumProjectActionRequestSetDateData, CostumProjectActionRequestSetContributorsData, CostumProjectActionRequestCancelData, CostumProjectActionRequestArchiveData, LinkDiscourseAccountData, UnlinkDiscourseAccountData, DiscourseProfileData, DiscourseCheckEmailData, DiscourseDismissLinkData, LinkMediawikiAccountData, UnlinkMediawikiAccountData, GetMediawikiContributionsData, AddClassifiedData, PersonActivateData, PersonValidateInvitationData, ValidateInvitationByMailData, ImportPreviewData, ExportElementsData, ImportElementsData, GeocodageData, ValidateGroupData, SetSourceData, ModerateData, NewsModerateData, CommentModerateData, UploadDocumentData, ZoneGetShapeData, ZoneGetZonirisData, CostumListValuesData, CostumResolvedData, DirectoryProposalData, DirectoryProposalCountData, DirectoryProposalNewCounterData } from "./EndpointApi.types.js";
|
|
2
|
+
import type { DocumentListData, PersonRegisterData, AuthenticateUrlData, RefreshTokenUrlData, PasswordRecoveryData, PasswordResetData, ServerExchangeTokenData, ChangePasswordData, DeleteAccountData, UpdateSettingsData, UpdateBlockDescriptionData, UpdateBlockInfoData, UpdateBlockSocialData, UpdateBlockLocalityData, UpdateBlockSlugData, CheckData, ProfilImageData, ProfilBannerData, GetElementsAboutData, MulticonnectData, RelaunchInvitationData, GetNewsData, GetNewsByIdData, AddNewsData, AddImageNewsData, AddFileNewsData, DeleteNewsData, UpdateNewsData, ShareNewsData, GetCommentsData, AddCommentsData, DeleteCommentsData, UpdateCommentsData, SearchTagsData, ShowVoteData, GlobalAutocompleteData, CityAutocompleteData, CityAutocompleteByCountryData, SuggestionInputData, GetProjectsNoAdminData, GetProjectsAdminData, GetPoisNoAdminData, GetPoisAdminData, GlobalAutocompleteAdminCostumData, GetOrganizationsNoAdminData, GetOrganizationsAdminData, GetUserEligiblePlacesData, GetMembersNoAdminData, GetMembersAdminData, GetFriendsAdminData, GetSubscriptionsData, GetSubscriptionsAdminData, GetSubscribersData, GetSubscribersAdminData, GetContributorsNoAdminData, GetContributorsAdminData, GetBadgesData, GetBadgesFiltersData, ConnectData, CreateInvitationLinkData, ConnectByRefData, DisconnectData, GetElementsKeyData, GetFavorisData, DeleteFavorisData, AddFavorisData, AddOrganizationData, AddProjectData, AddPoiData, AddEventData, DeleteElementData, AddImageElementData, LinkValidateData, SearchMemberAutocompleteData, GetNotificationsData, GetNotificationsCountData, NotificationUpdateData, MarkNotificationAsReadData, ActivitypubSearchData, ActivitypubLinkData, ActivitypubGetCommunityData, GetBadgeData, AddBadgesData, AssignBadgesData, GetEventsData, SearchEventsCostumData, ShareEventsData, InviteMembersData, FollowData, GetCostumJsonData, GlobalAutocompleteCostumData, NavigatorGettlData, CostumEventRequestActorsData, CostumEventRequestSubeventsData, CostumEventRequestElementEventData, CostumEventRequestCategoriesData, CostumEventRequestDatesData, CostumEventRequestEventData, CostumEventRequestLinkTlToEventData, CostumEventRequestLoadContextTagData, GetGalleryData, GetAttendeesNoAdminData, GetAttendeesAdminData, CoformAnswersSearchData, CoformAnswersByIdData, GetCoformByIdData, CoformUploadAnswerFileData, DeleteCoformAnswerFileData, CoformGetAnswerFilesData, GetCoformCatalogsData, SaveCoformAnswerData, GetCoformAnswerHistoryData, GetCoformMultievalDataData, GetCoformCommontableContributorsData, AddVoteData, AddReportAbuseData, UpdatePathValueData, DeleteDocumentByContextData, DeleteDocumentByIdData, DemoteAdminData, CostumFilterCoformData, CostumFilterCoformByPathData, GetCountriesData, SearchZonesData, CoformAnswersByFormsData, CostumToolsCatalogData, CostumToolUsersData, CostumCommunInfoData, CostumSaveToolEnrichmentData, CostumCommunListData, GenerateAnswerFromFormData, FundingEnvelopeData, CoremuOperationData, CostumProjectActionRequestNewData, CostumProjectActionRequestSetStatusData, CostumProjectActionRequestSetDateData, CostumProjectActionRequestSetContributorsData, CostumProjectActionRequestCancelData, CostumProjectActionRequestArchiveData, LinkDiscourseAccountData, UnlinkDiscourseAccountData, DiscourseProfileData, DiscourseCheckEmailData, DiscourseDismissLinkData, LinkMediawikiAccountData, UnlinkMediawikiAccountData, GetMediawikiContributionsData, AddClassifiedData, PersonActivateData, PersonValidateInvitationData, ValidateInvitationByMailData, ImportPreviewData, ExportElementsData, ImportElementsData, GeocodageData, ValidateGroupData, SetSourceData, TransferSourceCheckData, TransferSourceApplyData, TransferSourceRollbackData, TransferSourceHistoryData, ModerateData, NewsModerateData, CommentModerateData, UploadDocumentData, ZoneGetShapeData, ZoneGetZonirisData, CostumListValuesData, CostumResolvedData, DirectoryProposalData, DirectoryProposalCountData, DirectoryProposalNewCounterData } from "./EndpointApi.types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Classe EndpointApi générée automatiquement depuis endpoints-copie.json
|
|
5
5
|
*/
|
|
@@ -1576,6 +1576,46 @@ export declare class EndpointApi {
|
|
|
1576
1576
|
* @throws {Error} - En cas d'erreur inattendue.
|
|
1577
1577
|
*/
|
|
1578
1578
|
setSource(data: SetSourceData): Promise<any>;
|
|
1579
|
+
/**
|
|
1580
|
+
* Analyser un transfert d'appropriation (dry-run) : Migration d'APPROPRIATION : transfère la PROPRIÉTÉ d'un ensemble de fiches du costum `from` vers le costum `to` (source.key/keys : from → to), `from` restant en RÉFÉRENCEMENT (reference.costum += from, + annotation reference.costumTypes.<from>). Réécriture EN PLACE (_id préservé : documents/images, liens, slug, historique intacts). C'est la voie DÉDIÉE et la SEULE : les verrous historiques restent (Element::prepData jette source à l'update ; setsource add refuse set=source). Gate : super-admin OU (admin du costum `from` ET admin du costum `to`) — le cédant consent, le repreneur accepte. Action legacy née EN MIROIR du port Node (byte-parité dès la naissance). MODE CHECK : dry-run STRUCTUREL (aucune écriture) — sélectionne, déroule les contrôles d'uniformité (bloquants : source.keys en objet à trous, provenance divergente, rattachements multiples selon keysPolicy, sous-type indéterminable, champs costum du cédant absents du repreneur [fusion moteur⊕overlay des DEUX slugs, pas la lecture naïve du doc costum], ids introuvables, sélection >5000 ; warnings : référencement préexistant [complété, jamais écrasé], modération en attente [les flags scopés survivent], auto-référencement parasite), déduit le sous-type, compare les schémas costum et renvoie un exemple avant/après. canApply=true autorise l'apply. La sélection est triée _id croissant (déterminisme : sample = plus petit _id, ids des contrôles triés).
|
|
1581
|
+
* Constant : TRANSFER_SOURCE_CHECK
|
|
1582
|
+
* @param data - Données envoyées à l'API
|
|
1583
|
+
* @returns Les données de réponse.
|
|
1584
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1585
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1586
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1587
|
+
*/
|
|
1588
|
+
transferSourceCheck(data: TransferSourceCheckData): Promise<any>;
|
|
1589
|
+
/**
|
|
1590
|
+
* Appliquer un transfert d'appropriation : Migration d'APPROPRIATION : transfère la PROPRIÉTÉ d'un ensemble de fiches du costum `from` vers le costum `to` (source.key/keys : from → to), `from` restant en RÉFÉRENCEMENT (reference.costum += from, + annotation reference.costumTypes.<from>). Réécriture EN PLACE (_id préservé : documents/images, liens, slug, historique intacts). C'est la voie DÉDIÉE et la SEULE : les verrous historiques restent (Element::prepData jette source à l'update ; setsource add refuse set=source). Gate : super-admin OU (admin du costum `from` ET admin du costum `to`) — le cédant consent, le repreneur accepte. Action legacy née EN MIROIR du port Node (byte-parité dès la naissance). MODE APPLY : RE-DÉROULE INTÉGRALEMENT le pipeline de check sur la sélection recalculée (la sélection peut bouger entre check et apply) et refuse au moindre bloquant ; `expectedCount` (posé par l'UI depuis le dry-run) refuse aussi si le compte a dérivé. Puis : insert du run dans sourceMigrations (statut applying + SNAPSHOT {id, source, reference} de chaque fiche AVANT écriture — Mongo 4.2 sans transactions, le rollback est matérialisé), passe de nettoyage cleanSelfReference, écriture ($set source.key/keys + annotation, $addToSet reference.costum — jamais $set de la racine reference), activityStream par fiche, recomptage auto-vérifiant, statut applied. Idempotent par construction : rejouer → sélection vide ou sourceKeyMismatch → refus propre.
|
|
1591
|
+
* Constant : TRANSFER_SOURCE_APPLY
|
|
1592
|
+
* @param data - Données envoyées à l'API
|
|
1593
|
+
* @returns Les données de réponse.
|
|
1594
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1595
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1596
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1597
|
+
*/
|
|
1598
|
+
transferSourceApply(data: TransferSourceApplyData): Promise<any>;
|
|
1599
|
+
/**
|
|
1600
|
+
* Annuler un transfert d'appropriation (rollback) : Migration d'APPROPRIATION : transfère la PROPRIÉTÉ d'un ensemble de fiches du costum `from` vers le costum `to` (source.key/keys : from → to), `from` restant en RÉFÉRENCEMENT (reference.costum += from, + annotation reference.costumTypes.<from>). Réécriture EN PLACE (_id préservé : documents/images, liens, slug, historique intacts). C'est la voie DÉDIÉE et la SEULE : les verrous historiques restent (Element::prepData jette source à l'update ; setsource add refuse set=source). Gate : super-admin OU (admin du costum `from` ET admin du costum `to`) — le cédant consent, le repreneur accepte. Action legacy née EN MIROIR du port Node (byte-parité dès la naissance). MODE ROLLBACK : restaure, fiche par fiche depuis le snapshot du run, les RACINES source et reference ENTIÈRES ($set/$unset racine — jamais de mix racine/sous-chemin dans un même update). Une fiche dont source.key a changé depuis est passée (moved) ; une fiche supprimée aussi (missing) — rollback PARTIEL accepté, compteurs renvoyés. Une édition de CONTENU n'est PAS un conflit (seuls source/reference sont restaurés). Gate recalculé sur les from/to DU RUN (jamais du body). Un run rolledback n'est pas rejouable. Un run resté applying (crash à mi-course) reste rollbackable.
|
|
1601
|
+
* Constant : TRANSFER_SOURCE_ROLLBACK
|
|
1602
|
+
* @param data - Données envoyées à l'API
|
|
1603
|
+
* @returns Les données de réponse.
|
|
1604
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1605
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1606
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1607
|
+
*/
|
|
1608
|
+
transferSourceRollback(data: TransferSourceRollbackData): Promise<any>;
|
|
1609
|
+
/**
|
|
1610
|
+
* Historique des transferts d'appropriation : Migration d'APPROPRIATION : transfère la PROPRIÉTÉ d'un ensemble de fiches du costum `from` vers le costum `to` (source.key/keys : from → to), `from` restant en RÉFÉRENCEMENT (reference.costum += from, + annotation reference.costumTypes.<from>). Réécriture EN PLACE (_id préservé : documents/images, liens, slug, historique intacts). C'est la voie DÉDIÉE et la SEULE : les verrous historiques restent (Element::prepData jette source à l'update ; setsource add refuse set=source). Gate : super-admin OU (admin du costum `from` ET admin du costum `to`) — le cédant consent, le repreneur accepte. Action legacy née EN MIROIR du port Node (byte-parité dès la naissance). MODE HISTORY : sans migrationId, liste les runs (SANS snapshot) où `slug` est cédant ou repreneur, triés created décroissant (gate : super-admin ou admin de `slug`). Avec migrationId : le run COMPLET, snapshot inclus — c'est le téléchargement JSON de rollback côté UI (gate : super-admin ou admin d'un des deux slugs du run). Dates en secondes Unix (scalaires purs — convention byte-parité du né-en-miroir).
|
|
1611
|
+
* Constant : TRANSFER_SOURCE_HISTORY
|
|
1612
|
+
* @param data - Données envoyées à l'API
|
|
1613
|
+
* @returns Les données de réponse.
|
|
1614
|
+
* @throws {ApiResponseError} - En cas d'erreur détectée dans la réponse.
|
|
1615
|
+
* @throws {ApiAuthenticationError} - En cas d'erreur d'authentification.
|
|
1616
|
+
* @throws {Error} - En cas d'erreur inattendue.
|
|
1617
|
+
*/
|
|
1618
|
+
transferSourceHistory(data: TransferSourceHistoryData): Promise<any>;
|
|
1579
1619
|
/**
|
|
1580
1620
|
* File de modération (news + commentaires signalés) : File de modération : news et commentaires signalés (reportAbuse) non encore tranchés et non déjà modérés par l'utilisateur courant. Port de ModerateAction (vue HTML → JSON). Les commentaires dont la news parente est flaggée abus sont retirés.
|
|
1581
1621
|
* Constant : MODERATE
|
|
@@ -6733,6 +6733,198 @@ export interface SetSourceData {
|
|
|
6733
6733
|
};
|
|
6734
6734
|
[k: string]: unknown;
|
|
6735
6735
|
}
|
|
6736
|
+
export interface TransferSourceCheckData {
|
|
6737
|
+
/**
|
|
6738
|
+
* Slug du costum CÉDANT (propriétaire actuel des fiches).
|
|
6739
|
+
*/
|
|
6740
|
+
from: string;
|
|
6741
|
+
/**
|
|
6742
|
+
* Slug du costum REPRENEUR (nouveau propriétaire). Posé automatiquement par BaseEntity (= site courant) si absent.
|
|
6743
|
+
*/
|
|
6744
|
+
to: string;
|
|
6745
|
+
/**
|
|
6746
|
+
* Collection des fiches. Sous-ensemble d'ELEMENT_COLLECTIONS — jamais citoyens (profils personnels).
|
|
6747
|
+
*/
|
|
6748
|
+
collection: "poi" | "organizations" | "projects" | "events" | "classifieds";
|
|
6749
|
+
/**
|
|
6750
|
+
* Sélection des fiches : {ids} OU {field,value}. L'endpoint est agnostique du cas d'usage (commune, fusion de costums, correction de provenance, fiche isolée).
|
|
6751
|
+
*/
|
|
6752
|
+
selection: {
|
|
6753
|
+
/**
|
|
6754
|
+
* Sélection explicite par _id (n'importe quelle sélection UI : table, fiche isolée). Les ids passent par TOUS les contrôles. Plafond 1000 : au-delà, le form-urlencoded dépasse max_input_vars PHP (troncature silencieuse legacy) — utiliser le mode critère.
|
|
6755
|
+
*
|
|
6756
|
+
* @minItems 1
|
|
6757
|
+
* @maxItems 1000
|
|
6758
|
+
*/
|
|
6759
|
+
ids: [string, ...string[]];
|
|
6760
|
+
} | {
|
|
6761
|
+
/**
|
|
6762
|
+
* Champ de sélection de masse (whitelist serveur). La requête est {source.keys: from, <field>: value}.
|
|
6763
|
+
*/
|
|
6764
|
+
field: "address.codeInsee" | "address.level1" | "address.level3" | "address.level4" | "address.localityId" | "address.addressLocality" | "tags" | "type";
|
|
6765
|
+
/**
|
|
6766
|
+
* Valeur scalaire du champ (ex. codeInsee "97415").
|
|
6767
|
+
*/
|
|
6768
|
+
value: string;
|
|
6769
|
+
};
|
|
6770
|
+
/**
|
|
6771
|
+
* Options du geste. Défauts appliqués côté client (AJV useDefaults) ET normalisés côté serveur.
|
|
6772
|
+
*/
|
|
6773
|
+
options?: {
|
|
6774
|
+
/**
|
|
6775
|
+
* true (défaut) : from reste en référencement (reference.costum += from) avec annotation éventuelle. false : transfert SEC (ni référence, ni annotation) — correction de provenance.
|
|
6776
|
+
*/
|
|
6777
|
+
keepReference?: boolean;
|
|
6778
|
+
/**
|
|
6779
|
+
* Annotation reference.costumTypes.<from>. "auto" (défaut) = déduite du `type` si la sélection est homogène (sinon bloquant subTypeIndeterminable) ; "" = pas d'annotation ; sinon valeur explicite. Ignorée si keepReference=false.
|
|
6780
|
+
*/
|
|
6781
|
+
subType?: string;
|
|
6782
|
+
/**
|
|
6783
|
+
* Mode réparation générique : cible les fiches DÉJÀ possédées par `to` et référencées par `from` SANS annotation ; pose uniquement reference.costumTypes.<from>. Successeur produit du --repair du script CLI.
|
|
6784
|
+
*/
|
|
6785
|
+
annotateOnly?: boolean;
|
|
6786
|
+
/**
|
|
6787
|
+
* true (défaut) : purge l'auto-référencement parasite de `to` (reference.costum ∋ to, reference.costumTypes.<to>) en passe préalable — séquelle des ré-imports.
|
|
6788
|
+
*/
|
|
6789
|
+
cleanSelfReference?: boolean;
|
|
6790
|
+
/**
|
|
6791
|
+
* strict (défaut) : source.keys multiples = bloquant. replace : remplace from par to DANS keys en préservant les autres clés (ex. marqueur ESS974), écriture par fiche.
|
|
6792
|
+
*/
|
|
6793
|
+
keysPolicy?: "strict" | "replace";
|
|
6794
|
+
};
|
|
6795
|
+
/**
|
|
6796
|
+
* Slug du costum courant (contexte). Posé automatiquement par BaseEntity.
|
|
6797
|
+
*/
|
|
6798
|
+
costumSlug?: string;
|
|
6799
|
+
/**
|
|
6800
|
+
* ID de l'entité porteuse du costum courant. Optionnel.
|
|
6801
|
+
*/
|
|
6802
|
+
costumId?: string;
|
|
6803
|
+
/**
|
|
6804
|
+
* Type de l'entité porteuse du costum courant. Optionnel.
|
|
6805
|
+
*/
|
|
6806
|
+
costumType?: string;
|
|
6807
|
+
[k: string]: unknown;
|
|
6808
|
+
}
|
|
6809
|
+
export interface TransferSourceApplyData {
|
|
6810
|
+
/**
|
|
6811
|
+
* Slug du costum CÉDANT (propriétaire actuel des fiches).
|
|
6812
|
+
*/
|
|
6813
|
+
from: string;
|
|
6814
|
+
/**
|
|
6815
|
+
* Slug du costum REPRENEUR (nouveau propriétaire). Posé automatiquement par BaseEntity (= site courant) si absent.
|
|
6816
|
+
*/
|
|
6817
|
+
to: string;
|
|
6818
|
+
/**
|
|
6819
|
+
* Collection des fiches. Sous-ensemble d'ELEMENT_COLLECTIONS — jamais citoyens (profils personnels).
|
|
6820
|
+
*/
|
|
6821
|
+
collection: "poi" | "organizations" | "projects" | "events" | "classifieds";
|
|
6822
|
+
/**
|
|
6823
|
+
* Sélection des fiches : {ids} OU {field,value}. L'endpoint est agnostique du cas d'usage (commune, fusion de costums, correction de provenance, fiche isolée).
|
|
6824
|
+
*/
|
|
6825
|
+
selection: {
|
|
6826
|
+
/**
|
|
6827
|
+
* Sélection explicite par _id (n'importe quelle sélection UI : table, fiche isolée). Les ids passent par TOUS les contrôles. Plafond 1000 : au-delà, le form-urlencoded dépasse max_input_vars PHP (troncature silencieuse legacy) — utiliser le mode critère.
|
|
6828
|
+
*
|
|
6829
|
+
* @minItems 1
|
|
6830
|
+
* @maxItems 1000
|
|
6831
|
+
*/
|
|
6832
|
+
ids: [string, ...string[]];
|
|
6833
|
+
} | {
|
|
6834
|
+
/**
|
|
6835
|
+
* Champ de sélection de masse (whitelist serveur). La requête est {source.keys: from, <field>: value}.
|
|
6836
|
+
*/
|
|
6837
|
+
field: "address.codeInsee" | "address.level1" | "address.level3" | "address.level4" | "address.localityId" | "address.addressLocality" | "tags" | "type";
|
|
6838
|
+
/**
|
|
6839
|
+
* Valeur scalaire du champ (ex. codeInsee "97415").
|
|
6840
|
+
*/
|
|
6841
|
+
value: string;
|
|
6842
|
+
};
|
|
6843
|
+
/**
|
|
6844
|
+
* Options du geste. Défauts appliqués côté client (AJV useDefaults) ET normalisés côté serveur.
|
|
6845
|
+
*/
|
|
6846
|
+
options?: {
|
|
6847
|
+
/**
|
|
6848
|
+
* true (défaut) : from reste en référencement (reference.costum += from) avec annotation éventuelle. false : transfert SEC (ni référence, ni annotation) — correction de provenance.
|
|
6849
|
+
*/
|
|
6850
|
+
keepReference?: boolean;
|
|
6851
|
+
/**
|
|
6852
|
+
* Annotation reference.costumTypes.<from>. "auto" (défaut) = déduite du `type` si la sélection est homogène (sinon bloquant subTypeIndeterminable) ; "" = pas d'annotation ; sinon valeur explicite. Ignorée si keepReference=false.
|
|
6853
|
+
*/
|
|
6854
|
+
subType?: string;
|
|
6855
|
+
/**
|
|
6856
|
+
* Mode réparation générique : cible les fiches DÉJÀ possédées par `to` et référencées par `from` SANS annotation ; pose uniquement reference.costumTypes.<from>. Successeur produit du --repair du script CLI.
|
|
6857
|
+
*/
|
|
6858
|
+
annotateOnly?: boolean;
|
|
6859
|
+
/**
|
|
6860
|
+
* true (défaut) : purge l'auto-référencement parasite de `to` (reference.costum ∋ to, reference.costumTypes.<to>) en passe préalable — séquelle des ré-imports.
|
|
6861
|
+
*/
|
|
6862
|
+
cleanSelfReference?: boolean;
|
|
6863
|
+
/**
|
|
6864
|
+
* strict (défaut) : source.keys multiples = bloquant. replace : remplace from par to DANS keys en préservant les autres clés (ex. marqueur ESS974), écriture par fiche.
|
|
6865
|
+
*/
|
|
6866
|
+
keysPolicy?: "strict" | "replace";
|
|
6867
|
+
};
|
|
6868
|
+
/**
|
|
6869
|
+
* Compteur affiché à l'utilisateur au dry-run. Si ≠ du recomptage à l'apply → refus (selectionDrift).
|
|
6870
|
+
*/
|
|
6871
|
+
expectedCount?: number;
|
|
6872
|
+
/**
|
|
6873
|
+
* Slug du costum courant (contexte). Posé automatiquement par BaseEntity.
|
|
6874
|
+
*/
|
|
6875
|
+
costumSlug?: string;
|
|
6876
|
+
/**
|
|
6877
|
+
* ID de l'entité porteuse du costum courant. Optionnel.
|
|
6878
|
+
*/
|
|
6879
|
+
costumId?: string;
|
|
6880
|
+
/**
|
|
6881
|
+
* Type de l'entité porteuse du costum courant. Optionnel.
|
|
6882
|
+
*/
|
|
6883
|
+
costumType?: string;
|
|
6884
|
+
[k: string]: unknown;
|
|
6885
|
+
}
|
|
6886
|
+
export interface TransferSourceRollbackData {
|
|
6887
|
+
/**
|
|
6888
|
+
* _id du run dans sourceMigrations (renvoyé par apply, listé par history).
|
|
6889
|
+
*/
|
|
6890
|
+
migrationId: string;
|
|
6891
|
+
/**
|
|
6892
|
+
* Slug du costum courant (contexte). Posé automatiquement par BaseEntity.
|
|
6893
|
+
*/
|
|
6894
|
+
costumSlug?: string;
|
|
6895
|
+
/**
|
|
6896
|
+
* Optionnel.
|
|
6897
|
+
*/
|
|
6898
|
+
costumId?: string;
|
|
6899
|
+
/**
|
|
6900
|
+
* Optionnel.
|
|
6901
|
+
*/
|
|
6902
|
+
costumType?: string;
|
|
6903
|
+
[k: string]: unknown;
|
|
6904
|
+
}
|
|
6905
|
+
export interface TransferSourceHistoryData {
|
|
6906
|
+
/**
|
|
6907
|
+
* Slug dont on liste l'historique (cédant OU repreneur). Posé automatiquement par BaseEntity (= site courant).
|
|
6908
|
+
*/
|
|
6909
|
+
slug: string;
|
|
6910
|
+
/**
|
|
6911
|
+
* Si présent : renvoie CE run complet (avec snapshot) au lieu de la liste.
|
|
6912
|
+
*/
|
|
6913
|
+
migrationId?: string;
|
|
6914
|
+
/**
|
|
6915
|
+
* Slug du costum courant (contexte). Posé automatiquement par BaseEntity.
|
|
6916
|
+
*/
|
|
6917
|
+
costumSlug?: string;
|
|
6918
|
+
/**
|
|
6919
|
+
* Optionnel.
|
|
6920
|
+
*/
|
|
6921
|
+
costumId?: string;
|
|
6922
|
+
/**
|
|
6923
|
+
* Optionnel.
|
|
6924
|
+
*/
|
|
6925
|
+
costumType?: string;
|
|
6926
|
+
[k: string]: unknown;
|
|
6927
|
+
}
|
|
6736
6928
|
export interface ModerateData {
|
|
6737
6929
|
[k: string]: unknown;
|
|
6738
6930
|
}
|