@constl/utils-tests 1.6.15 → 1.7.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/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "1.6.15";
1
+ export declare const version = "1.7.0";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = "1.6.15";
2
+ export const version = "1.7.0";
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.6.15",
2
+ "version": "1.7.0",
3
3
  "license": "AGPL-3.0-or-later",
4
4
  "name": "@constl/utils-tests",
5
5
  "author": "Julien Jean Malard-Adam",
@@ -20,68 +20,68 @@
20
20
  "postbuild": "./dist/**/*"
21
21
  },
22
22
  "devDependencies": {
23
- "@chainsafe/libp2p-noise": "^16.0.1",
24
- "@chainsafe/libp2p-yamux": "^7.0.1",
25
- "@constl/bohr-db": "^1.2.2",
26
- "@constl/ipa": "1.5.13",
27
- "@eslint/js": "^9.20.0",
28
- "@libp2p/circuit-relay-v2": "^3.1.13",
29
- "@libp2p/crypto": "^5.0.11",
30
- "@libp2p/identify": "^3.0.19",
31
- "@libp2p/interface": "^2.5.0",
32
- "@libp2p/websockets": "^9.1.5",
33
- "@multiformats/multiaddr": "^12.3.5",
34
- "@multiformats/multiaddr-matcher": "^1.6.0",
35
- "@orbitdb/core-types": "^1.0.13",
36
- "@orbitdb/feed-db": "^1.1.1",
23
+ "@chainsafe/libp2p-noise": "^16.1.4",
24
+ "@chainsafe/libp2p-yamux": "^7.0.4",
25
+ "@constl/bohr-db": "^1.3.1",
26
+ "@constl/ipa": "1.6.24",
27
+ "@eslint/js": "^9.32.0",
28
+ "@libp2p/circuit-relay-v2": "^3.2.23",
29
+ "@libp2p/crypto": "^5.1.7",
30
+ "@libp2p/identify": "^3.0.38",
31
+ "@libp2p/interface": "^2.10.5",
32
+ "@libp2p/websockets": "^9.2.18",
33
+ "@multiformats/multiaddr": "^12.5.1",
34
+ "@multiformats/multiaddr-matcher": "^2.0.2",
35
+ "@orbitdb/core-types": "^1.2.0",
36
+ "@orbitdb/feed-db": "^1.3.0",
37
37
  "@types/crypto-js": "^4.2.2",
38
38
  "@types/file-saver": "^2.0.7",
39
39
  "@types/mocha": "^10.0.10",
40
- "@types/node": "^22.13.4",
40
+ "@types/node": "^24.1.0",
41
41
  "@types/uuid": "^10.0.0",
42
- "@typescript-eslint/eslint-plugin": "^8.24.1",
43
- "@typescript-eslint/parser": "^8.24.1",
44
- "aegir": "^45.0.9",
42
+ "@typescript-eslint/eslint-plugin": "^8.38.0",
43
+ "@typescript-eslint/parser": "^8.38.0",
44
+ "aegir": "^47.0.20",
45
45
  "ajv": "^8.17.1",
46
46
  "buffer": "^6.0.3",
47
- "core-js": "^3.40.0",
48
- "electron": "^34.2.0",
49
- "esbuild": "^0.24.2",
50
- "eslint": "^9.20.1",
47
+ "core-js": "^3.44.0",
48
+ "electron": "^37.2.4",
49
+ "esbuild": "^0.25.8",
50
+ "eslint": "^9.32.0",
51
51
  "eslint-config-airbnb-base": "^15.0.0",
52
- "eslint-config-prettier": "^10.0.1",
52
+ "eslint-config-prettier": "^10.1.8",
53
53
  "eslint-config-standard": "^17.1.0",
54
- "eslint-plugin-import": "^2.31.0",
55
- "eslint-plugin-n": "^17.15.1",
54
+ "eslint-plugin-import": "^2.32.0",
55
+ "eslint-plugin-n": "^17.21.3",
56
56
  "eslint-plugin-promise": "^7.2.1",
57
- "execa": "^9.5.2",
58
- "mocha": "^11.1.0",
59
- "playwright": "^1.50.1",
60
- "prettier": "^3.5.1",
57
+ "execa": "^9.6.0",
58
+ "mocha": "^11.7.1",
59
+ "playwright": "^1.54.1",
60
+ "prettier": "^3.6.2",
61
61
  "progress-events": "^1.0.1",
62
62
  "source-map-support": "^0.5.21",
63
63
  "ts-patch": "^3.3.0",
64
64
  "tsconfig-paths": "^4.2.0",
65
65
  "tscpaths": "^0.0.9",
66
- "typescript": "5.7.3",
67
- "typescript-eslint": "^8.24.1",
68
- "typescript-transform-paths": "^3.5.3"
66
+ "typescript": "5.8.3",
67
+ "typescript-eslint": "^8.38.0",
68
+ "typescript-transform-paths": "^3.5.5"
69
69
  },
