jazz-run 0.7.0-alpha.36 → 0.7.0-alpha.38
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/.eslintrc.cjs +3 -10
- package/.prettierrc.js +9 -0
- package/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +13 -0
- package/CHANGELOG.md +21 -0
- package/README.md +2 -2
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/package.json +11 -7
- package/src/index.ts +18 -20
package/.eslintrc.cjs
CHANGED
|
@@ -3,6 +3,7 @@ module.exports = {
|
|
|
3
3
|
"eslint:recommended",
|
|
4
4
|
"plugin:@typescript-eslint/recommended",
|
|
5
5
|
"plugin:require-extensions/recommended",
|
|
6
|
+
"prettier"
|
|
6
7
|
],
|
|
7
8
|
parser: "@typescript-eslint/parser",
|
|
8
9
|
plugins: ["@typescript-eslint", "require-extensions"],
|
|
@@ -10,7 +11,7 @@ module.exports = {
|
|
|
10
11
|
project: "./tsconfig.json",
|
|
11
12
|
tsconfigRootDir: __dirname,
|
|
12
13
|
},
|
|
13
|
-
ignorePatterns: [".eslint.cjs"
|
|
14
|
+
ignorePatterns: [".eslint.cjs"],
|
|
14
15
|
root: true,
|
|
15
16
|
rules: {
|
|
16
17
|
"no-unused-vars": "off",
|
|
@@ -19,13 +20,5 @@ module.exports = {
|
|
|
19
20
|
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
|
20
21
|
],
|
|
21
22
|
"@typescript-eslint/no-floating-promises": "error",
|
|
22
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
23
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
24
|
-
"error",
|
|
25
|
-
{
|
|
26
|
-
prefer: "type-imports",
|
|
27
|
-
disallowTypeAnnotations: false,
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
23
|
},
|
|
31
|
-
}
|
|
24
|
+
}
|
package/.prettierrc.js
ADDED
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> jazz-run@0.7.0-alpha.
|
|
2
|
+
> jazz-run@0.7.0-alpha.37 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.0-alpha.
|
|
7
|
-
> eslint
|
|
6
|
+
> jazz-run@0.7.0-alpha.37 lint
|
|
7
|
+
> eslint . --ext ts,tsx
|
|
8
8
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
> jazz-run@0.7.0-alpha.37 test /Users/anselm/jazz/jazz/packages/jazz-run
|
|
3
|
+
> vitest
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
DEV v0.34.6 /Users/anselm/jazz/jazz/packages/jazz-run
|
|
7
|
+
|
|
8
|
+
include: **/*.{test,spec}.?(c|m)[jt]s?(x)
|
|
9
|
+
exclude: **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*
|
|
10
|
+
watch exclude: **/node_modules/**, **/dist/**
|
|
11
|
+
|
|
12
|
+
No test files found, exiting with code 1
|
|
13
|
+
ELIFECYCLE Test failed. See above for more details.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# jazz-autosub
|
|
2
2
|
|
|
3
|
+
## 0.7.0-alpha.38
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- jazz-tools@0.7.0-alpha.38
|
|
12
|
+
- cojson@0.7.0-alpha.38
|
|
13
|
+
- cojson-transport-nodejs-ws@0.7.0-alpha.38
|
|
14
|
+
|
|
15
|
+
## 0.7.0-alpha.37
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- cojson@0.7.0-alpha.37
|
|
21
|
+
- cojson-transport-nodejs-ws@0.7.0-alpha.37
|
|
22
|
+
- jazz-tools@0.7.0-alpha.37
|
|
23
|
+
|
|
3
24
|
## 0.7.0-alpha.36
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `jazz-run`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
CLI tools for Jazz (see [jazz.tools](https://jazz.tools)), a framework for distributed state.
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,8 @@ import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
|
|
4
4
|
import { Console, Effect } from "effect";
|
|
5
5
|
import { websocketReadableStream, websocketWritableStream, } from "cojson-transport-nodejs-ws";
|
|
6
6
|
import { WebSocket } from "ws";
|
|
7
|
-
import { Account, cojsonInternals,
|
|
8
|
-
import { webcrypto } from "node:crypto";
|
|
7
|
+
import { Account, WasmCrypto, cojsonInternals, isControlledAccount } from "jazz-tools";
|
|
9
8
|
const jazzTools = Command.make("jazz-tools");
|
|
10
|
-
if (!("crypto" in globalThis)) {
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
globalThis.crypto = webcrypto;
|
|
13
|
-
}
|
|
14
9
|
const name = Options.text("name").pipe(Options.withAlias("n"));
|
|
15
10
|
const peer = Options.text("peer")
|
|
16
11
|
.pipe(Options.withAlias("p"))
|
|
@@ -18,8 +13,8 @@ const peer = Options.text("peer")
|
|
|
18
13
|
const accountCreate = Command.make("create", { name, peer }, ({ name, peer }) => {
|
|
19
14
|
return Effect.gen(function* () {
|
|
20
15
|
const ws = new WebSocket(peer);
|
|
21
|
-
yield* Effect.promise(() =>
|
|
22
|
-
const account = yield* Effect.promise(() => Account.create({
|
|
16
|
+
const crypto = yield* Effect.promise(() => WasmCrypto.create());
|
|
17
|
+
const account = yield* Effect.promise(async () => Account.create({
|
|
23
18
|
creationProps: { name },
|
|
24
19
|
peersToLoadFrom: [
|
|
25
20
|
{
|
|
@@ -29,11 +24,15 @@ const accountCreate = Command.make("create", { name, peer }, ({ name, peer }) =>
|
|
|
29
24
|
outgoing: websocketWritableStream(ws),
|
|
30
25
|
},
|
|
31
26
|
],
|
|
27
|
+
crypto,
|
|
32
28
|
}));
|
|
29
|
+
if (!isControlledAccount(account)) {
|
|
30
|
+
throw new Error("account is not a controlled account");
|
|
31
|
+
}
|
|
33
32
|
yield* Effect.promise(() => account._raw.core.node.syncManager.syncCoValue(account._raw.core));
|
|
34
33
|
yield* Effect.promise(() => account._raw.core.node.syncManager.syncCoValue(account.profile._raw.core));
|
|
35
34
|
const ws2 = new WebSocket(peer);
|
|
36
|
-
yield* Effect.promise(() => Account.become({
|
|
35
|
+
yield* Effect.promise(async () => Account.become({
|
|
37
36
|
accountID: account.id,
|
|
38
37
|
accountSecret: account._raw.agentSecret,
|
|
39
38
|
sessionID: cojsonInternals.newRandomSessionID(account.id),
|
|
@@ -45,6 +44,7 @@ const accountCreate = Command.make("create", { name, peer }, ({ name, peer }) =>
|
|
|
45
44
|
outgoing: websocketWritableStream(ws2),
|
|
46
45
|
},
|
|
47
46
|
],
|
|
47
|
+
crypto,
|
|
48
48
|
}));
|
|
49
49
|
yield* Console.log(`# Credentials for Jazz account "${name}":
|
|
50
50
|
JAZZ_WORKER_ACCOUNT=${account.id}
|
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,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"license": "MIT",
|
|
6
|
-
"version": "0.7.0-alpha.
|
|
6
|
+
"version": "0.7.0-alpha.38",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@effect/cli": "^0.36.21",
|
|
9
9
|
"@effect/platform-node": "^0.49.2",
|
|
10
10
|
"@effect/schema": "^0.66.16",
|
|
11
|
-
"effect": "^3.1.
|
|
11
|
+
"effect": "^3.1.5",
|
|
12
12
|
"fast-check": "^3.17.2",
|
|
13
13
|
"ws": "^8.14.2",
|
|
14
|
-
"cojson": "0.7.0-alpha.
|
|
15
|
-
"cojson-transport-nodejs-ws": "0.7.0-alpha.
|
|
16
|
-
"jazz-tools": "0.7.0-alpha.
|
|
14
|
+
"cojson": "0.7.0-alpha.38",
|
|
15
|
+
"cojson-transport-nodejs-ws": "0.7.0-alpha.38",
|
|
16
|
+
"jazz-tools": "0.7.0-alpha.38"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/ws": "^8.5.5",
|
|
20
20
|
"typescript": "^5.3.3",
|
|
21
21
|
"vitest": "^0.34.6"
|
|
22
22
|
},
|
|
23
|
+
"lint-staged": {
|
|
24
|
+
"*.{ts,tsx}": "eslint --fix",
|
|
25
|
+
"*.{js,jsx,mdx,json}": "prettier --write"
|
|
26
|
+
},
|
|
23
27
|
"scripts": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
28
|
+
"lint": "eslint . --ext ts,tsx",
|
|
29
|
+
"format": "prettier --write './src/**/*.{ts,tsx}'",
|
|
26
30
|
"build": "npm run lint && rm -rf ./dist && tsc --sourceMap --outDir dist"
|
|
27
31
|
}
|
|
28
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,18 +7,11 @@ import {
|
|
|
7
7
|
websocketWritableStream,
|
|
8
8
|
} from "cojson-transport-nodejs-ws";
|
|
9
9
|
import { WebSocket } from "ws";
|
|
10
|
-
import
|
|
11
|
-
import { Account, cojsonInternals, jazzReady } from "jazz-tools";
|
|
12
|
-
import { webcrypto } from "node:crypto";
|
|
10
|
+
import { Account, WasmCrypto, cojsonInternals, isControlledAccount } from "jazz-tools";
|
|
13
11
|
import type { AccountID } from "cojson";
|
|
14
12
|
|
|
15
13
|
const jazzTools = Command.make("jazz-tools");
|
|
16
14
|
|
|
17
|
-
if (!("crypto" in globalThis)) {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
-
(globalThis as any).crypto = webcrypto;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
15
|
const name = Options.text("name").pipe(Options.withAlias("n"));
|
|
23
16
|
const peer = Options.text("peer")
|
|
24
17
|
.pipe(Options.withAlias("p"))
|
|
@@ -30,9 +23,9 @@ const accountCreate = Command.make(
|
|
|
30
23
|
return Effect.gen(function* () {
|
|
31
24
|
const ws = new WebSocket(peer);
|
|
32
25
|
|
|
33
|
-
yield* Effect.promise(() =>
|
|
26
|
+
const crypto = yield* Effect.promise(() => WasmCrypto.create());
|
|
34
27
|
|
|
35
|
-
const account: Account
|
|
28
|
+
const account: Account = yield* Effect.promise(async () =>
|
|
36
29
|
Account.create({
|
|
37
30
|
creationProps: { name },
|
|
38
31
|
peersToLoadFrom: [
|
|
@@ -43,28 +36,32 @@ const accountCreate = Command.make(
|
|
|
43
36
|
outgoing: websocketWritableStream(ws),
|
|
44
37
|
},
|
|
45
38
|
],
|
|
46
|
-
|
|
39
|
+
crypto,
|
|
40
|
+
}),
|
|
47
41
|
);
|
|
42
|
+
if (!isControlledAccount(account)) {
|
|
43
|
+
throw new Error("account is not a controlled account");
|
|
44
|
+
}
|
|
48
45
|
|
|
49
46
|
yield* Effect.promise(() =>
|
|
50
47
|
account._raw.core.node.syncManager.syncCoValue(
|
|
51
|
-
account._raw.core
|
|
52
|
-
)
|
|
48
|
+
account._raw.core,
|
|
49
|
+
),
|
|
53
50
|
);
|
|
54
51
|
yield* Effect.promise(() =>
|
|
55
52
|
account._raw.core.node.syncManager.syncCoValue(
|
|
56
|
-
account.profile!._raw.core
|
|
57
|
-
)
|
|
53
|
+
account.profile!._raw.core,
|
|
54
|
+
),
|
|
58
55
|
);
|
|
59
56
|
|
|
60
57
|
const ws2 = new WebSocket(peer);
|
|
61
58
|
|
|
62
|
-
yield* Effect.promise(() =>
|
|
59
|
+
yield* Effect.promise(async () =>
|
|
63
60
|
Account.become({
|
|
64
61
|
accountID: account.id,
|
|
65
62
|
accountSecret: account._raw.agentSecret,
|
|
66
63
|
sessionID: cojsonInternals.newRandomSessionID(
|
|
67
|
-
account.id as unknown as AccountID
|
|
64
|
+
account.id as unknown as AccountID,
|
|
68
65
|
),
|
|
69
66
|
peersToLoadFrom: [
|
|
70
67
|
{
|
|
@@ -74,7 +71,8 @@ const accountCreate = Command.make(
|
|
|
74
71
|
outgoing: websocketWritableStream(ws2),
|
|
75
72
|
},
|
|
76
73
|
],
|
|
77
|
-
|
|
74
|
+
crypto,
|
|
75
|
+
}),
|
|
78
76
|
);
|
|
79
77
|
|
|
80
78
|
yield* Console.log(`# Credentials for Jazz account "${name}":
|
|
@@ -82,7 +80,7 @@ JAZZ_WORKER_ACCOUNT=${account.id}
|
|
|
82
80
|
JAZZ_WORKER_SECRET=${account._raw.agentSecret}
|
|
83
81
|
`);
|
|
84
82
|
});
|
|
85
|
-
}
|
|
83
|
+
},
|
|
86
84
|
);
|
|
87
85
|
|
|
88
86
|
const accountBase = Command.make("account");
|
|
@@ -98,5 +96,5 @@ const cli = Command.run(command, {
|
|
|
98
96
|
|
|
99
97
|
Effect.suspend(() => cli(process.argv)).pipe(
|
|
100
98
|
Effect.provide(NodeContext.layer),
|
|
101
|
-
NodeRuntime.runMain
|
|
99
|
+
NodeRuntime.runMain,
|
|
102
100
|
);
|