Skip to content

Commit bdee4f4

Browse files
fix: fmt
1 parent 521eb82 commit bdee4f4

File tree

409 files changed

+13728
-12498
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

409 files changed

+13728
-12498
lines changed

.aegir.js

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
21
// get monorepo root location using esm and .git folder
3-
import path from 'path'
4-
import findUp from 'find-up'
5-
const root = path.dirname(findUp.sync('.git', { type: 'directory' }))
2+
import findUp from "find-up";
3+
import path from "path";
4+
5+
const root = path.dirname(findUp.sync(".git", { type: "directory" }));
66

77
export default {
8-
// global options
9-
debug: false,
10-
test: {
11-
concurrency: 2,
12-
files: [],
13-
before: () => {
14-
return { env: { TS_NODE_PROJECT: path.join(root, 'tsconfig.test.json') } }
15-
}
16-
}
17-
}
8+
// global options
9+
debug: false,
10+
test: {
11+
/* concurrency: 2, */
12+
files: [],
13+
before: () => {
14+
return {
15+
env: { TS_NODE_PROJECT: path.join(root, "tsconfig.test.json") },
16+
};
17+
},
18+
},
19+
};

.mocharc.json

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
2-
"require": [
3-
"ts-node/register",
4-
"chai-extend/chai-global.js"
5-
],
6-
"node-option": [
7-
"experimental-specifier-resolution=node",
8-
"loader=ts-node/esm",
9-
"no-warnings"
10-
],
11-
"extension": [
12-
"ts"
13-
],
14-
"parallel": true,
15-
"spec": [
16-
"**/test/**/*.spec.ts"
17-
],
18-
"ignore": [
19-
"**/node_modules/**",
20-
"**/dist/**"
21-
],
22-
"timeout": "55000"
2+
"require": [
3+
"ts-node/register",
4+
"chai-extend/chai-global.js"
5+
],
6+
"node-option": [
7+
"experimental-specifier-resolution=node",
8+
"loader=ts-node/esm",
9+
"no-warnings"
10+
],
11+
"extension": [
12+
"ts"
13+
],
14+
"parallel": false,
15+
"spec": [
16+
"**/test/**/*.spec.ts"
17+
],
18+
"ignore": [
19+
"**/node_modules/**",
20+
"**/dist/**"
21+
],
22+
"timeout": "40000"
2323
}

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/public/peerbit/**

.prettierrc

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"useTabs": true,
3+
"tabWidth": 2,
4+
"plugins": [
5+
"@trivago/prettier-plugin-sort-imports"
6+
],
7+
"importOrder": [
8+
"<THIRD_PARTY_MODULES>",
9+
"^[./]"
10+
],
11+
"importOrderParserPlugins": [
12+
"typescript",
13+
"tsx",
14+
"jsx",
15+
"decorators"
16+
],
17+
"importOrderSortSpecifiers": true
18+
}

.release-please-manifest.json

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
{
2-
"packages/transport/blocks": "2.0.32",
3-
"packages/transport/blocks-interface": "1.2.19",
4-
"packages/utils/cache": "2.0.6",
5-
"packages/programs/clock-service": "2.0.40",
6-
"packages/utils/crypto": "2.2.0",
7-
"packages/programs/data/document/document": "6.0.7",
8-
"packages/programs/acl/identity-access-controller": "3.0.40",
9-
"packages/transport/libp2p-test-utils": "2.1.3",
10-
"packages/log": "3.0.34",
11-
"packages/utils/logger": "1.0.2",
12-
"packages/programs/program": "4.0.7",
13-
"packages/clients/peerbit-proxy/proxy": "3.0.7",
14-
"packages/transport/pubsub": "3.0.5",
15-
"packages/transport/pubsub-interface": "3.0.3",
16-
"packages/programs/rpc": "4.0.7",
17-
"packages/clients/peerbit-server/node": "5.0.33",
18-
"packages/programs/data/shared-log": "8.0.7",
19-
"packages/transport/stream": "4.0.5",
20-
"packages/transport/stream-interface": "5.0.2",
21-
"packages/programs/data/string": "4.1.26",
22-
"packages/clients/test-utils": "2.0.33",
23-
"packages/utils/time": "2.0.6",
24-
"packages/programs/acl/trusted-network": "3.0.40",
25-
"packages/clients/peerbit": "4.0.7",
26-
"packages/clients/peerbit-proxy/window": "3.0.33",
27-
"packages/utils/any-store/any-store": "2.0.2",
28-
"packages/utils/keychain": "1.0.17"
29-
}
2+
"packages/transport/blocks": "2.0.32",
3+
"packages/transport/blocks-interface": "1.2.19",
4+
"packages/utils/cache": "2.0.6",
5+
"packages/programs/clock-service": "2.0.40",
6+
"packages/utils/crypto": "2.2.0",
7+
"packages/programs/data/document/document": "6.0.7",
8+
"packages/programs/acl/identity-access-controller": "3.0.40",
9+
"packages/transport/libp2p-test-utils": "2.1.3",
10+
"packages/log": "3.0.34",
11+
"packages/utils/logger": "1.0.2",
12+
"packages/programs/program": "4.0.7",
13+
"packages/clients/peerbit-proxy/proxy": "3.0.7",
14+
"packages/transport/pubsub": "3.0.5",
15+
"packages/transport/pubsub-interface": "3.0.3",
16+
"packages/programs/rpc": "4.0.7",
17+
"packages/clients/peerbit-server/node": "5.0.33",
18+
"packages/programs/data/shared-log": "8.0.7",
19+
"packages/transport/stream": "4.0.5",
20+
"packages/transport/stream-interface": "5.0.2",
21+
"packages/programs/data/string": "4.1.26",
22+
"packages/clients/test-utils": "2.0.33",
23+
"packages/utils/time": "2.0.6",
24+
"packages/programs/acl/trusted-network": "3.0.40",
25+
"packages/clients/peerbit": "4.0.7",
26+
"packages/clients/peerbit-proxy/window": "3.0.33",
27+
"packages/utils/any-store/any-store": "2.0.2",
28+
"packages/utils/keychain": "1.0.17"
29+
}

.release-please.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
22
"bootstrap-sha": "148d23a1bc0e9fad48ea6589cd861d47bfd2b75c",
33
"last-release-sha": "c3343e8e19a44343036ed20ed6f15bd13beddf6f",
4-
"plugins": [
5-
"node-workspace"
6-
],
4+
"plugins": ["node-workspace"],
75
"changelog-sections": [
86
{
97
"type": "feat",
@@ -45,6 +43,7 @@
4543
"packages/clients/peerbit-proxy/proxy": {},
4644
"packages/clients/peerbit-server/node": {},
4745
"packages/clients/test-utils": {},
46+
"packages/clients/vite": {},
4847
"packages/programs/rpc": {},
4948
"packages/programs/acl/identity-access-controller": {},
5049
"packages/programs/acl/trusted-network": {},
@@ -67,4 +66,4 @@
6766
"packages/utils/indexer/tests": {},
6867
"packages/utils/indexer/interface": {}
6968
}
70-
}
69+
}

chai-global.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { use } from "chai";
2-
import chaiAsPromised from 'chai-as-promised';
2+
import chaiAsPromised from "chai-as-promised";
3+
34
use(chaiAsPromised);
45
/*
56
process.env.TS_NODE_PROJECT = 'tsconfig.test.json';
67
console.log(process.env.TS_NODE_PROJECT) */
7-

