@constl/utils-tests 2.1.5 → 2.2.0
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/@types.d.ts +1 -1
- package/dist/constellation.d.ts +1 -1
- package/dist/h/303/251lia.d.ts +4 -6
- package/dist/h/303/251lia.js +13 -18
- package/dist/h/303/251lia.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/libp2p/config.d.ts +5 -5
- package/dist/libp2p/config.js +3 -1
- package/dist/libp2p/config.js.map +1 -1
- package/dist/libp2p/index.d.ts +1 -1
- package/dist/libp2p/libp2p.d.ts +2 -2
- package/dist/libp2p/utils.d.ts +3 -3
- package/dist/libp2p/utils.js.map +1 -1
- package/dist/orbite.d.ts +3 -4
- package/dist/orbite.js +2 -4
- package/dist/orbite.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +17 -16
- package/pnpm-workspace.yaml +3 -0
- package/src/@types.ts +1 -1
- package/src/constellation.ts +1 -1
- package/src/h/303/251lia.ts +30 -38
- package/src/index.ts +2 -2
- package/src/libp2p/config.ts +9 -5
- package/src/libp2p/index.ts +2 -2
- package/src/libp2p/libp2p.ts +2 -2
- package/src/libp2p/utils.ts +3 -3
- package/src/orbite.ts +2 -8
- package/src/version.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +1 -0
package/dist/@types.d.ts
CHANGED
package/dist/constellation.d.ts
CHANGED
package/dist/h/303/251lia.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare const créerHéliasTest: ({ n, dossier, adresseRelai, }: {
|
|
1
|
+
import { type ServicesLibp2pTest } from "./libp2p/index.js";
|
|
2
|
+
import { type HeliaWithLibp2p } from "@helia/libp2p";
|
|
3
|
+
export declare const créerHéliasTest: ({ n, dossier, }: {
|
|
5
4
|
n: number;
|
|
6
5
|
dossier?: string;
|
|
7
|
-
adresseRelai?: string;
|
|
8
6
|
}) => Promise<{
|
|
9
|
-
hélias:
|
|
7
|
+
hélias: HeliaWithLibp2p<ServicesLibp2pTest>[];
|
|
10
8
|
fermer: () => Promise<void>;
|
|
11
9
|
}>;
|
package/dist/h/303/251lia.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { createHelia } from "helia";
|
|
2
|
-
import {
|
|
3
|
-
import { bitswap } from "@helia/block-brokers";
|
|
2
|
+
import { OptionsDéfautLibp2pNavigateur, OptionsDéfautLibp2pNode, } from "./libp2p/index.js";
|
|
4
3
|
import { MemoryBlockstore } from "blockstore-core";
|
|
5
4
|
import { join } from "path";
|
|
6
5
|
import { sousDossier } from "./utils.js";
|
|
7
6
|
import { IDBBlockstore } from "blockstore-idb";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
export const créerHéliasTest = async ({ n, dossier,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let i = 0;
|
|
17
|
-
const hélias = await Promise.all(libp2ps.map(async (libp2p) => {
|
|
7
|
+
import { isBrowser, isElectronMain, isNode } from "wherearewe";
|
|
8
|
+
import {} from "@helia/libp2p";
|
|
9
|
+
export const créerHéliasTest = async ({ n, dossier, }) => {
|
|
10
|
+
const optionsLibp2p = isBrowser
|
|
11
|
+
? OptionsDéfautLibp2pNavigateur()
|
|
12
|
+
: OptionsDéfautLibp2pNode();
|
|
13
|
+
const hélias = [];
|
|
14
|
+
for (const i of Array(n).keys()) {
|
|
18
15
|
const dossierBlocs = dossier
|
|
19
16
|
? join(sousDossier({ dossier, i }), "hélia", "blocks")
|
|
20
17
|
: undefined;
|
|
@@ -24,21 +21,19 @@ export const créerHéliasTest = async ({ n, dossier, adresseRelai, }) => {
|
|
|
24
21
|
: new IDBBlockstore(dossierBlocs)
|
|
25
22
|
: new MemoryBlockstore();
|
|
26
23
|
stockageBlocs.open?.();
|
|
27
|
-
i++;
|
|
28
24
|
const optionsHélia = {
|
|
29
25
|
blockstore: stockageBlocs,
|
|
30
|
-
libp2p,
|
|
31
|
-
blockBrokers: [bitswap()],
|
|
26
|
+
libp2p: optionsLibp2p,
|
|
32
27
|
};
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
const hélia = await createHelia(optionsHélia).start();
|
|
29
|
+
hélias.push(hélia);
|
|
30
|
+
}
|
|
35
31
|
const fermer = async () => {
|
|
36
32
|
await Promise.all(hélias.map(async (h) => {
|
|
37
33
|
await h.stop();
|
|
38
34
|
// @ts-expect-error Je ne sais pas pourquoi
|
|
39
35
|
await h.blockstore.unwrap()?.unwrap()?.child?.db?.close();
|
|
40
36
|
}));
|
|
41
|
-
await fermerLibsp2p();
|
|
42
37
|
};
|
|
43
38
|
return { hélias, fermer };
|
|
44
39
|
};
|
package/dist/h/303/251lia.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hélia.js","sourceRoot":"","sources":["../src/hélia.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"hélia.js","sourceRoot":"","sources":["../src/hélia.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,GAExB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAwB,MAAM,eAAe,CAAC;AAErD,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,EACpC,CAAC,EAC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,EAAE,CAAC;QAC5D,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ServicesLibp2pTest, ComposantesServiceClefPrivée, ServiceClefPrivée, OptionsDéfautLibp2pNode, OptionsDéfautLibp2pNavigateur, créerLibp2psTest, toutesConnectées, connecterPairs, } from "./libp2p/index.js";
|
|
1
|
+
export { type ServicesLibp2pTest, type ComposantesServiceClefPrivée, ServiceClefPrivée, OptionsDéfautLibp2pNode, OptionsDéfautLibp2pNavigateur, créerLibp2psTest, toutesConnectées, connecterPairs, } from "./libp2p/index.js";
|
|
2
2
|
export { ID_DÉFAUT_RELAI, PORT_DÉFAUT_RELAI, obtenirAdresseRelai, lancerRelai, obtenirFichierRelai, } from "./relai/index.js";
|
|
3
3
|
export { attendreFichierExiste, attendreFichierModifié, que, } from "./attente.js";
|
|
4
4
|
export { obtConfigEsbuild, générerConfigÆgir } from "./config.js";
|
package/dist/libp2p/config.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { GossipSub } from "@libp2p/gossipsub";
|
|
2
|
-
import { Identify } from "@libp2p/identify";
|
|
3
|
-
import { Libp2pOptions } from "libp2p";
|
|
4
|
-
import { PrivateKey } from "@libp2p/interface";
|
|
5
|
-
import { Ping } from "@libp2p/ping";
|
|
1
|
+
import { type GossipSub } from "@libp2p/gossipsub";
|
|
2
|
+
import { type Identify } from "@libp2p/identify";
|
|
3
|
+
import { type Libp2pOptions } from "libp2p";
|
|
4
|
+
import { type PrivateKey } from "@libp2p/interface";
|
|
5
|
+
import { type Ping } from "@libp2p/ping";
|
|
6
6
|
export type ServicesLibp2pTest = {
|
|
7
7
|
ping: Ping;
|
|
8
8
|
identify: Identify;
|
package/dist/libp2p/config.js
CHANGED
|
@@ -23,13 +23,15 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
23
23
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
24
|
SOFTWARE.
|
|
25
25
|
*/
|
|
26
|
-
import { gossipsub } from "@libp2p/gossipsub";
|
|
26
|
+
import { gossipsub, } from "@libp2p/gossipsub";
|
|
27
27
|
import { noise } from "@chainsafe/libp2p-noise";
|
|
28
28
|
import { yamux } from "@chainsafe/libp2p-yamux";
|
|
29
29
|
import { circuitRelayTransport } from "@libp2p/circuit-relay-v2";
|
|
30
30
|
import { identify } from "@libp2p/identify";
|
|
31
31
|
import { webRTC } from "@libp2p/webrtc";
|
|
32
32
|
import { webSockets } from "@libp2p/websockets";
|
|
33
|
+
import {} from "libp2p";
|
|
34
|
+
import {} from "@libp2p/interface";
|
|
33
35
|
import { ping } from "@libp2p/ping";
|
|
34
36
|
export class ServiceClefPrivée {
|
|
35
37
|
privateKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/libp2p/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;EAwBE;AAEF,OAAO,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/libp2p/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;EAwBE;AAEF,OAAO,EACL,SAAS,GAGV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAiB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,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;QAC7D,oBAAoB,EAAE,CAAC,KAAK,EAAE,CAAC;QAC/B,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC;QACvB,eAAe,EAAE;YACf,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK;SAC/B;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,IAAI,EAAE;YACZ,QAAQ,EAAE,QAAQ,EAAE;YACpB,MAAM,EAAE,SAAS,CAAC,EAAE,4BAA4B,EAAE,IAAI,EAAE,CAE1C,EAAE,yCAAyC;YACzD,aAAa,EAAE,CAAC,UAAwC,EAAE,EAAE,CAC1D,IAAI,iBAAiB,CAAC,UAAU,CAAC;SACpC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/libp2p/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ServicesLibp2pTest, ComposantesServiceClefPrivée, ServiceClefPrivée, OptionsDéfautLibp2pNode, OptionsDéfautLibp2pNavigateur, } from "./config.js";
|
|
1
|
+
export { type ServicesLibp2pTest, type ComposantesServiceClefPrivée, ServiceClefPrivée, OptionsDéfautLibp2pNode, OptionsDéfautLibp2pNavigateur, } from "./config.js";
|
|
2
2
|
export { créerLibp2psTest } from "./libp2p.js";
|
|
3
3
|
export { connecterPairs, toutesConnectées } from "./utils.js";
|
package/dist/libp2p/libp2p.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Libp2p } from "@libp2p/interface";
|
|
2
|
-
import { ServicesLibp2pTest } from "./config.js";
|
|
1
|
+
import type { Libp2p } from "@libp2p/interface";
|
|
2
|
+
import { type ServicesLibp2pTest } from "./config.js";
|
|
3
3
|
export declare const créerLibp2psTest: ({ n, adresseRelai, }: {
|
|
4
4
|
n: number;
|
|
5
5
|
adresseRelai?: string;
|
package/dist/libp2p/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Libp2p } from "@libp2p/interface";
|
|
2
|
-
import { Multiaddr } from "@multiformats/multiaddr";
|
|
3
|
-
import { ServicesLibp2pTest } from "./config.js";
|
|
1
|
+
import type { Libp2p } from "@libp2p/interface";
|
|
2
|
+
import { type Multiaddr } from "@multiformats/multiaddr";
|
|
3
|
+
import type { ServicesLibp2pTest } from "./config.js";
|
|
4
4
|
type OptionsConnectionPairs = {
|
|
5
5
|
adresseRelai: string;
|
|
6
6
|
filtre?: (ma: Multiaddr) => boolean;
|
package/dist/libp2p/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/libp2p/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/libp2p/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,SAAS,EAAkB,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAG3D,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;AAMnC,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAGjC,OAAU,EACV,OAAU,EACV,OAA+B,EAChB,EAAE;IACjB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,eAAe,CAAC;IAEjD,IAAI,SAAS,IAAI,kBAAkB,EAAE,CAAC;QACpC,MAAM,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;QAEpD,MAAM,QAAQ,GAAG,MAAM,IAAI,OAAO,CAAY,CAAC,OAAO,EAAE,EAAE;YACxD,MAAM,YAAY,GAAG,GAAG,EAAE;gBACxB,MAAM,OAAO,GAAG,OAAO;qBACpB,aAAa,EAAE;qBACf,MAAM,CAAC,CAAC,EAAE,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AC,CAAC;IACrC,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,OAAqC,EACrC,OAA+B,EAChB,EAAE;IACjB,MAAM,UAAU,GAAiC,EAAE,CAAC;IACpD,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;YAC/B,MAAM,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC5C,CAAC;QACD,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAC"}
|
package/dist/orbite.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { OrbitDB } from "@orbitdb/core";
|
|
2
|
-
import { ServicesLibp2pTest } from "./libp2p/index.js";
|
|
3
|
-
export declare const créerOrbitesTest: ({ n, dossier,
|
|
1
|
+
import { type OrbitDB } from "@orbitdb/core";
|
|
2
|
+
import { type ServicesLibp2pTest } from "./libp2p/index.js";
|
|
3
|
+
export declare const créerOrbitesTest: ({ n, dossier, }: {
|
|
4
4
|
n: number;
|
|
5
5
|
dossier?: string;
|
|
6
|
-
adresseRelai?: string;
|
|
7
6
|
}) => Promise<{
|
|
8
7
|
orbites: OrbitDB<ServicesLibp2pTest>[];
|
|
9
8
|
fermer: () => Promise<void>;
|
package/dist/orbite.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { createOrbitDB } from "@orbitdb/core";
|
|
2
2
|
import { dossierTempo } from "./dossiers.js";
|
|
3
|
+
import {} from "./libp2p/index.js";
|
|
3
4
|
import { créerHéliasTest } from "./hélia.js";
|
|
4
5
|
import { join } from "path";
|
|
5
6
|
import { sousDossier } from "./utils.js";
|
|
6
|
-
|
|
7
|
-
export const créerOrbitesTest = async ({ n, dossier, adresseRelai, }) => {
|
|
8
|
-
adresseRelai = adresseRelai ?? obtenirAdresseRelai();
|
|
7
|
+
export const créerOrbitesTest = async ({ n, dossier, }) => {
|
|
9
8
|
let effacerDossier = () => { };
|
|
10
9
|
if (!dossier) {
|
|
11
10
|
({ dossier, effacer: effacerDossier } = await dossierTempo());
|
|
@@ -14,7 +13,6 @@ export const créerOrbitesTest = async ({ n, dossier, adresseRelai, }) => {
|
|
|
14
13
|
const { hélias, fermer: fermerHélias } = await créerHéliasTest({
|
|
15
14
|
n,
|
|
16
15
|
dossier,
|
|
17
|
-
adresseRelai,
|
|
18
16
|
});
|
|
19
17
|
let i = 0;
|
|
20
18
|
for (const hélia of hélias) {
|
package/dist/orbite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orbite.js","sourceRoot":"","sources":["../src/orbite.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"orbite.js","sourceRoot":"","sources":["../src/orbite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAA2B,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,EACrC,CAAC,EACD,OAAO,GAIR,EAGE,EAAE;IACH,IAAI,cAAc,GAAe,GAAG,EAAE,GAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,YAAY,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,OAAO,GAAkC,EAAE,CAAC;IAClD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,eAAe,CAAC;QAC7D,CAAC;QACD,OAAO;KACR,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,IAAI,CACV,MAAM,aAAa,CAAC;YAClB,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC;SACvD,CAAC,CACH,CAAC;QACF,CAAC,EAAE,CAAC;IACN,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;QACxB,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAChD,MAAM,YAAY,EAAE,CAAC;QACrB,cAAc,EAAE,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO;QACL,OAAO;QACP,MAAM;KACP,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.
|
|
1
|
+
export declare const version = "2.2.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.2.0",
|
|
3
3
|
"license": "AGPL-3.0-or-later",
|
|
4
4
|
"name": "@constl/utils-tests",
|
|
5
5
|
"author": "Julien Jean Malard-Adam",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": "./dist/index.js",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/reseau-constellation/utils-tests.git"
|
|
12
|
+
},
|
|
9
13
|
"engines": {
|
|
10
14
|
"node": ">=20"
|
|
11
15
|
},
|
|
@@ -31,14 +35,14 @@
|
|
|
31
35
|
"@libp2p/websockets": "^10.1.21",
|
|
32
36
|
"@multiformats/multiaddr": "^13.0.3",
|
|
33
37
|
"@multiformats/multiaddr-matcher": "^3.0.2",
|
|
34
|
-
"@orbitdb/core-types": "
|
|
38
|
+
"@orbitdb/core-types": "2",
|
|
35
39
|
"@orbitdb/feed-db": "^1.4.2",
|
|
36
40
|
"@types/crypto-js": "^4.2.2",
|
|
37
41
|
"@types/file-saver": "^2.0.7",
|
|
38
42
|
"@types/mocha": "^10.0.10",
|
|
39
|
-
"@types/node": "^26.6.
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
41
|
-
"@typescript-eslint/parser": "^8.
|
|
43
|
+
"@types/node": "^26.6.3",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^8.71.0",
|
|
45
|
+
"@typescript-eslint/parser": "^8.71.0",
|
|
42
46
|
"aegir": "^48.1.6",
|
|
43
47
|
"ajv": "^8.20.0",
|
|
44
48
|
"buffer": "^6.0.3",
|
|
@@ -50,10 +54,10 @@
|
|
|
50
54
|
"eslint-config-prettier": "^10.1.8",
|
|
51
55
|
"eslint-config-standard": "^17.1.0",
|
|
52
56
|
"eslint-plugin-import": "^2.32.0",
|
|
53
|
-
"eslint-plugin-n": "^18.
|
|
57
|
+
"eslint-plugin-n": "^18.4.0",
|
|
54
58
|
"eslint-plugin-promise": "^7.3.0",
|
|
55
59
|
"execa": "^10.0.1",
|
|
56
|
-
"mocha": "^
|
|
60
|
+
"mocha": "^11.8.0",
|
|
57
61
|
"playwright": "^1.63.0",
|
|
58
62
|
"prettier": "^3.9.9",
|
|
59
63
|
"progress-events": "^1.1.0",
|
|
@@ -62,11 +66,11 @@
|
|
|
62
66
|
"tsconfig-paths": "^4.2.0",
|
|
63
67
|
"tscpaths": "^0.0.9",
|
|
64
68
|
"typescript": "^6.0.3",
|
|
65
|
-
"typescript-eslint": "^8.
|
|
69
|
+
"typescript-eslint": "^8.71.0",
|
|
66
70
|
"typescript-transform-paths": "^4.0.0"
|
|
67
71
|
},
|
|
68
72
|
"dependencies": {
|
|
69
|
-
"@helia/
|
|
73
|
+
"@helia/libp2p": "^2.1.4",
|
|
70
74
|
"@libp2p/gossipsub": "^17.1.2",
|
|
71
75
|
"@libp2p/peer-id": "^6.0.15",
|
|
72
76
|
"@libp2p/ping": "^3.1.13",
|
|
@@ -80,7 +84,7 @@
|
|
|
80
84
|
"crypto-browserify": "^3.12.1",
|
|
81
85
|
"events": "^3.3.0",
|
|
82
86
|
"genversion": "^3.2.0",
|
|
83
|
-
"helia": "
|
|
87
|
+
"helia": "7.1.15",
|
|
84
88
|
"libp2p": "^3.3.11",
|
|
85
89
|
"os-browserify": "^0.3.0",
|
|
86
90
|
"process": "^0.11.10",
|
|
@@ -91,20 +95,17 @@
|
|
|
91
95
|
"uuid": "^14.0.2",
|
|
92
96
|
"wherearewe": "^2.0.1"
|
|
93
97
|
},
|
|
94
|
-
"publishConfig": {
|
|
95
|
-
"@reseau-constellation:registry": "https://npm.pkg.github.com"
|
|
96
|
-
},
|
|
97
98
|
"scripts": {
|
|
98
99
|
"nettoyer": "rimraf dist",
|
|
99
|
-
"compiler": "pnpm versioner && pnpm formatter && pnpm nettoyer && pnpm tspc -p tsconfig.json",
|
|
100
|
-
"compiler:prod": "
|
|
100
|
+
"compiler": "rimraf tsconfig.build.tsbuildinfo && pnpm versioner && pnpm formatter && pnpm nettoyer && pnpm tspc -p tsconfig.json",
|
|
101
|
+
"compiler:prod": "rimraf tsconfig.build.tsbuildinfo && pnpm versioner && pnpm nettoyer && pnpm tspc -p tsconfig.build.json",
|
|
101
102
|
"test:node": "pnpm compiler && pnpm aegir test -t node -f \"dist/test/**/*.spec.js\" --cov -- --exit",
|
|
102
103
|
"test:navig": "pnpm compiler && pnpm aegir test -t browser -f \"dist/test/**/*.spec.js\" --cov",
|
|
103
104
|
"test:électron-principal": "pnpm compiler && pnpm aegir test -t electron-main -f \"dist/test/**/*.spec.js\" --cov",
|
|
104
105
|
"test:électron-rendu": "pnpm compiler && pnpm aegir test -t electron-renderer -f \"dist/test/**/*.spec.js\" --cov",
|
|
105
106
|
"test": "pnpm test:node && pnpm test:navig",
|
|
106
107
|
"formatter": "pnpm prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\" && pnpm eslint src",
|
|
107
|
-
"publier": "pnpm compiler:prod && (git commit -a -m 'version' || true) && pnpm stage publish",
|
|
108
|
+
"publier": "pnpm test && pnpm compiler:prod && (git commit -a -m 'version' || true) && pnpm stage publish",
|
|
108
109
|
"versioner": "pnpm genversion --es6 --semi src/version.ts"
|
|
109
110
|
}
|
|
110
111
|
}
|
package/pnpm-workspace.yaml
CHANGED
package/src/@types.ts
CHANGED
package/src/constellation.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isBrowser } from "wherearewe";
|
|
2
2
|
import { créerOrbitesTest } from "./orbite.js";
|
|
3
3
|
import { dossierTempo } from "./dossiers.js";
|
|
4
|
-
import { OrbitDB } from "@orbitdb/core";
|
|
4
|
+
import type { OrbitDB } from "@orbitdb/core";
|
|
5
5
|
|
|
6
6
|
interface InterfaceConstellation {
|
|
7
7
|
fermer: () => Promise<void>;
|
package/src/h/303/251lia.ts
CHANGED
|
@@ -1,55 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { createHelia } from "helia";
|
|
2
|
+
import {
|
|
3
|
+
OptionsDéfautLibp2pNavigateur,
|
|
4
|
+
OptionsDéfautLibp2pNode,
|
|
5
|
+
type ServicesLibp2pTest,
|
|
6
|
+
} from "./libp2p/index.js";
|
|
5
7
|
import { MemoryBlockstore } from "blockstore-core";
|
|
6
8
|
import { join } from "path";
|
|
7
9
|
import { sousDossier } from "./utils.js";
|
|
8
10
|
import { IDBBlockstore } from "blockstore-idb";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
+
import { isBrowser, isElectronMain, isNode } from "wherearewe";
|
|
12
|
+
import { type HeliaWithLibp2p } from "@helia/libp2p";
|
|
11
13
|
|
|
12
14
|
export const créerHéliasTest = async ({
|
|
13
15
|
n,
|
|
14
16
|
dossier,
|
|
15
|
-
adresseRelai,
|
|
16
17
|
}: {
|
|
17
18
|
n: number;
|
|
18
19
|
dossier?: string;
|
|
19
|
-
adresseRelai?: string;
|
|
20
20
|
}): Promise<{
|
|
21
|
-
hélias:
|
|
21
|
+
hélias: HeliaWithLibp2p<ServicesLibp2pTest>[];
|
|
22
22
|
fermer: () => Promise<void>;
|
|
23
23
|
}> => {
|
|
24
|
-
|
|
24
|
+
const optionsLibp2p = isBrowser
|
|
25
|
+
? OptionsDéfautLibp2pNavigateur()
|
|
26
|
+
: OptionsDéfautLibp2pNode();
|
|
25
27
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const optionsHélia = {
|
|
46
|
-
blockstore: stockageBlocs,
|
|
47
|
-
libp2p,
|
|
48
|
-
blockBrokers: [bitswap()],
|
|
49
|
-
};
|
|
50
|
-
return await createHelia(optionsHélia);
|
|
51
|
-
}),
|
|
52
|
-
);
|
|
28
|
+
const hélias: HeliaWithLibp2p<ServicesLibp2pTest>[] = [];
|
|
29
|
+
for (const i of Array(n).keys()) {
|
|
30
|
+
const dossierBlocs = dossier
|
|
31
|
+
? join(sousDossier({ dossier, i }), "hélia", "blocks")
|
|
32
|
+
: undefined;
|
|
33
|
+
const stockageBlocs = dossierBlocs
|
|
34
|
+
? isNode || isElectronMain
|
|
35
|
+
? new (await import("blockstore-fs")).FsBlockstore(dossierBlocs)
|
|
36
|
+
: new IDBBlockstore(dossierBlocs)
|
|
37
|
+
: new MemoryBlockstore();
|
|
38
|
+
(stockageBlocs as IDBBlockstore).open?.();
|
|
39
|
+
const optionsHélia = {
|
|
40
|
+
blockstore: stockageBlocs,
|
|
41
|
+
libp2p: optionsLibp2p,
|
|
42
|
+
};
|
|
43
|
+
const hélia = await createHelia(optionsHélia).start();
|
|
44
|
+
hélias.push(hélia);
|
|
45
|
+
}
|
|
53
46
|
|
|
54
47
|
const fermer = async () => {
|
|
55
48
|
await Promise.all(
|
|
@@ -59,7 +52,6 @@ export const créerHéliasTest = async ({
|
|
|
59
52
|
await h.blockstore.unwrap()?.unwrap()?.child?.db?.close();
|
|
60
53
|
}),
|
|
61
54
|
);
|
|
62
|
-
await fermerLibsp2p();
|
|
63
55
|
};
|
|
64
56
|
|
|
65
57
|
return { hélias, fermer };
|
package/src/index.ts
CHANGED
package/src/libp2p/config.ts
CHANGED
|
@@ -24,18 +24,22 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
24
24
|
SOFTWARE.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
gossipsub,
|
|
29
|
+
type GossipSubComponents,
|
|
30
|
+
type GossipSub,
|
|
31
|
+
} from "@libp2p/gossipsub";
|
|
28
32
|
import { noise } from "@chainsafe/libp2p-noise";
|
|
29
33
|
import { yamux } from "@chainsafe/libp2p-yamux";
|
|
30
34
|
import { circuitRelayTransport } from "@libp2p/circuit-relay-v2";
|
|
31
|
-
import { Identify, identify } from "@libp2p/identify";
|
|
35
|
+
import { type Identify, identify } from "@libp2p/identify";
|
|
32
36
|
import { webRTC } from "@libp2p/webrtc";
|
|
33
37
|
import { webSockets } from "@libp2p/websockets";
|
|
34
38
|
|
|
35
|
-
import { Libp2pOptions } from "libp2p";
|
|
39
|
+
import { type Libp2pOptions } from "libp2p";
|
|
36
40
|
|
|
37
|
-
import { PrivateKey } from "@libp2p/interface";
|
|
38
|
-
import { ping, Ping } from "@libp2p/ping";
|
|
41
|
+
import { type PrivateKey } from "@libp2p/interface";
|
|
42
|
+
import { ping, type Ping } from "@libp2p/ping";
|
|
39
43
|
|
|
40
44
|
export type ServicesLibp2pTest = {
|
|
41
45
|
ping: Ping;
|
package/src/libp2p/index.ts
CHANGED
package/src/libp2p/libp2p.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Libp2p } from "@libp2p/interface";
|
|
1
|
+
import type { Libp2p } from "@libp2p/interface";
|
|
2
2
|
import { createLibp2p } from "libp2p";
|
|
3
3
|
import {
|
|
4
4
|
OptionsDéfautLibp2pNavigateur,
|
|
5
5
|
OptionsDéfautLibp2pNode,
|
|
6
|
-
ServicesLibp2pTest,
|
|
6
|
+
type ServicesLibp2pTest,
|
|
7
7
|
} from "./config.js";
|
|
8
8
|
import { isBrowser } from "wherearewe";
|
|
9
9
|
import { connecterPairs } from "./utils.js";
|
package/src/libp2p/utils.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Libp2p } from "@libp2p/interface";
|
|
1
|
+
import type { Libp2p } from "@libp2p/interface";
|
|
2
2
|
import { WebRTC } from "@multiformats/multiaddr-matcher";
|
|
3
|
-
import { multiaddr, Multiaddr } from "@multiformats/multiaddr";
|
|
3
|
+
import { multiaddr, type Multiaddr } from "@multiformats/multiaddr";
|
|
4
4
|
import { isBrowser, isElectronRenderer } from "wherearewe";
|
|
5
|
-
import { ServicesLibp2pTest } from "./config.js";
|
|
5
|
+
import type { ServicesLibp2pTest } from "./config.js";
|
|
6
6
|
|
|
7
7
|
const filtreParDéfaut = () => true;
|
|
8
8
|
|
package/src/orbite.ts
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import { OrbitDB, createOrbitDB } from "@orbitdb/core";
|
|
1
|
+
import { type OrbitDB, createOrbitDB } from "@orbitdb/core";
|
|
2
2
|
import { dossierTempo } from "./dossiers.js";
|
|
3
|
-
import { ServicesLibp2pTest } from "./libp2p/index.js";
|
|
3
|
+
import { type ServicesLibp2pTest } from "./libp2p/index.js";
|
|
4
4
|
import { créerHéliasTest } from "./hélia.js";
|
|
5
5
|
import { join } from "path";
|
|
6
6
|
import { sousDossier } from "./utils.js";
|
|
7
|
-
import { obtenirAdresseRelai } from "./relai/utils.js";
|
|
8
7
|
|
|
9
8
|
export const créerOrbitesTest = async ({
|
|
10
9
|
n,
|
|
11
10
|
dossier,
|
|
12
|
-
adresseRelai,
|
|
13
11
|
}: {
|
|
14
12
|
n: number;
|
|
15
13
|
dossier?: string;
|
|
16
|
-
adresseRelai?: string;
|
|
17
14
|
}): Promise<{
|
|
18
15
|
orbites: OrbitDB<ServicesLibp2pTest>[];
|
|
19
16
|
fermer: () => Promise<void>;
|
|
20
17
|
}> => {
|
|
21
|
-
adresseRelai = adresseRelai ?? obtenirAdresseRelai();
|
|
22
|
-
|
|
23
18
|
let effacerDossier: () => void = () => {};
|
|
24
19
|
if (!dossier) {
|
|
25
20
|
({ dossier, effacer: effacerDossier } = await dossierTempo());
|
|
@@ -29,7 +24,6 @@ export const créerOrbitesTest = async ({
|
|
|
29
24
|
const { hélias, fermer: fermerHélias } = await créerHéliasTest({
|
|
30
25
|
n,
|
|
31
26
|
dossier,
|
|
32
|
-
adresseRelai,
|
|
33
27
|
});
|
|
34
28
|
|
|
35
29
|
let i = 0;
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version =
|
|
2
|
+
export const version = '2.2.0';
|