@constl/mandataire
Advanced tools
Comparing version 0.1.13 to 0.1.14
@@ -16,10 +16,3 @@ import path, { dirname } from "path"; | ||
inject: [path.join(__dirname, "./scripts/node-globals.js")], | ||
external: [ | ||
"fs", | ||
"path", | ||
"os", | ||
"chokidar", | ||
"@constl/electron-webrtc-relay", | ||
"minipass", | ||
], | ||
external: ["fs", "path", "os", "chokidar", "url", "zlib", "rimraf"], | ||
plugins: [ | ||
@@ -35,2 +28,5 @@ { | ||
}); | ||
build.onResolve({ filter: /^crypto$/ }, () => { | ||
return { path: require.resolve("crypto-browserify") }; | ||
}); | ||
build.onResolve({ filter: /^fs/ }, () => { | ||
@@ -37,0 +33,0 @@ return { path: require.resolve("browserify-fs") }; |
/// <reference types="node" /> | ||
import { EventEmitter } from "events"; | ||
import type { utils, mandataire, client } from "@constl/ipa"; | ||
import type { mandataire, types } from "@constl/ipa"; | ||
interface Tâche { | ||
id: string; | ||
fSuivre: utils.schémaFonctionSuivi<unknown>; | ||
fSuivre: types.schémaFonctionSuivi<unknown>; | ||
fRetour: (fonction: string, args?: unknown[]) => Promise<void>; | ||
@@ -27,3 +27,3 @@ } | ||
[key: string]: unknown; | ||
}, nomArgFonction: string): Promise<utils.schémaFonctionOublier | { | ||
}, nomArgFonction: string): Promise<types.schémaFonctionOublier | { | ||
[key: string]: (...args: unknown[]) => void; | ||
@@ -41,4 +41,4 @@ }>; | ||
} | ||
export type MandataireClientConstellation = Required<client.ClientConstellation> & ClientMandatairifiable; | ||
export declare const générerMandataire: (mandataireClient: ClientMandatairifiable) => MandataireClientConstellation; | ||
export type MandataireClientConstellation<T> = Required<T> & ClientMandatairifiable; | ||
export declare const générerMandataire: <T>(mandataireClient: ClientMandatairifiable) => MandataireClientConstellation<T>; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
export declare const version = "0.1.13"; | ||
export declare const version = "0.1.14"; |
// Generated by genversion. | ||
export const version = "0.1.13"; | ||
export const version = "0.1.14"; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,4 @@ | ||
import { utils, mandataire, utilsTests } from "@constl/ipa"; | ||
import { mandataire } from "@constl/ipa"; | ||
import { faisRien, adresseOrbiteValide } from "@constl/utils-ipa"; | ||
import { attente, sfip } from "@constl/utils-tests"; | ||
import { générerMandataire, ClientMandatairifiable, } from "../src/mandataire.js"; | ||
@@ -23,4 +25,4 @@ import { isNode, isElectronMain } from "wherearewe"; | ||
let fOublierConstellation; | ||
const attendreNoms = new utilsTests.attente.AttendreRésultat(); | ||
const attendreMC = new utilsTests.attente.AttendreRésultat(); | ||
const attendreNoms = new attente.AttendreRésultat(); | ||
const attendreMC = new attente.AttendreRésultat(); | ||
before(async () => { | ||
@@ -38,3 +40,3 @@ let dossierTempo = undefined; | ||
} | ||
const dsfip = await utilsTests.sfip.initierSFIP(dossierSFIP); | ||
const dsfip = await sfip.initierSFIP(dossierSFIP); | ||
mnd = générerMandataire(new Mandataire({ | ||
@@ -50,3 +52,3 @@ opts: { | ||
await mnd.fermer(); | ||
await utilsTests.sfip.arrêterSFIP(dsfip); | ||
await sfip.arrêterSFIP(dsfip); | ||
if (isNode || isElectronMain) { | ||
@@ -66,3 +68,3 @@ const rimraf = await import("rimraf"); | ||
const idCompte = await mnd.obtIdCompte(); | ||
expect(utils.adresseOrbiteValide(idCompte)).to.be.true(); | ||
expect(adresseOrbiteValide(idCompte)).to.be.true(); | ||
}); | ||
@@ -73,3 +75,3 @@ it("Action avec arguments", async () => { | ||
}); | ||
expect(utils.adresseOrbiteValide(idVariable)).to.be.true(); | ||
expect(adresseOrbiteValide(idVariable)).to.be.true(); | ||
}); | ||
@@ -97,3 +99,3 @@ it("Suivi", async () => { | ||
// Eléments détectés | ||
const { fOublier, fChangerN } = await mnd.recherche.rechercherMotClefSelonNom({ | ||
const { fOublier, fChangerN } = await mnd.recherche.rechercherMotsClefsSelonNom({ | ||
nomMotClef: "Météo Montréal", | ||
@@ -141,3 +143,3 @@ f: (x) => attendreMC.mettreÀJour(x), | ||
// @ts-expect-error on fait exprès | ||
mnd.profil.suivreNoms({ f: utils.faisRien, f2: utils.faisRien })).to.be.rejected(); | ||
mnd.profil.suivreNoms({ f: faisRien, f2: faisRien })).to.be.rejected(); | ||
}); | ||
@@ -148,5 +150,5 @@ it("Erreur format paramètres", async () => { | ||
// @ts-ignore | ||
mnd.profil.suivreNoms(utils.faisRien)).to.throw(); | ||
mnd.profil.suivreNoms(faisRien)).to.throw(); | ||
}); | ||
}); | ||
//# sourceMappingURL=mandataire.spec.js.map |
{ | ||
"name": "@constl/mandataire", | ||
"version": "0.1.13", | ||
"version": "0.1.14", | ||
"description": "Un mandataire très léger pour le client Constellation.", | ||
@@ -23,16 +23,19 @@ "author": "Julien Jean Malard-Adam", | ||
"devDependencies": { | ||
"@constl/ipa": "^0.7.6", | ||
"@constl/ipa": "^0.8.1", | ||
"@constl/utils-ipa": "^0.1.2", | ||
"@constl/utils-tests": "^0.1.1", | ||
"@types/mocha": "^10.0.1", | ||
"@types/uuid": "^9.0.2", | ||
"@typescript-eslint/eslint-plugin": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.2.0", | ||
"aegir": "^40.0.2", | ||
"@typescript-eslint/eslint-plugin": "^6.4.1", | ||
"@typescript-eslint/parser": "^6.4.1", | ||
"aegir": "^40.0.11", | ||
"browserify-fs": "^1.0.0", | ||
"buffer": "^6.0.3", | ||
"eslint": "^8.46.0", | ||
"eslint-config-prettier": "^8.9.0", | ||
"crypto-browserify": "^3.12.0", | ||
"eslint": "^8.47.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"genversion": "^3.1.1", | ||
"jest": "^29.6.2", | ||
"mocha": "^10.2.0", | ||
"os-browserify": "^0.3.0", | ||
"prettier": "^3.0.0", | ||
"prettier": "^3.0.2", | ||
"process": "^0.11.10", | ||
@@ -39,0 +42,0 @@ "rimraf": "^5.0.1", |
import { v4 as uuidv4 } from "uuid"; | ||
import { EventEmitter, once } from "events"; | ||
import type { utils, mandataire, client } from "@constl/ipa"; | ||
import type { mandataire, types } from "@constl/ipa"; | ||
import { MessageDeTravailleur } from "@constl/ipa/dist/src/mandataire/messages"; | ||
interface Tâche { | ||
id: string; | ||
fSuivre: utils.schémaFonctionSuivi<unknown>; | ||
fSuivre: types.schémaFonctionSuivi<unknown>; | ||
fRetour: (fonction: string, args?: unknown[]) => Promise<void>; | ||
@@ -71,3 +72,3 @@ } | ||
erreur: `Type inconnu ${type} dans message ${m}.`, | ||
id: m.id, | ||
id: (m as MessageDeTravailleur).id, | ||
}); | ||
@@ -109,6 +110,6 @@ } | ||
): Promise< | ||
| utils.schémaFonctionOublier | ||
| types.schémaFonctionOublier | ||
| { [key: string]: (...args: unknown[]) => void } | ||
> { | ||
const f = args[nomArgFonction] as utils.schémaFonctionSuivi<unknown>; | ||
const f = args[nomArgFonction] as types.schémaFonctionSuivi<unknown>; | ||
const argsSansF = Object.fromEntries( | ||
@@ -268,8 +269,8 @@ Object.entries(args).filter((x) => typeof x[1] !== "function"), | ||
export type MandataireClientConstellation = | ||
Required<client.ClientConstellation> & ClientMandatairifiable; | ||
export type MandataireClientConstellation<T> = Required<T> & | ||
ClientMandatairifiable; | ||
export const générerMandataire = ( | ||
export const générerMandataire = <T>( | ||
mandataireClient: ClientMandatairifiable, | ||
): MandataireClientConstellation => { | ||
): MandataireClientConstellation<T> => { | ||
const handler = new Handler(); | ||
@@ -279,3 +280,3 @@ return new Proxy<ClientMandatairifiable>( | ||
handler, | ||
) as MandataireClientConstellation; | ||
) as MandataireClientConstellation<T>; | ||
}; |
// Generated by genversion. | ||
export const version = "0.1.13"; | ||
export const version = "0.1.14"; |
@@ -1,2 +0,4 @@ | ||
import { client, utils, mandataire, utilsTests } from "@constl/ipa"; | ||
import { client, types, mandataire } from "@constl/ipa"; | ||
import { faisRien, adresseOrbiteValide } from "@constl/utils-ipa"; | ||
import { attente, sfip } from "@constl/utils-tests"; | ||
import { | ||
@@ -36,10 +38,10 @@ générerMandataire, | ||
describe("Mandataire", () => { | ||
let mnd: MandataireClientConstellation; | ||
let fOublierConstellation: utils.schémaFonctionOublier; | ||
let mnd: MandataireClientConstellation<client.ClientConstellation>; | ||
let fOublierConstellation: types.schémaFonctionOublier; | ||
const attendreNoms = new utilsTests.attente.AttendreRésultat<{ | ||
const attendreNoms = new attente.AttendreRésultat<{ | ||
[clef: string]: string; | ||
}>(); | ||
const attendreMC = new utilsTests.attente.AttendreRésultat< | ||
utils.résultatRecherche<utils.infoRésultatTexte>[] | ||
const attendreMC = new attente.AttendreRésultat< | ||
types.résultatRecherche<types.infoRésultatTexte>[] | ||
>(); | ||
@@ -61,3 +63,3 @@ | ||
const dsfip = await utilsTests.sfip.initierSFIP(dossierSFIP); | ||
const dsfip = await sfip.initierSFIP(dossierSFIP); | ||
@@ -76,3 +78,3 @@ mnd = générerMandataire( | ||
await mnd.fermer(); | ||
await utilsTests.sfip.arrêterSFIP(dsfip); | ||
await sfip.arrêterSFIP(dsfip); | ||
if (isNode || isElectronMain) { | ||
@@ -93,3 +95,3 @@ const rimraf = await import("rimraf"); | ||
const idCompte = await mnd.obtIdCompte(); | ||
expect(utils.adresseOrbiteValide(idCompte)).to.be.true(); | ||
expect(adresseOrbiteValide(idCompte)).to.be.true(); | ||
}); | ||
@@ -101,3 +103,3 @@ | ||
}); | ||
expect(utils.adresseOrbiteValide(idVariable)).to.be.true(); | ||
expect(adresseOrbiteValide(idVariable)).to.be.true(); | ||
}); | ||
@@ -134,3 +136,3 @@ | ||
const { fOublier, fChangerN } = | ||
await mnd.recherche.rechercherMotClefSelonNom({ | ||
await mnd.recherche.rechercherMotsClefsSelonNom({ | ||
nomMotClef: "Météo Montréal", | ||
@@ -191,3 +193,3 @@ f: (x) => attendreMC.mettreÀJour(x), | ||
// @ts-expect-error on fait exprès | ||
mnd.profil.suivreNoms({ f: utils.faisRien, f2: utils.faisRien }), | ||
mnd.profil.suivreNoms({ f: faisRien, f2: faisRien }), | ||
).to.be.rejected(); | ||
@@ -199,5 +201,5 @@ }); | ||
// @ts-ignore | ||
mnd.profil.suivreNoms(utils.faisRien), | ||
mnd.profil.suivreNoms(faisRien), | ||
).to.throw(); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
182792
932
24