docs/.mocharc.json

+11-21
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
{
2-
"require": [
3-
"ts-node/register",
4-
"chai-extend/chai-global.js"
5-
],
6-
"node-option": [
7-
"experimental-specifier-resolution=node",
8-
"loader=ts-node/esm",
9-
"no-warnings"
10-
],
11-
"extension": [
12-
"ts"
13-
],
14-
"spec": [
15-
"**/*.spec.ts"
16-
],
17-
"ignore": [
18-
"**/node_modules/**",
19-
"dist/**"
20-
],
21-
"timeout": "20000"
22-
}
2+
"require": ["ts-node/register", "chai-extend/chai-global.js"],
3+
"node-option": [
4+
"experimental-specifier-resolution=node",
5+
"loader=ts-node/esm",
6+
"no-warnings"
7+
],
8+
"extension": ["ts"],
9+
"spec": ["**/*.spec.ts"],
10+
"ignore": ["**/node_modules/**", "dist/**"],
11+
"timeout": "20000"
12+
}

docs/examples/document-store.ts

+12-9
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
* website to be able to render parts of the code.
1010
* If you are to copy code from this example, you can safely remove these
1111
*/
12-
1312
/// [imports]
1413
import { field, variant } from "@dao-xyz/borsh";
14+
import { Documents, SearchRequest } from "@peerbit/document";
1515
import { Program } from "@peerbit/program";
16+
import assert from "node:assert";
1617
import { Peerbit } from "peerbit";
17-
import { Documents, SearchRequest } from "@peerbit/document";
1818
import { v4 as uuid } from "uuid";
19-
import assert from 'node:assert'
19+
2020
/// [imports]
2121