70
70
  "dependencies": {
71
- "@chainsafe/libp2p-gossipsub": "14.1.0",
72
- "@helia/block-brokers": "^4.0.4",
73
- "@libp2p/peer-id": "^5.0.12",
74
- "@libp2p/webrtc": "^5.1.1",
75
- "@orbitdb/core": "^2.4.3",
76
- "blockstore-core": "^5.0.2",
77
- "blockstore-level": "^2.0.1",
71
+ "@chainsafe/libp2p-gossipsub": "14.1.1",
72
+ "@helia/block-brokers": "^4.2.3",
73
+ "@libp2p/peer-id": "^5.1.8",
74
+ "@libp2p/webrtc": "^5.2.23",
75
+ "@orbitdb/core": "^3.0.2",
76
+ "blockstore-core": "^5.0.4",
77
+ "blockstore-level": "^2.0.3",
78
78
  "browserify-fs": "^1.0.0",
79
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
- "helia": "5.2.1",
84
- "libp2p": "^2.6.3",
83
+ "helia": "5.5.0",
84
+ "libp2p": "^2.9.0",
85
85
  "os-browserify": "^0.3.0",
86
86
  "process": "^0.11.10",
87
87
  "read-package-up": "^11.0.0",
@@ -89,7 +89,7 @@
89
89
  "stream-browserify": "^3.0.0",
90
90
  "uint8arrays": "^5.1.0",
91
91
  "url-polyfill": "^1.1.13",
92
- "uuid": "^11.0.5",
92
+ "uuid": "^11.1.0",
93
93
  "wherearewe": "^2.0.1"
94
94
  },
95
95
  "scripts": {
package/renovate.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": ["config:base"],
3
+ "extends": ["config:recommended"],
4
4
  "packageRules": [
5
5
  {
6
6
  "matchDepTypes": ["devDependencies"],
@@ -12,8 +12,8 @@
12
12
  "automerge": true
13
13
  },
14
14
  {
15
- "matchPackagePatterns": ["^actions/"],
16
- "automerge": true
15
+ "automerge": true,
16
+ "matchPackageNames": ["/^actions//"]
17
17
  },
18
18
  {
19
19
  "description": "Regrouper les librairies @constl.",
@@ -27,7 +27,13 @@
27
27
  "groupName": "Libp2p et Helia",
28
28
  "groupSlug": "libp2p-helia-node",
29
29
  "matchDatasources": ["npm"],
30
- "matchPackageNames": ["@libp2p/**", "@chainsafe/**", "libp2p", "helia"]
30
+ "matchPackageNames": [
31
+ "@libp2p/**",
32
+ "@chainsafe/**",
33
+ "@helia/**",
34
+ "libp2p",
35
+ "helia"
36
+ ]
31
37
  }
32
38
  ]
33
39
  }
@@ -1,6 +1,7 @@
1
1
  import type { réseau, client, Constellation } from "@constl/ipa";
2
2
  import type { OrbitDB } from "@orbitdb/core";
3
3
  import { isBrowser } from "wherearewe";
4
+ import { créerConstellation as _créerConstellation } from "@constl/ipa";
4
5
 
5
6
  import { créerOrbiteTest } from "@/orbite.js";
6
7
  import { AttendreRésultat } from "@/attente.js";
@@ -11,7 +12,7 @@ export const créerConstellationsTest = async <
11
12
  U = client.optsConstellation,
