jazz-run 0.7.13 → 0.7.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
1
 
2
- > jazz-run@0.7.12 build /Users/anselm/jazz/jazz/packages/jazz-run
2
+ > jazz-run@0.7.14 build /Users/anselm/jazz/jazz/packages/jazz-run
3
3
  > npm run lint && rm -rf ./dist && tsc --sourceMap --outDir dist
4
4
 
5
5
 
6
- > jazz-run@0.7.12 lint
6
+ > jazz-run@0.7.14 lint
7
7
  > eslint . --ext ts,tsx
8
8
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # jazz-autosub
2
2
 
3
+ ## 0.7.16
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - jazz-tools@0.7.16
9
+
10
+ ## 0.7.14
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+ - cojson@0.7.14
16
+ - jazz-tools@0.7.14
17
+ - cojson-transport-ws@0.7.14
18
+
3
19
  ## 0.7.13
4
20
 
5
21
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { Command, Options } from "@effect/cli";
3
3
  import { NodeContext, NodeRuntime } from "@effect/platform-node";
4
4
  import { Console, Effect } from "effect";
5
- import { websocketReadableStream, websocketWritableStream, } from "cojson-transport-nodejs-ws";
5
+ import { createWebSocketPeer } from "cojson-transport-ws";
6
6
  import { WebSocket } from "ws";
7
7
  import { Account, WasmCrypto, cojsonInternals, isControlledAccount, } from "jazz-tools";
8
8
  const jazzTools = Command.make("jazz-tools");
@@ -10,20 +10,17 @@ const name = Options.text("name").pipe(Options.withAlias("n"));
10
10
  const peer = Options.text("peer")
11
11
  .pipe(Options.withAlias("p"))
12
12
  .pipe(Options.withDefault("wss://mesh.jazz.tools"));