2222
/// [client]
@@ -57,7 +57,7 @@ class PostsDB extends Program {
5757
// We need to setup the store in the setup hook
5858
// we can also modify properties of our store here, for example set access control
5959
await this.posts.open({
60-
type: Post
60+
type: Post,
6161
// You can add more properties here, like
6262
/* canPerform: (entry) => true */
6363
});
@@ -84,19 +84,22 @@ await store.posts.log.waitForReplicator(peer2.identity.publicKey);
8484

8585
const responses: Post[] = await store2.posts.index.search(
8686
new SearchRequest({
87-
query: [] // query all
87+
query: [], // query all
8888
}),
8989
{
9090
local: true,
91-
remote: true
92-
}
91+
remote: true,
92+
},
9393
);
9494

9595
assert.equal(responses.length, 1);
96-
assert.deepEqual(responses.map((x) => x.message), ["hello world"]);
96+
assert.deepEqual(
97+
responses.map((x) => x.message),
98+
["hello world"],
99+
);
97100
/// [another-client]
98101

99102
/// [disconnecting]
100103
await peer.stop();
101104
await peer2.stop();
102-
/// [disconnecting]
105+
/// [disconnecting]

docs/examples/text-store.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { Peerbit } from "peerbit";
2-
import { Program } from "@peerbit/program";
1+
import { field, variant } from "@dao-xyz/borsh";
32
import { PublicSignKey } from "@peerbit/crypto";
3+
import { Program } from "@peerbit/program";
44
import {
5-
Range,
65
DString,
6+
Range,
77
StringOperation,
8-
type TransactionContext
8+
type TransactionContext,
99
} from "@peerbit/string";
10-
import { field, variant } from "@dao-xyz/borsh";
1110
import assert from "node:assert";
11+
import { Peerbit } from "peerbit";
1212

1313
@variant("collaborative_text") // You have to give the program a unique name
1414
class CollaborativeText extends Program {
@@ -23,13 +23,13 @@ class CollaborativeText extends Program {
2323
async open() {
2424
await this.string.open({
2525
canPerform: this.canPerform,
26-
canRead: this.canRead
26+
canRead: this.canRead,
2727
});
2828
}
2929

3030
async canPerform(
3131
operation: StringOperation,
32-
context: TransactionContext
32+
context: TransactionContext,
3333
): Promise<boolean> {
3434
// .. acl logic writers
3535
return true;

docs/modules/client/connectivity-direct.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Peerbit } from "peerbit";
21
import type { Multiaddr } from "@multiformats/multiaddr";
3-
import { expect } from 'chai';
2+
import { expect } from "chai";
3+
import { Peerbit } from "peerbit";
44

55
const peerA = await Peerbit.create();
66
const peerB = await Peerbit.create();
@@ -23,9 +23,7 @@ await peerA.dial(multaddrs);
2323
// Connected!
2424

2525
// We can dial an address directly from a string. This one below is malformed and will fail
26-
await expect(peerA.dial("/ip4/123.4.5...")).rejectedWith(
27-
"invalid ip address"
28-
);
26+
await expect(peerA.dial("/ip4/123.4.5...")).rejectedWith("invalid ip address");
2927

3028
await peerA.stop();
3129
await peerB.stop();

docs/modules/client/example.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const clientInMemory = await Peerbit.create();
66

77
// Store content on disc when possible
88
const clientWithStorage = await Peerbit.create({
9-
directory: "/path/somewhere"
9+
directory: "/path/somewhere",
1010
});
1111
/// [memory]
1212

docs/modules/encoding/borsh.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import {
2-
variant,
2+
deserialize,
33
field,
44
fixedArray,
55
serialize,
6-
deserialize
6+
variant,
77
} from "@dao-xyz/borsh";
88
import { randomBytes } from "@peerbit/crypto";
9+
910
abstract class AbstractPost {}
1011

1112
@variant(0) // V0

docs/modules/encoding/json.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
2-
variant,
2+
deserialize,
33
field,
44
fixedArray,
55
serialize,
6-
deserialize
6+
variant,
77
} from "@dao-xyz/borsh";
88
import { randomBytes } from "@peerbit/crypto";
99
import assert from "node:assert";
@@ -35,7 +35,7 @@ class Post {
3535
}
3636
const message = new Post({
3737
title: "Hello world!",
38-
message: "This is a JSON message"
38+
message: "This is a JSON message",
3939
});
4040
const bytes = serialize(message); // [0, ... ] will start with 0 because @variant(0)
4141
const post: Post = deserialize(bytes, Post);

0 commit comments

Comments
 (0)