12
13
  >({
13
14
  n = 1,
14
- créerConstellation,
15
+ créerConstellation = _créerConstellation as unknown as (opts: U) => T,
15
16
  }: {
16
17
  n: number;
17
18
  créerConstellation: (opts: U) => T;
package/src/libp2p.ts CHANGED
@@ -30,9 +30,13 @@ 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 { type GossipsubEvents, gossipsub } from "@chainsafe/libp2p-gossipsub";
33
+ import {
34
+ gossipsub,
35
+ GossipSub,
36
+ GossipSubComponents,
37
+ } from "@chainsafe/libp2p-gossipsub";
34
38
  import { circuitRelayTransport } from "@libp2p/circuit-relay-v2";
35
- import type { PrivateKey, PubSub } from "@libp2p/interface";
39
+ import type { PrivateKey } from "@libp2p/interface";
36
40
  import type { Libp2pOptions } from "libp2p";
37
41
 
38
42
  /**
@@ -56,7 +60,9 @@ export const DefaultLibp2pOptions: Libp2pOptions<ServicesLibp2pConstlTest> = {
56
60
  },
57
61
  services: {
58
62
  identify: identify(),
59
- pubsub: gossipsub({ allowPublishToZeroTopicPeers: true }),
63
+ pubsub: gossipsub({ allowPublishToZeroTopicPeers: true }) as (
64
+ components: GossipSubComponents,
65
+ ) => GossipSub, // Erreur de type dans @chainsafe/pubsub
60
66
  obtClefPrivée: (components: ComposantesServiceClefPrivée) =>
61
67
  new ServiceClefPrivée(components),
62
68
  },
@@ -84,7 +90,9 @@ export const DefaultLibp2pBrowserOptions: Libp2pOptions<ServicesLibp2pConstlTest
84
90
  },
85
91
  services: {
86
92
  identify: identify(),
87
- pubsub: gossipsub({ allowPublishToZeroTopicPeers: true }),
93
+ pubsub: gossipsub({ allowPublishToZeroTopicPeers: true }) as (
94
+ components: GossipSubComponents,
95
+ ) => GossipSub, // Erreur de type dans @chainsafe/pubsub,
88
96
  obtClefPrivée: (components: ComposantesServiceClefPrivée) =>
89
97
  new ServiceClefPrivée(components),
90
98
  },
@@ -96,7 +104,7 @@ interface ComposantesServiceClefPrivée {
96
104
 
97
105
  export type ServicesLibp2pConstlTest = {
98
106
  identify: Identify;
99
- pubsub: PubSub<GossipsubEvents>;
107
+ pubsub: GossipSub;
100
108
  obtClefPrivée: ServiceClefPrivée;
101
109
  };
102
110
  export class ServiceClefPrivée {
package/src/orbite.ts CHANGED
@@ -25,14 +25,19 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
25
  SOFTWARE.
26
26
  */
27
27
 
28
- import type { HeliaLibp2p } from "helia";
28
+ import type { Helia } from "helia";
29
29
  import type {
30
30
  Identity,
31
31
  OrbitDB,
32
32
  Database,
33
33
  IdentitiesType,
34
34
  } from "@orbitdb/core";
35
- import type { TypedKeyValue, TypedFeed, TypedSet } from "@constl/bohr-db";
35
+ import {
36
+ type TypedKeyValue,
37
+ type TypedFeed,
38
+ type TypedSet,
39
+ type TypedOrderedKeyValue,
40
+ } from "@constl/bohr-db";
36
41
  import { once } from "events";
37
42
 
38
43
  import { dossierTempo } from "@/dossiers.js";
@@ -100,7 +105,7 @@ export const créerOrbiteTest = async ({
100
105
  orbites: OrbitDB<ServicesLibp2pConstlTest>[];
101
106
  fOublier: () => Promise<void>;
102
107
  }> => {
103
- const sfips: HeliaLibp2p<Libp2p<ServicesLibp2pConstlTest>>[] = [];
108
+ const sfips: Helia<Libp2p<ServicesLibp2pConstlTest>>[] = [];
104
109
  const orbites: OrbitDB<ServicesLibp2pConstlTest>[] = [];
105
110
 
106
111
  const {
@@ -177,8 +182,9 @@ const attendreInvité = (
177
182
  export const peutÉcrire = async <T extends ServiceMap = ServiceMap>(
178
183
  bd:
179
184
  | TypedKeyValue<{ [clef: string]: number }>
180
- | TypedFeed<string>
181
- | TypedSet<string>,
185
+ | TypedOrderedKeyValue<{ [clef: string]: number }>
186
+ | TypedSet<string>
187
+ | TypedFeed<string>,
182
188
  attendre?: OrbitDB<T>,
183
189
  ): Promise<boolean> => {
184
190
  if (attendre) {
@@ -189,7 +195,7 @@ export const peutÉcrire = async <T extends ServiceMap = ServiceMap>(
189
195
  }
190
196
 
191
197
  try {
192
- if (bd.type === "keyvalue") {
198
+ if (bd.type === "keyvalue" || bd.type === "ordered-keyvalue") {
193
199
  const bdKV = bd as TypedKeyValue<{ [clef: string]: number }>;
194
200
 
195
201
  // Important d'avoir une clef unique pour éviter l'interférence entre les tests
@@ -218,10 +224,9 @@ export const peutÉcrire = async <T extends ServiceMap = ServiceMap>(
218
224
  await bd.add(VAL);
219
225
  const éléments = await bd.all();
220
226
 
221
- const autorisé = éléments.length === 1 && éléments[0].value === VAL;
222
- if (éléments.length === 1) {
223
- await bd.del(éléments[0].hash);
224
- }
227
+ const autorisé = éléments.size === 1 && éléments.has(VAL);
228
+ await bd.del(VAL);
229
+
225
230
  return autorisé;
226
231
  } else {
227
232
  // @ts-expect-error bd.type n'a plus d'options
@@ -64,7 +64,6 @@ const relai = await createLibp2p({
64
64
  relay: circuitRelayServer({
65
65
  reservations: {
66
66
  maxReservations: 5000,
67
- reservationTtl: 1000,
68
67
  defaultDataLimit: BigInt(1024 * 1024 * 1024),
69
68
  },
70
69
  }),
package/src/sfip.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Multiaddr } from "@multiformats/multiaddr";
2
2
  import type { sfip } from "@constl/ipa";
3
3
 
4
- import { DefaultLibp2pServices, createHelia, type HeliaLibp2p } from "helia";
4
+ import { DefaultLibp2pServices, createHelia, type Helia } from "helia";
5
5
  import { bitswap } from "@helia/block-brokers";
6
6
  import { createLibp2p, Libp2p } from "libp2p";
7
7
  import { MemoryBlockstore } from "blockstore-core";
@@ -18,7 +18,7 @@ export const créerHéliaTest = async ({
18
18
  dossier,
19
19
  }: {
20
20
  dossier?: string;
21
- } = {}): Promise<HeliaLibp2p<Libp2p<sfip.ServicesLibp2p>>> => {
21
+ } = {}): Promise<Helia<Libp2p<sfip.ServicesLibp2p>>> => {
22
22
  const options =
23
23
  isBrowser || isElectronRenderer
24
24
  ? DefaultLibp2pBrowserOptions
@@ -46,8 +46,8 @@ const filtreParDéfaut = () => true;
46
46
  export const connecterPairs = async <
47
47
  T extends Libp2p = Libp2p<DefaultLibp2pServices>,
48
48
  >(
49
- sfip1: HeliaLibp2p<T>,
50
- sfip2: HeliaLibp2p<T>,
49
+ sfip1: Helia<T>,
50
+ sfip2: Helia<T>,
51
51
  options = {
52
52
  filtre: filtreParDéfaut,
53
53
  },
@@ -83,9 +83,9 @@ export const connecterPairs = async <
83
83
  };
84
84
 
85
85
  export const toutesConnectées = async (
86
- sfips: HeliaLibp2p<Libp2p<sfip.ServicesLibp2p>>[],
86
+ sfips: Helia<Libp2p<sfip.ServicesLibp2p>>[],
87
87
  ) => {
88
- const connectés: HeliaLibp2p<Libp2p<sfip.ServicesLibp2p>>[] = [];
88
+ const connectés: Helia<Libp2p<sfip.ServicesLibp2p>>[] = [];
89
89
  for (const sfip of sfips) {
90
90
  for (const autre of connectés) {
91
91
  await connecterPairs(sfip, autre);
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = "1.6.15";
2
+ export const version = "1.7.0";