Skip to content

Projets ​

Les projets Constellation vous permettent de regrouper des différentes bases de données qui portent sur le même thème (par exemple, fluviologie du monde, ou agronomie des vergers).

Général ​

Actions générales pour gérer vos projets.

client.projets.suivreProjets({ f }) ​

Recherche les projets appartenant au compte présent. Pour rechercher des bases ded données d'autres utilisatrices sur le réseau Constellation, voir la section réseau.

Paramètres ​

NomTypeDescription
f(projets: string[]) => voidCette fonction sera appelée avec la liste des identifiants des projets chaque fois que celle-ci est modifiée.

Retour ​

TypeDescription
Promise<() => Promise<void>>Fonction à appeler pour arrêter le suivi.

Exemple ​

ts
import { ref } from "vue";
import { créerConstellation } from "@constl/ipa";

const client = créerConstellation();

const projets = ref<string[]>();
await client.projets.suivreProjets({ f: x => projets.value = x });

client.projets.créerProjet({ épingler }) ​

Crée un nouveau projet.

Paramètres ​

NomTypeDescription
épinglerbooleanSi nous épinglons le nouveau projet. Vrai par défaut.

Retour ​

TypeDescription
Promise<string>L'identifiant du nouveau projet.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

client.projets.copierProjet({ idProjet }) ​

Crée une copie d'un projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet à copier.

Retour ​

TypeDescription
Promise<string>L'identifiant du nouveau projet.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();
const idCopie = await client.projets.copierProjet({ idProjet });

client.projets.inviterAuteur({ idProjet, idCompteAuteur, rôle }) ​

Inviter une autre utilisatrice à modifier un projet vous appartenant. Attention ! Une fois invitée, une personne ne peut pas être désinvitée.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
idCompteAuteurstringL'identifiant du compte de la personne à inviter.
rôle`"MODÉRATEUR""MEMBRE"`

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();
await client.projets.inviterAuteur({ 
    idProjet, 
    idCompteAuteur: "idDuCompteDeMonAmieÀQuiJeFaisTrèsConfiance",
    rôle: "MODÉRATEUR" 
});

client.projets.effacerProjet({ idProjet }) ​

Effacer un projet. Étant donné la structure distribuée de Constellation, cette action effacera le projet de votre dispositif, mais ne pourra pas forcer les autres membres du réseau à l'effacer également.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet à effacer.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();
await client.projets.effacerProjet({ idProjet });

client.projets.suivreQualitéProjet({ idProjet }) ​

Suivre une mesure (subjective, de 0 à 1) de la qualité d'un projet. 1 indique la meilleure qualité.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
f(qualité: number) => voidUne fonction qui sera appelée avec la qualité du projet chaque fois que celle-ci change.

Retour ​

TypeDescription
Promise<() => Promise<void>>Fonction à appeler pour arrêter le suivi.

Exemple ​

ts
import { ref } from "vue";
import { créerConstellation } from "@constl/ipa";

const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

const qualité = ref<number>();
const fOublierSuivi = await client.projets.suivreQualitéProjet({ 
    idProjet,
    f: x => qualité.value = x
});

Noms ​

Dans Constellation, chaque projet est défini par un code identifiant et peut ensuite être nommé dans autant de langues que vous le souhaitez.

client.projets.sauvegarderNomProjet({ idProjet, langue, nom }) ​

Sauvegarde le nom du projet dans une langue donnée.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
nomstringLe nom du projet.
languestringLa langue du nom.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();
await client.projets.sauvegarderNomProjet({
    idProjet, 
    langue: "fr", 
    nom: "Hydrologie fluviale" 
});

client.projets.sauvegarderNomsProjet({ idProjet, noms }) ​

Sauvegarde le nom du projet dans plusieurs langues en même temps.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
noms{ [langue: string]: string }Les noms du projet, indexés par langue.

Exemple ​

ts

import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();
await client.projets.sauvegarderNomsProjet({ 
    idProjet, 
    noms: { fr: "Hydrologie fluviale", த: "ஆறு நீரியல்"}
});

client.projets.effacerNomProjet({ idProjet, langue }) ​

Efface la traduction du nom du projet dans une langue donnée.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
languestringLa langue dont ont doit effacer le nom.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();
await client.projets.effacerNomProjet({ idProjet, langue: "fr" });

client.projets.suivreNomsProjet({ idProjet, f }) ​

Suit les noms (traduits en différentes langues) du projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
f(noms: { [langue: string]: string }) => voidUne fonction qui sera appelée avec les noms du projet chaque fois qu'ils changent

Retour ​

TypeDescription
Promise<() => Promise<void>>Fonction à appeler pour arrêter le suivi.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

