jazz-tools 0.7.0-alpha.32 → 0.7.0-alpha.34
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +6 -0
- package/package.json +2 -7
- package/dist/cli/index.js +0 -46
- package/dist/cli/index.js.map +0 -1
- package/src/cli/index.ts +0 -69
package/.turbo/turbo-build.log
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
|
2
|
-
> jazz-tools@0.7.0-alpha.
|
2
|
+
> jazz-tools@0.7.0-alpha.32 build /Users/anselm/jazz/jazz/packages/jazz-tools
|
3
3
|
> npm run lint && rm -rf ./dist && tsc --sourceMap --outDir dist
|
4
4
|
|
5
5
|
|
6
|
-
> jazz-tools@0.7.0-alpha.
|
6
|
+
> jazz-tools@0.7.0-alpha.32 lint
|
7
7
|
> eslint src/**/*.ts
|
8
8
|
|
9
9
|
|
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
@@ -3,24 +3,19 @@
|
|
3
3
|
"module": "./dist/index.js",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"types": "./src/index.ts",
|
6
|
-
"bin": "./dist/cli/index.js",
|
7
6
|
"type": "module",
|
8
7
|
"license": "MIT",
|
9
|
-
"version": "0.7.0-alpha.
|
8
|
+
"version": "0.7.0-alpha.34",
|
10
9
|
"dependencies": {
|
11
|
-
"@effect/cli": "^0.36.21",
|
12
|
-
"@effect/platform-node": "^0.49.2",
|
13
10
|
"@effect/schema": "^0.66.16",
|
14
11
|
"effect": "^3.1.3",
|
15
12
|
"fast-check": "^3.17.2",
|
16
|
-
"ws": "^8.14.2",
|
17
13
|
"cojson": "0.7.0-alpha.29",
|
18
14
|
"cojson-transport-nodejs-ws": "0.7.0-alpha.29"
|
19
15
|
},
|
20
16
|
"devDependencies": {
|
21
17
|
"typescript": "^5.3.3",
|
22
|
-
"vitest": "^0.34.6"
|
23
|
-
"@types/ws": "^8.5.5"
|
18
|
+
"vitest": "^0.34.6"
|
24
19
|
},
|
25
20
|
"madge": {
|
26
21
|
"detectiveOptions": {
|
package/dist/cli/index.js
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
import { Command, Options } from "@effect/cli";
|
3
|
-
import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
4
|
-
import { Console, Effect } from "effect";
|
5
|
-
import { websocketReadableStream, websocketWritableStream, } from "cojson-transport-nodejs-ws";
|
6
|
-
import { WebSocket } from "ws";
|
7
|
-
import { Account, jazzReady } from "../index.js";
|
8
|
-
import { webcrypto } from "node:crypto";
|
9
|
-
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
|
-
const name = Options.text("name").pipe(Options.withAlias("n"));
|
15
|
-
const peer = Options.text("peer")
|
16
|
-
.pipe(Options.withAlias("p"))
|
17
|
-
.pipe(Options.withDefault("wss://mesh.jazz.tools"));
|
18
|
-
const accountCreate = Command.make("create", { name, peer }, ({ name, peer }) => {
|
19
|
-
return Effect.gen(function* () {
|
20
|
-
const ws = new WebSocket(peer);
|
21
|
-
const account = yield* Effect.promise(() => jazzReady.then(() => Account.create({
|
22
|
-
creationProps: { name },
|
23
|
-
peersToLoadFrom: [
|
24
|
-
{
|
25
|
-
id: "upstream",
|
26
|
-
role: "server",
|
27
|
-
incoming: websocketReadableStream(ws),
|
28
|
-
outgoing: websocketWritableStream(ws),
|
29
|
-
},
|
30
|
-
],
|
31
|
-
})));
|
32
|
-
yield* Console.log(`# Credentials for Jazz account "${name}":
|
33
|
-
JAZZ_WORKER_ACCOUNT=${account.id}
|
34
|
-
JAZZ_WORKER_SECRET=${account._raw.agentSecret}
|
35
|
-
`);
|
36
|
-
});
|
37
|
-
});
|
38
|
-
const accountBase = Command.make("account");
|
39
|
-
const account = accountBase.pipe(Command.withSubcommands([accountCreate]));
|
40
|
-
const command = jazzTools.pipe(Command.withSubcommands([account]));
|
41
|
-
const cli = Command.run(command, {
|
42
|
-
name: "Jazz CLI Tools",
|
43
|
-
version: "v0.7.0",
|
44
|
-
});
|
45
|
-
Effect.suspend(() => cli(process.argv)).pipe(Effect.provide(NodeContext.layer), NodeRuntime.runMain);
|
46
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cli/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/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,CAAC;AACzC,OAAO,EACH,uBAAuB,EACvB,uBAAuB,GAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AAE7C,IAAI,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC,EAAE,CAAC;IAC5B,8DAA8D;IAC7D,UAAkB,CAAC,MAAM,GAAG,SAAS,CAAC;AAC3C,CAAC;AAED,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;KAC5B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;KAC5B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,uBAAuB,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B,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/src/cli/index.ts
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
import { Command, Options } from "@effect/cli";
|
3
|
-
import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
4
|
-
import { Console, Effect } from "effect";
|
5
|
-
import {
|
6
|
-
websocketReadableStream,
|
7
|
-
websocketWritableStream,
|
8
|
-
} from "cojson-transport-nodejs-ws";
|
9
|
-
import { WebSocket } from "ws";
|
10
|
-
import { Account, jazzReady } from "../index.js";
|
11
|
-
import { webcrypto } from "node:crypto";
|
12
|
-
|
13
|
-
const jazzTools = Command.make("jazz-tools");
|
14
|
-
|
15
|
-
if (!("crypto" in globalThis)) {
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
17
|
-
(globalThis as any).crypto = webcrypto;
|
18
|
-
}
|
19
|
-
|
20
|
-
const name = Options.text("name").pipe(Options.withAlias("n"));
|
21
|
-
const peer = Options.text("peer")
|
22
|
-
.pipe(Options.withAlias("p"))
|
23
|
-
.pipe(Options.withDefault("wss://mesh.jazz.tools"));
|
24
|
-
const accountCreate = Command.make(
|
25
|
-
"create",
|
26
|
-
{ name, peer },
|
27
|
-
({ name, peer }) => {
|
28
|
-
return Effect.gen(function* () {
|
29
|
-
const ws = new WebSocket(peer);
|
30
|
-
|
31
|
-
const account = yield* Effect.promise(() =>
|
32
|
-
jazzReady.then(() =>
|
33
|
-
Account.create({
|
34
|
-
creationProps: { name },
|
35
|
-
peersToLoadFrom: [
|
36
|
-
{
|
37
|
-
id: "upstream",
|
38
|
-
role: "server",
|
39
|
-
incoming: websocketReadableStream(ws),
|
40
|
-
outgoing: websocketWritableStream(ws),
|
41
|
-
},
|
42
|
-
],
|
43
|
-
})
|
44
|
-
)
|
45
|
-
);
|
46
|
-
|
47
|
-
yield* Console.log(`# Credentials for Jazz account "${name}":
|
48
|
-
JAZZ_WORKER_ACCOUNT=${account.id}
|
49
|
-
JAZZ_WORKER_SECRET=${account._raw.agentSecret}
|
50
|
-
`);
|
51
|
-
});
|
52
|
-
}
|
53
|
-
);
|
54
|
-
|
55
|
-
const accountBase = Command.make("account");
|
56
|
-
|
57
|
-
const account = accountBase.pipe(Command.withSubcommands([accountCreate]));
|
58
|
-
|
59
|
-
const command = jazzTools.pipe(Command.withSubcommands([account]));
|
60
|
-
|
61
|
-
const cli = Command.run(command, {
|
62
|
-
name: "Jazz CLI Tools",
|
63
|
-
version: "v0.7.0",
|
64
|
-
});
|
65
|
-
|
66
|
-
Effect.suspend(() => cli(process.argv)).pipe(
|
67
|
-
Effect.provide(NodeContext.layer),
|
68
|
-
NodeRuntime.runMain
|
69
|
-
);
|