@constl/utils-tests 1.6.9 → 1.6.10
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/constellation.d.ts +3 -1
- package/dist/constellation.js.map +1 -1
- package/dist/libp2p.d.ts +12 -34
- package/dist/libp2p.js +1 -1
- package/dist/libp2p.js.map +1 -1
- package/dist/orbite.d.ts +6 -3
- package/dist/orbite.js +1 -1
- package/dist/orbite.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +37 -37
- package/src/constellation.ts +3 -1
- package/src/libp2p.ts +35 -30
- package/src/orbite.ts +18 -8
- package/src/version.ts +1 -1
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.6.
|
|
1
|
+
export declare const version = "1.6.10";
|
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.6.
|
|
2
|
+
"version": "1.6.10",
|
|
3
3
|
"license": "AGPL-3.0-or-later",
|
|
4
4
|
"name": "@constl/utils-tests",
|
|
5
5
|
"author": "Julien Jean Malard-Adam",
|
|
@@ -21,75 +21,75 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@chainsafe/libp2p-gossipsub": "14.1.0",
|
|
24
|
-
"@chainsafe/libp2p-noise": "^16.0.
|
|
24
|
+
"@chainsafe/libp2p-noise": "^16.0.1",
|
|
25
25
|
"@chainsafe/libp2p-yamux": "^7.0.1",
|
|
26
|
-
"@constl/bohr-db": "^1.2.
|
|
27
|
-
"@constl/ipa": "1.
|
|
28
|
-
"@eslint/js": "^9.
|
|
29
|
-
"@libp2p/circuit-relay-v2": "^3.1.
|
|
30
|
-
"@libp2p/crypto": "^5.0.
|
|
31
|
-
"@libp2p/identify": "^3.0.
|
|
32
|
-
"@libp2p/interface": "^2.
|
|
33
|
-
"@libp2p/websockets": "^9.
|
|
34
|
-
"@multiformats/multiaddr": "^12.3.
|
|
26
|
+
"@constl/bohr-db": "^1.2.2",
|
|
27
|
+
"@constl/ipa": "1.5.7",
|
|
28
|
+
"@eslint/js": "^9.20.0",
|
|
29
|
+
"@libp2p/circuit-relay-v2": "^3.1.11",
|
|
30
|
+
"@libp2p/crypto": "^5.0.11",
|
|
31
|
+
"@libp2p/identify": "^3.0.18",
|
|
32
|
+
"@libp2p/interface": "^2.5.0",
|
|
33
|
+
"@libp2p/websockets": "^9.1.5",
|
|
34
|
+
"@multiformats/multiaddr": "^12.3.5",
|
|
35
35
|
"@multiformats/multiaddr-matcher": "^1.6.0",
|
|
36
|
-
"@orbitdb/core-types": "^1.0.
|
|
36
|
+
"@orbitdb/core-types": "^1.0.11",
|
|
37
37
|
"@orbitdb/feed-db": "^1.1.1",
|
|
38
38
|
"@types/crypto-js": "^4.2.2",
|
|
39
39
|
"@types/file-saver": "^2.0.7",
|
|
40
40
|
"@types/mocha": "^10.0.10",
|
|
41
|
-
"@types/node": "^22.
|
|
41
|
+
"@types/node": "^22.13.1",
|
|
42
42
|
"@types/uuid": "^10.0.0",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
44
|
-
"@typescript-eslint/parser": "^8.
|
|
45
|
-
"aegir": "^45.0.
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
|
44
|
+
"@typescript-eslint/parser": "^8.24.0",
|
|
45
|
+
"aegir": "^45.0.9",
|
|
46
46
|
"ajv": "^8.17.1",
|
|
47
47
|
"buffer": "^6.0.3",
|
|
48
|
-
"core-js": "^3.
|
|
49
|
-
"electron": "^34.
|
|
50
|
-
"esbuild": "^0.24.
|
|
51
|
-
"eslint": "^9.
|
|
48
|
+
"core-js": "^3.40.0",
|
|
49
|
+
"electron": "^34.1.1",
|
|
50
|
+
"esbuild": "^0.24.2",
|
|
51
|
+
"eslint": "^9.20.0",
|
|
52
52
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
53
|
-
"eslint-config-prettier": "^10.0.
|
|
53
|
+
"eslint-config-prettier": "^10.0.1",
|
|
54
54
|
"eslint-config-standard": "^17.1.0",
|
|
55
55
|
"eslint-plugin-import": "^2.31.0",
|
|
56
|
-
"eslint-plugin-n": "^17.
|
|
57
|
-
"eslint-plugin-promise": "^7.2.
|
|
58
|
-
"execa": "^9.5.
|
|
59
|
-
"mocha": "^11.
|
|
60
|
-
"playwright": "^1.
|
|
61
|
-
"prettier": "^3.
|
|
56
|
+
"eslint-plugin-n": "^17.15.1",
|
|
57
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
58
|
+
"execa": "^9.5.2",
|
|
59
|
+
"mocha": "^11.1.0",
|
|
60
|
+
"playwright": "^1.50.1",
|
|
61
|
+
"prettier": "^3.5.0",
|
|
62
62
|
"progress-events": "^1.0.1",
|
|
63
63
|
"source-map-support": "^0.5.21",
|
|
64
|
-
"ts-patch": "^3.
|
|
64
|
+
"ts-patch": "^3.3.0",
|
|
65
65
|
"tsconfig-paths": "^4.2.0",
|
|
66
66
|
"tscpaths": "^0.0.9",
|
|
67
67
|
"typescript": "5.7.3",
|
|
68
|
-
"typescript-eslint": "^8.
|
|
69
|
-
"typescript-transform-paths": "^3.5.
|
|
68
|
+
"typescript-eslint": "^8.24.0",
|
|
69
|
+
"typescript-transform-paths": "^3.5.3"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@helia/block-brokers": "^4.0.
|
|
73
|
-
"@libp2p/peer-id": "^5.0.
|
|
74
|
-
"@libp2p/webrtc": "^5.0.
|
|
72
|
+
"@helia/block-brokers": "^4.0.3",
|
|
73
|
+
"@libp2p/peer-id": "^5.0.12",
|
|
74
|
+
"@libp2p/webrtc": "^5.0.27",
|
|
75
75
|
"@orbitdb/core": "^2.4.3",
|
|
76
76
|
"blockstore-core": "^5.0.2",
|
|
77
77
|
"blockstore-level": "^2.0.1",
|
|
78
78
|
"browserify-fs": "^1.0.0",
|
|
79
|
-
"chokidar": "^4.0.
|
|
79
|
+
"chokidar": "^4.0.3",
|
|
80
80
|
"crypto-browserify": "^3.12.1",
|
|
81
81
|
"events": "^3.3.0",
|
|
82
82
|
"genversion": "^3.2.0",
|
|
83
83
|
"helia": "5.2.0",
|
|
84
|
-
"libp2p": "^2.
|
|
84
|
+
"libp2p": "^2.6.1",
|
|
85
85
|
"os-browserify": "^0.3.0",
|
|
86
86
|
"process": "^0.11.10",
|
|
87
87
|
"read-package-up": "^11.0.0",
|
|
88
88
|
"rimraf": "^6.0.1",
|
|
89
89
|
"stream-browserify": "^3.0.0",
|
|
90
90
|
"uint8arrays": "^5.1.0",
|
|
91
|
-
"url-polyfill": "^1.1.
|
|
92
|
-
"uuid": "^11.0.
|
|
91
|
+
"url-polyfill": "^1.1.13",
|
|
92
|
+
"uuid": "^11.0.5",
|
|
93
93
|
"wherearewe": "^2.0.1"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
package/src/constellation.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { isBrowser } from "wherearewe";
|
|
|
4
4
|
|
|
5
5
|
import { créerOrbiteTest } from "@/orbite.js";
|
|
6
6
|
import { AttendreRésultat } from "@/attente.js";
|
|
7
|
+
import { Libp2p } from "@libp2p/interface";
|
|
8
|
+
import { ServicesLibp2pConstlTest } from "./libp2p";
|
|
7
9
|
|
|
8
10
|
export const créerConstellationsTest = async <
|
|
9
11
|
T = Constellation,
|
|
@@ -16,7 +18,7 @@ export const créerConstellationsTest = async <
|
|
|
16
18
|
créerConstellation: (opts: U) => T;
|
|
17
19
|
}): Promise<{
|
|
18
20
|
clients: ReturnType<typeof créerConstellation>[];
|
|
19
|
-
orbites: OrbitDB[];
|
|
21
|
+
orbites: OrbitDB<Libp2p<ServicesLibp2pConstlTest>>[];
|
|
20
22
|
fOublier: () => Promise<void>;
|
|
21
23
|
}> => {
|
|
22
24
|
const clients: ReturnType<typeof créerConstellation>[] = [];
|
package/src/libp2p.ts
CHANGED
|
@@ -24,22 +24,21 @@ 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 { identify } from "@libp2p/identify";
|
|
27
|
+
import { Identify, identify } from "@libp2p/identify";
|
|
28
28
|
import { webSockets } from "@libp2p/websockets";
|
|
29
29
|
import { webRTC } from "@libp2p/webrtc";
|
|
30
30
|
import { all } from "@libp2p/websockets/filters";
|
|
31
31
|
import { noise } from "@chainsafe/libp2p-noise";
|
|
32
32
|
import { yamux } from "@chainsafe/libp2p-yamux";
|
|
33
|
-
import { gossipsub } from "@chainsafe/libp2p-gossipsub";
|
|
33
|
+
import { type GossipsubEvents, gossipsub } from "@chainsafe/libp2p-gossipsub";
|
|
34
34
|
import { circuitRelayTransport } from "@libp2p/circuit-relay-v2";
|
|
35
|
-
import type { PrivateKey } from "@libp2p/interface";
|
|
36
|
-
|
|
37
|
-
import type { ProgressEvent } from "progress-events";
|
|
35
|
+
import type { PrivateKey, PubSub } from "@libp2p/interface";
|
|
36
|
+
import type { Libp2pOptions } from "libp2p";
|
|
38
37
|
|
|
39
38
|
/**
|
|
40
39
|
* A basic Libp2p configuration for Node.js nodes.
|
|
41
40
|
*/
|
|
42
|
-
export const DefaultLibp2pOptions = {
|
|
41
|
+
export const DefaultLibp2pOptions: Libp2pOptions<ServicesLibp2pConstlTest> = {
|
|
43
42
|
addresses: {
|
|
44
43
|
listen: ["/ip4/0.0.0.0/tcp/0/ws", "/p2p-circuit"],
|
|
45
44
|
},
|
|
@@ -66,35 +65,41 @@ export const DefaultLibp2pOptions = {
|
|
|
66
65
|
/**
|
|
67
66
|
* A basic Libp2p configuration for browser nodes.
|
|
68
67
|
*/
|
|
69
|
-
export const DefaultLibp2pBrowserOptions =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
68
|
+
export const DefaultLibp2pBrowserOptions: Libp2pOptions<ServicesLibp2pConstlTest> =
|
|
69
|
+
{
|
|
70
|
+
addresses: {
|
|
71
|
+
listen: ["/webrtc", "/p2p-circuit"],
|
|
72
|
+
},
|
|
73
|
+
transports: [
|
|
74
|
+
webSockets({
|
|
75
|
+
filter: all,
|
|
76
|
+
}),
|
|
77
|
+
webRTC(),
|
|
78
|
+
circuitRelayTransport(),
|
|
79
|
+
],
|
|
80
|
+
connectionEncrypters: [noise()],
|
|
81
|
+
streamMuxers: [yamux()],
|
|
82
|
+
connectionGater: {
|
|
83
|
+
denyDialMultiaddr: () => false,
|
|
84
|
+
},
|
|
85
|
+
services: {
|
|
86
|
+
identify: identify(),
|
|
87
|
+
pubsub: gossipsub({ allowPublishToZeroTopicPeers: true }),
|
|
88
|
+
obtClefPrivée: (components: ComposantesServiceClefPrivée) =>
|
|
89
|
+
new ServiceClefPrivée(components),
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
92
|
|
|
93
93
|
interface ComposantesServiceClefPrivée {
|
|
94
94
|
privateKey: PrivateKey;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
export type ServicesLibp2pConstlTest = {
|
|
98
|
+
identify: Identify;
|
|
99
|
+
pubsub: PubSub<GossipsubEvents>;
|
|
100
|
+
obtClefPrivée: ServiceClefPrivée;
|
|
101
|
+
};
|
|
102
|
+
export class ServiceClefPrivée {
|
|
98
103
|
private privateKey: PrivateKey;
|
|
99
104
|
|
|
100
105
|
constructor(components: ComposantesServiceClefPrivée) {
|
package/src/orbite.ts
CHANGED
|
@@ -40,11 +40,16 @@ import { connecterPairs } from "@/sfip.js";
|
|
|
40
40
|
import { isNode, isElectronMain } from "wherearewe";
|
|
41
41
|
|
|
42
42
|
import { createHelia } from "helia";
|
|
43
|
-
import { createLibp2p } from "libp2p";
|
|
43
|
+
import { Libp2p, createLibp2p } from "libp2p";
|
|
44
44
|
import { createOrbitDB } from "@orbitdb/core";
|
|
45
45
|
import { LevelBlockstore } from "blockstore-level";
|
|
46
46
|
import { bitswap } from "@helia/block-brokers";
|
|
47
|
-
import {
|
|
47
|
+
import {
|
|
48
|
+
DefaultLibp2pOptions,
|
|
49
|
+
DefaultLibp2pBrowserOptions,
|
|
50
|
+
type ServicesLibp2pConstlTest,
|
|
51
|
+
} from "./libp2p.js";
|
|
52
|
+
import type { ServiceMap } from "@libp2p/interface";
|
|
48
53
|
|
|
49
54
|
const isBrowser = () => typeof window !== "undefined";
|
|
50
55
|
|
|
@@ -80,7 +85,9 @@ const startOrbitDB = async ({
|
|
|
80
85
|
return orbitdb;
|
|
81
86
|
};
|
|
82
87
|
|
|
83
|
-
const stopOrbitDB = async (
|
|
88
|
+
const stopOrbitDB = async (
|
|
89
|
+
orbitdb: OrbitDB<Libp2p<ServicesLibp2pConstlTest>>,
|
|
90
|
+
) => {
|
|
84
91
|
await orbitdb.stop();
|
|
85
92
|
await orbitdb.ipfs.stop();
|
|
86
93
|
// @ts-expect-error Je ne sais pas pourquoi
|
|
@@ -91,9 +98,12 @@ export const créerOrbiteTest = async ({
|
|
|
91
98
|
n = 1,
|
|
92
99
|
}: {
|
|
93
100
|
n: number;
|
|
94
|
-
}): Promise<{
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
}): Promise<{
|
|
102
|
+
orbites: OrbitDB<Libp2p<ServicesLibp2pConstlTest>>[];
|
|
103
|
+
fOublier: () => Promise<void>;
|
|
104
|
+
}> => {
|
|
105
|
+
const sfips: HeliaLibp2p<Libp2p<ServicesLibp2pConstlTest>>[] = [];
|
|
106
|
+
const orbites: OrbitDB<Libp2p<ServicesLibp2pConstlTest>>[] = [];
|
|
97
107
|
|
|
98
108
|
const {
|
|
99
109
|
dossier: racineDossierOrbite,
|
|
@@ -166,12 +176,12 @@ const attendreInvité = (
|
|
|
166
176
|
testAutorisé();
|
|
167
177
|
});
|
|
168
178
|
|
|
169
|
-
export const peutÉcrire = async (
|
|
179
|
+
export const peutÉcrire = async <T extends ServiceMap = ServiceMap>(
|
|
170
180
|
bd:
|
|
171
181
|
| TypedKeyValue<{ [clef: string]: number }>
|
|
172
182
|
| TypedFeed<string>
|
|
173
183
|
| TypedSet<string>,
|
|
174
|
-
attendre?: OrbitDB
|
|
184
|
+
attendre?: OrbitDB<Libp2p<T>>,
|
|
175
185
|
): Promise<boolean> => {
|
|
176
186
|
if (attendre) {
|
|
177
187
|
await attendreInvité(
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = "1.6.
|
|
2
|
+
export const version = "1.6.10";
|