const fOublierNoms = await client.projets.suivreNomsProjet({ 
    idProjet,
    f: async noms => {
        console.log(noms);
        await fOublierNoms();
    }
});

await client.projets.sauvegarderNomsProjet({ 
    idProjet, 
    noms: { fr: "Hydrologie fluviale", த: "ஆறு நீரியல்"}
});

Descriptions ​

Dans Constellation, chaque projet peut aussi être accompagné d'une description plus informative.

client.projets.sauvegarderDescriptionProjet({ idProjet, langue, nom }) ​

Sauvegarde la description du projet dans une langue donnée.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
descriptionstringLa description du projet.
languestringLa langue de la description.

Exemple ​

ts

import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();
await client.projets.sauvegarderDescriptionProjet({
    idProjet, 
    langue: "fr", 
    description: "Projet regroupant des bases de données d'hydrologie fluviale." 
});

client.projets.sauvegarderDescriptionsProjet({ idProjet, descriptions }) ​

Sauvegarde la description d'un projet dans plusieurs langues en même temps.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
descriptions{ [langue: string]: string }Les descriptions du projet, indexées par langue.

Exemple ​

ts

import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();
await client.projets.sauvegarderDescriptionsProjet({ 
    idProjet, 
    descriptions: { 
        fr: "Projet regroupant des bases de données d'hydrologie fluviale.", 
        த: "ஆறு நீரியல் தரவுகள் சேர்க்கும் ஒரு திட்டம்."
    }
});

client.projets.effacerDescriptionProjet({ idProjet, langue }) ​

Efface la traduction d'une description du projet dans une langue donnée.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
languestringLa langue dont ont doit effacer la description.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();
await client.projets.effacerDescriptionProjet({ idProjet, langue: "fr" });

client.projets.suivreDescriptionsProjet({ idProjet, f }) ​

Suit les descriptions (traduites en différentes langues) du projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
f(descriptions: { [langue: string]: string }) => voidUne fonction qui sera appelée avec les descriptions du projet chaque fois qu'elles changent

Retour ​

TypeDescription
Promise<() => Promise<void>>Fonction à appeler pour arrêter le suivi.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

const fOublierDescriptions = await client.projets.suivreDescriptionsProjet({ 
    idProjet,
    f: async descrs => {
        console.log(descrs);
        await fOublierDescriptions();
    }
});

await client.projets.sauvegarderDescriptionProjet({ 
    idProjet, 
    langue: "த",
    description: "ஆறு நீரியல் தரவுகள் சேர்க்கும் ஒரு திட்டம்."
});

Image ​

Les projets peuvent être avoir une image décorative qui apparaîtra sur l'interface.

client.projets.sauvegarderImage({ idProjet, image }) ​

Sauvegarde une image décorative.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
imageimport("ipfs-core-types/src/utils").ImportCandidateL'image.

Exemple ​

ts

import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

const image = fs.readFileSync("mon image locale.jpeg");
await client.projets.sauvegarderImage({ idProjet, image });

client.projets.effacerImage({ idProjet }) ​

Efface l'image du projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.

Exemple ​

ts
// ...continuant de ci-dessus...

await client.projets.effacerImage( { idProjet });

client.projets.suivreImage({ idProjet, f }) ​

Suit l'image du projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
f`(image:null) => void`

Retour ​

TypeDescription
Promise<() => Promise<void>>Fonction à appeler pour arrêter le suivi.

Exemple ​

ts
import { ref } from 'vue';
import { créerConstellation } from "@constl/ipa";

const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

const image = ref<{ image: Uint8Array, idImage: string } | null>();
const fOublierImage = await client.projets.suivreImage({ f: x => image.value = x });

await fOublierImage();

Bases de données ​

Chaque projet Constellation regroupe plusieurs bases de données.

client.projets.ajouterBdProjet({ idProjet, idBd }) ​

Ajoute des mots-clefs au projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
idBd`stringstring[]`

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();
const idBd = await client.bds.créerBd({ licence: "ODbl-1_0" });

await client.projets.ajouterBdProjet({ 
    idProjet, 
    idBd
});

client.projets.effacerBdProjet({ idProjet, idBd }) ​

Enlève une base de données du projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
idBdstringL'identifiant de la base de données à enlever.

Exemple ​

ts
// En continuant de ci-dessus...

await client.projets.effacerBdProjet({ 
    idProjet, 
    idBd
});

client.projets.suivreBdsProjet({ idProjet, f }) ​

Suit les bases de données associées au projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
f(bds: string[]) => voidUne fonction qui sera appelée avec la liste des identifiants des bases de données associées au projet chaque fois que celle-ci change.

Retour ​

TypeDescription
Promise<() => Promise<void>>Fonction à appeler pour arrêter le suivi.