13
- const accountCreate = Command.make("create", { name, peer }, ({ name, peer }) => {
13
+ const accountCreate = Command.make("create", { name, peer }, ({ name, peer: peerAddr }) => {
14
14
  return Effect.gen(function* () {
15
- const ws = new WebSocket(peer);
16
15
  const crypto = yield* Effect.promise(() => WasmCrypto.create());
16
+ const peer = yield* createWebSocketPeer({
17
+ id: "upstream",
18
+ websocket: new WebSocket(peerAddr),
19
+ role: "server",
20
+ });
17
21
  const account = yield* Effect.promise(async () => Account.create({
18
22
  creationProps: { name },
19
- peersToLoadFrom: [
20
- {
21
- id: "upstream",
22
- role: "server",
23
- incoming: websocketReadableStream(ws),
24
- outgoing: websocketWritableStream(ws),
25
- },
26
- ],
23
+ peersToLoadFrom: [peer],
27
24
  crypto,
28
25
  }));
29
26
  if (!isControlledAccount(account)) {
@@ -31,19 +28,16 @@ const accountCreate = Command.make("create", { name, peer }, ({ name, peer }) =>
31
28
  }
32
29
  yield* Effect.promise(() => account._raw.core.node.syncManager.syncCoValue(account._raw.core));
33
30
  yield* Effect.promise(() => account._raw.core.node.syncManager.syncCoValue(account.profile._raw.core));
34
- const ws2 = new WebSocket(peer);
31
+ const peer2 = yield* createWebSocketPeer({
32
+ id: "upstream2",
33
+ websocket: new WebSocket(peerAddr),
34
+ role: "server",
35
+ });
35
36
  yield* Effect.promise(async () => Account.become({
36
37
  accountID: account.id,
37
38
  accountSecret: account._raw.agentSecret,
38
39
  sessionID: cojsonInternals.newRandomSessionID(account.id),
39
- peersToLoadFrom: [
40
- {
41
- id: "upstream",
42
- role: "server",
43
- incoming: websocketReadableStream(ws2),
44
- outgoing: websocketWritableStream(ws2),
45
- },
46
- ],
40
+ peersToLoadFrom: [peer2],
47
41
  crypto,
48
42
  }));
49
43
  yield* Console.log(`# Credentials for Jazz account "${name}":
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,C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CAAC;AAEnE,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE;IAC7B,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,QAAQ;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CACxC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,EACjC,WAAW,CAAC,OAAO,CACtB,CAAC"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "bin": "./dist/index.js",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
- "version": "0.7.13",
6
+ "version": "0.7.16",
7
7
  "dependencies": {
8
8
  "@effect/cli": "^0.36.21",
9
9
  "@effect/platform-node": "^0.49.2",
@@ -11,9 +11,9 @@
11
11
  "effect": "^3.1.5",
12
12
  "fast-check": "^3.17.2",
13
13
  "ws": "^8.14.2",
14
- "cojson": "0.7.11",
15
- "jazz-tools": "0.7.13",
16
- "cojson-transport-nodejs-ws": "0.7.11"
14
+ "cojson-transport-ws": "0.7.14",
15
+ "jazz-tools": "0.7.16",
16
+ "cojson": "0.7.14"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/ws": "^8.5.5",
package/src/index.ts CHANGED
@@ -2,11 +2,8 @@
2
2
  import { Command, Options } from "@effect/cli";
3
3
  import { NodeContext, NodeRuntime } from "@effect/platform-node";
4
4
  import { Console, Effect } from "effect";
5
- import {
6
- websocketReadableStream,
7
- websocketWritableStream,
8
- } from "cojson-transport-nodejs-ws";
9
- import { WebSocket } from "ws";
5
+ import { createWebSocketPeer } from "cojson-transport-ws";
6
+ import { WebSocket } from "ws"
10
7
  import {
11
8
  Account,
12
9
  WasmCrypto,
@@ -24,23 +21,20 @@ const peer = Options.text("peer")
24
21
  const accountCreate = Command.make(
25
22
  "create",
26
23
  { name, peer },
27
- ({ name, peer }) => {
24
+ ({ name, peer: peerAddr }) => {
28
25
  return Effect.gen(function* () {
29
- const ws = new WebSocket(peer);
30
-
31
26
  const crypto = yield* Effect.promise(() => WasmCrypto.create());
32
27
 
28
+ const peer = yield* createWebSocketPeer({
29
+ id: "upstream",
30
+ websocket: new WebSocket(peerAddr),
31
+ role: "server",
32
+ });
33
+
33
34
  const account: Account = yield* Effect.promise(async () =>
34
35
  Account.create({
35
36
  creationProps: { name },
36
- peersToLoadFrom: [
37
- {
38
- id: "upstream",
39
- role: "server",
40
- incoming: websocketReadableStream(ws),
41
- outgoing: websocketWritableStream(ws),
42
- },
43
- ],
37
+ peersToLoadFrom: [peer],
44
38
  crypto,
45
39
  }),
46
40
  );
@@ -59,7 +53,11 @@ const accountCreate = Command.make(
59
53
  ),
60
54
  );
61
55
 
62
- const ws2 = new WebSocket(peer);
56
+ const peer2 = yield* createWebSocketPeer({
57
+ id: "upstream2",
58
+ websocket: new WebSocket(peerAddr),
59
+ role: "server",
60
+ });
63
61
 
64
62
  yield* Effect.promise(async () =>
65
63
  Account.become({
@@ -68,14 +66,7 @@ const accountCreate = Command.make(
68
66
  sessionID: cojsonInternals.newRandomSessionID(
69
67
  account.id as unknown as AccountID,
70
68
  ),
71
- peersToLoadFrom: [
72
- {
73
- id: "upstream",
74
- role: "server",
75
- incoming: websocketReadableStream(ws2),
76
- outgoing: websocketWritableStream(ws2),
77
- },
78
- ],
69
+ peersToLoadFrom: [peer2],
79
70
  crypto,
80
71
  }),
81
72
  );