Exemple ​

ts
import { ref } from "vue";
import { créerConstellation } from "@constl/ipa";

const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

const bdsProjet = ref<string[]>();

const fOublierBds = await client.projets.suivreBdsProjet({ 
    idProjet,
    f: x => bdsProjet.value = x,
});

const idBd = await client.bds.créerBd({ licence: "ODbl-1_0" });
await client.projets.ajouterBdProjet({ 
    idProjet, 
    idBd
});

Mots-clefs ​

Chaque projet Constellation peut être associé avec plusieurs mots-clefs.

client.projets.ajouterMotsClefsProjet({ idProjet, idsMotsClefs }) ​

Ajoute des mots-clefs au projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
idsMotsClefs`stringstring[]`

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

const idMotClef = await client.motsClefs.créerMotClef();
await client.motsClefs.sauvegarderNomMotClef({
    idMotClef,
    nom: "Hydrologie",
    langue: "fr"
})

await client.projets.ajouterMotsClefsProjet({ 
    idProjet, 
    idsMotsClefs: idMotClef
});

client.projets.effacerMotClefProjet({ idProjet, idMotClef }) ​

Enlève un mot-clef du projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
idMotClefstringL'identifiant du mot-clef à enlever.

Exemple ​

ts
// En continuant de ci-dessus...

await client.projets.effacerMotClefProjet({ 
    idProjet, 
    idMotClef
});

client.projets.suivreMotsClefsProjet({ idProjet, f }) ​

Suit les mots-clefs associés au projet, soit directement, soit indirectement à travers les mots-clefs des bases de données incluses dans le projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
f`(motsClefs: {idMotClef: string, source: "projet""bds"}[]) => void`

Retour ​

TypeDescription
Promise<() => Promise<void>>Fonction à appeler pour arrêter le suivi.

Exemple ​

ts
import { ref } from "vue";
import { créerConstellation } from "@constl/ipa";

const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

const motsClefs = ref<{idMotClef: string, source: "projet" | "bds"}[]>();

const fOublierMotsClefs = await client.projets.suivreMotsClefsProjet({ 
    idProjet,
    f: x => motsClefs.value = x,
});

const idMotClefHydrologie = await client.motsClefs.créerMotClef();
await client.motsClefs.sauvegarderNomMotClef({
    idMotClef,
    nom: "Hydrologie",
    langue: "fr"
})

// Ajouter des mots-clefs directement au projet
await client.projets.ajouterMotsClefsProjet({ 
    idProjet, 
    idsMotsClefs: idMotClefHydrologie
});


// Ajouter des mots-clefs à une base de données
const idBd = await client.bds.créerBd({ licence: "ODbl-1_0" });
const idMotClefFluviologie = await client.motsClefs.créerMotClef();
await client.motsClefs.sauvegarderNomMotClef({
    idMotClef,
    nom: "Fluviologie",
    langue: "fr"
});
await client.bds.ajouterMotsClefsBd({ 
    idBd, idsMotsClefs: idMotClefFluviologie 
});

// Ajouter la base de données au projet
await client.projets.ajouterBdProjet({ idProjet, idBd });

Variables ​

Les variables ne peuvent pas être ajoutées directement à un projet, sinon à ses bases de données de celle-ci. Cependant, vous pouvez suivre la liste de variables associées à un projet.

client.projets.suivreVariablesProjet({ idProjet, f }) ​

Suit les variables associées au projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
f(variables: string[]) => voidUne fonction qui sera appelée avec la liste des identifiants des variables associées au projet chaque fois que celle-ci change.

Retour ​

TypeDescription
Promise<() => Promise<void>>Fonction à appeler pour arrêter le suivi.

Exemple ​

ts
import { ref } from "vue";
import { créerConstellation } from "@constl/ipa";

const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

const variables = ref<string[]>();
const fOublierVariables = await client.projets.suivreVariablesProjet({ 
    idProjet,
    f: x => variables.value = x,
});

// Ajouter des variables à une base de données
const idBd = await client.bds.créerBd({ licence: "ODbl-1_0" });
const idTableau = await client.bds.ajouterTableauBd({ idBd });
const idVariableNumérique = await client.variables.créerVariable({ catégorie: "numérique" });
await client.tableaux.ajouterColonneTableau({
    idTableau,
    idVariable: idVariableNumérique,
});

// Ajouter la base de données au projet
await client.projets.ajouterBdProjet({ idProjet, idBd });

Exportation données ​

Vous pouvez exporter des données d'un projet Constellation vers un autre format (Excel, LibreOffice ou autre).

client.projets.exporterDonnées({ idProjet, langues, nomFichier }) ​

Exporte les données d'un projet mais ne le sauvegarde pas immédiatement au disque.

ASTUCE

Vous pouvez également automatiser ces actions !

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
langues`string[]undefined`
nomFichier`stringundefined`

Retour ​

TypeDescription
Promise<donnéesProjetExportées>Les données exportées, prètes à être écrites à un fichier de votre choix.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

// ... ajouter des bases de données ...

const donnéesExportées = await client.projets.exporterDonnées({ 
    idProjet, 
    langues: ["fr", "த", "kaq"]
});

// Faire quelque chose avec le document

client.projets.documentDonnéesÀFichier({ données, formatDoc, dossier, inclureDocuments }) ​

Prend les données exportées par client.projets.exporterDonnées et les sauvegarde sur le disque.

Paramètres ​

NomTypeDescription
donnéesdonnéesProjetExportéesLes données déjà exportées.
formatDoc`xlsx.BookType"xls"`
dossier`stringundefined`
inclureDocumentsbooleanSi nous voulons sauvegarder les fichiers (images, vidéos ou autres) incluses dans le projet.

Retour ​

TypeDescription
Promise<string>L'adresse du fichier créé.

Exemple ​

ts
// ... continuant de ci-dessus ...

const adresseFichier = await client.projets.documentDonnéesÀFichier({ 
    données: donnéesExportées,
    formatDoc: "ods",  // ou bien "xlsx",
    dossier: "./mes données exportées"
});

// Vous pouvez maintenant ouvrir le document `adresseFichier`.

client.projets.suivreDonnéesExportation({ idProjet, langues, f }) ​

Suite les données d'un projet en format exportation (données traduites).

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
langues`string[]undefined`
fPromise<donnéesProjetExportation>Fonction de suivi qui sera appellée chaque fois que changeront les données.

Retour ​

TypeDescription
Promise<() => Promise<void>>Fonction à appeler pour arrêter le suivi.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

// ... ajouter des bases de données ...

const fOublier = await client.projets.suivreDonnéesExportation({ 
    idProjet, 
    langues: ["fr", "த", "kaq"],
    f: console.log
});

Statut ​

Les projets peuvent être identifiées en tant qu'actifs, jouet, obsolètes ou bien internes à une autre application.

client.projets.changerStatutProjet({ idProjet, statut }) ​

Change le statut du projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
statutschémaStatutLe statut du projet.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

await client.projets.changerStatutProjet({ 
    idProjet, 
    statut: {
        statut: "interne"
    }
});

client.projets.marquerObsolète({ idProjet, idNouvelle }) ​

Indique que le projet est maintenant obsolète.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
idNouvelle`stringundefined`

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

const idNouvelle = await client.projets.créerProjet();
await client.projets.marquerObsolète({ 
    idProjet, 
    idNouvelle
});

client.projets.marquerActif({ idProjet }) ​

Indique que le projet est actif (pas obsolète).

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

await client.projets.marquerActive({ idProjet });

client.projets.marquerJouet({ idProjet }) ​

Indique que le projet est un test et ne contient pas de vraies données.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

await client.projets.marquerJouet({ idProjet });

client.projets.marquerInterne({ idProjet }) ​

Indique que le projet est un projet interne pour une application tièrce et ne devrait probablement pas être directement visible à l'utilisateur ou bien modifiable à la main.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.

Exemple ​

ts
import { créerConstellation } from "@constl/ipa";
const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

await client.projets.marquerInterne({ idProjet });

client.projets.suivreStatutProjet({ idProjet, f }) ​

Suit le statut du projet.

Paramètres ​

NomTypeDescription
idProjetstringL'identifiant du projet.
f(statut:schémaStatut) => voidUne fonction qui sera appelée avec le statut du projet chaque fois que celui-ci change.

Retour ​

TypeDescription
Promise<() => Promise<void>>Fonction à appeler pour arrêter le suivi.

Exemple ​

ts
import { créerConstellation, type utils } from "@constl/ipa";
import { ref } from "vue";

const client = créerConstellation();

const idProjet = await client.projets.créerProjet();

const statut = ref<utils.schémaStatut>();
const fOublierStatut = await client.projets.suivreStatutProjet({ 
    idProjet,
    f: x => statut.value = x,
});

const idTableau = await client.projets.marquerJouet({ idProjet });

Types ​

Types exportation ​

L'interface donnéesProjetExportées représente des données exportées d'un projet, et donnéesProjetExportation les données formattées et prêtes à l'exportation.

ts
interface donnéesProjetExportées {
  docs: { doc: WorkBook; nom: string }[];
  fichiersSFIP: Set<{ cid: string; ext: string }>;
  nomFichier: string;
}

interface donnéesProjetExportation {
  nomProjet: string;
  bds: donnéesBdExportation[];
}

Disponible sous licence AGPL-3.0