jazz-run 0.7.0-alpha.34

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 ADDED
@@ -0,0 +1,31 @@
1
+ module.exports = {
2
+ extends: [
3
+ "eslint:recommended",
4
+ "plugin:@typescript-eslint/recommended",
5
+ "plugin:require-extensions/recommended",
6
+ ],
7
+ parser: "@typescript-eslint/parser",
8
+ plugins: ["@typescript-eslint", "require-extensions"],
9
+ parserOptions: {
10
+ project: "./tsconfig.json",
11
+ tsconfigRootDir: __dirname,
12
+ },
13
+ ignorePatterns: [".eslint.cjs", "**/tests/*"],
14
+ root: true,
15
+ rules: {
16
+ "no-unused-vars": "off",
17
+ "@typescript-eslint/no-unused-vars": [
18
+ "error",
19
+ { argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
20
+ ],
21
+ "@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
+ },
31
+ };
@@ -0,0 +1,8 @@
1
+
2
+ > jazz-run@0.7.0-alpha.32 build /Users/anselm/jazz/jazz/packages/jazz-run
3
+ > npm run lint && rm -rf ./dist && tsc --sourceMap --outDir dist
4
+
5
+
6
+ > jazz-run@0.7.0-alpha.32 lint
7
+ > eslint src/**/*.ts
8
+
package/CHANGELOG.md ADDED
@@ -0,0 +1,258 @@
1
+ # jazz-autosub
2
+
3
+ ## 0.7.0-alpha.34
4
+
5
+ ### Patch Changes
6
+
7
+ - Extract jazz cli into jazz-run package
8
+ - Updated dependencies
9
+ - jazz-tools@0.7.0-alpha.34
10
+
11
+ ## 0.7.0-alpha.32
12
+
13
+ ### Patch Changes
14
+
15
+ - Introduce jazz-tools CLI
16
+ - Clean up exports
17
+
18
+ ## 0.7.0-alpha.31
19
+
20
+ ### Patch Changes
21
+
22
+ - Get rid of self generics, new create syntax
23
+
24
+ ## 0.7.0-alpha.30
25
+
26
+ ### Patch Changes
27
+
28
+ - CoValue casting & auto-subbing \_owner
29
+
30
+ ## 0.7.0-alpha.29
31
+
32
+ ### Patch Changes
33
+
34
+ - Reintroduce changes from main
35
+ - Updated dependencies
36
+ - cojson@0.7.0-alpha.29
37
+
38
+ ## 0.7.0-alpha.28
39
+
40
+ ### Patch Changes
41
+
42
+ - Implement profile visibility based on groups & new migration signature
43
+ - Updated dependencies
44
+ - cojson@0.7.0-alpha.28
45
+
46
+ ## 0.7.0-alpha.27
47
+
48
+ ### Patch Changes
49
+
50
+ - Fix CoList.splice / RawCoList.append
51
+ - Fix Costream[...].all
52
+ - Updated dependencies
53
+ - cojson@0.7.0-alpha.27
54
+
55
+ ## 0.7.0-alpha.26
56
+
57
+ ### Patch Changes
58
+
59
+ - Fix CoMap.Record.toJSON()
60
+
61
+ ## 0.7.0-alpha.25
62
+
63
+ ### Patch Changes
64
+
65
+ - Make Account -> Profile a lazy ref schema
66
+
67
+ ## 0.7.0-alpha.24
68
+
69
+ ### Patch Changes
70
+
71
+ - Relax types of CoMap.\_schema
72
+ - Fix schema of Account & Group
73
+ - Make sure delete on CoMaps deletes keys
74
+ - Updated dependencies
75
+ - cojson@0.7.0-alpha.24
76
+
77
+ ## 0.7.0-alpha.23
78
+
79
+ ### Patch Changes
80
+
81
+ - CoMap fixes and improvements
82
+
83
+ ## 0.7.0-alpha.22
84
+
85
+ ### Patch Changes
86
+
87
+ - Fix CoMap \_refs for co.items
88
+
89
+ ## 0.7.0-alpha.21
90
+
91
+ ### Patch Changes
92
+
93
+ - Add maxWidth option for loading images
94
+
95
+ ## 0.7.0-alpha.20
96
+
97
+ ### Patch Changes
98
+
99
+ - Make fast-check a direct dependency to help dev time resolution
100
+
101
+ ## 0.7.0-alpha.19
102
+
103
+ ### Patch Changes
104
+
105
+ - More precise imports from @effect/schema
106
+
107
+ ## 0.7.0-alpha.17
108
+
109
+ ### Patch Changes
110
+
111
+ - Use effect 3.0
112
+
113
+ ## 0.7.0-alpha.16
114
+
115
+ ### Patch Changes
116
+
117
+ - Make CoMaps even more subclassable
118
+
119
+ ## 0.7.0-alpha.15
120
+
121
+ ### Patch Changes
122
+
123
+ - More superclass-compatible CoMaps
124
+
125
+ ## 0.7.0-alpha.14
126
+
127
+ ### Patch Changes
128
+
129
+ - Fix CoStream types
130
+
131
+ ## 0.7.0-alpha.13
132
+
133
+ ### Patch Changes
134
+
135
+ - Add .all to CoStreamEntry
136
+
137
+ ## 0.7.0-alpha.12
138
+
139
+ ### Patch Changes
140
+
141
+ - Fix variance of ID.\_\_type
142
+
143
+ ## 0.7.0-alpha.11
144
+
145
+ ### Patch Changes
146
+
147
+ - Support stricter TS lint rules
148
+ - Updated dependencies
149
+ - cojson@0.7.0-alpha.11
150
+
151
+ ## 0.7.0-alpha.10
152
+
153
+ ### Patch Changes
154
+
155
+ - Clean up API more & re-add jazz-nodejs
156
+ - Updated dependencies
157
+ - cojson@0.7.0-alpha.10
158
+
159
+ ## 0.7.0-alpha.9
160
+
161
+ ### Patch Changes
162
+
163
+ - Even friendlier for subclassing CoMap
164
+
165
+ ## 0.7.0-alpha.8
166
+
167
+ ### Patch Changes
168
+
169
+ - More subclass-friendly types in CoMap
170
+
171
+ ## 0.7.0-alpha.7
172
+
173
+ ### Patch Changes
174
+
175
+ - Consistent proxy based API
176
+ - Updated dependencies
177
+ - cojson@0.7.0-alpha.7
178
+
179
+ ## 0.7.0-alpha.6
180
+
181
+ ### Patch Changes
182
+
183
+ - CoMap fix
184
+
185
+ ## 0.7.0-alpha.5
186
+
187
+ ### Patch Changes
188
+
189
+ - Refactoring
190
+ - Updated dependencies
191
+ - cojson@0.7.0-alpha.5
192
+
193
+ ## 0.7.0-alpha.4
194
+
195
+ ### Patch Changes
196
+
197
+ - Make refs on list more precise
198
+
199
+ ## 0.7.0-alpha.3
200
+
201
+ ### Patch Changes
202
+
203
+ - Make refs type more precise
204
+
205
+ ## 0.7.0-alpha.2
206
+
207
+ ### Patch Changes
208
+
209
+ - Get rid of Co namespace
210
+
211
+ ## 0.7.0-alpha.1
212
+
213
+ ### Patch Changes
214
+
215
+ - Use effect schema much less
216
+ - Updated dependencies
217
+ - cojson@0.7.0-alpha.1
218
+
219
+ ## 0.7.0-alpha.0
220
+
221
+ ### Minor Changes
222
+
223
+ - New simplified API
224
+
225
+ ### Patch Changes
226
+
227
+ - Updated dependencies
228
+ - cojson@0.7.0-alpha.0
229
+
230
+ ## 0.6.1
231
+
232
+ ### Patch Changes
233
+
234
+ - Fix loading of accounts
235
+ - Updated dependencies
236
+ - cojson@0.6.5
237
+
238
+ ## 0.6.0
239
+
240
+ ### Minor Changes
241
+
242
+ - Make addMember and removeMember take loaded Accounts instead of just IDs
243
+
244
+ ### Patch Changes
245
+
246
+ - Updated dependencies
247
+ - cojson@0.6.0
248
+
249
+ ## 0.5.0
250
+
251
+ ### Minor Changes
252
+
253
+ - Adding a lot of performance improvements to cojson, add a stresstest for the twit example and make that run smoother in a lot of ways.
254
+
255
+ ### Patch Changes
256
+
257
+ - Updated dependencies
258
+ - cojson@0.5.0
package/LICENSE.txt ADDED
@@ -0,0 +1,19 @@
1
+ Copyright 2023, Garden Computing, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # CoJSON
2
+
3
+ [See the top-level README](../../README.md#cojson)
package/dist/index.js ADDED
@@ -0,0 +1,46 @@
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 "jazz-tools";
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
@@ -0,0 +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,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,YAAY,CAAC;AAChD,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,uBAA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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 ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "jazz-run",
3
+ "bin": "./dist/index.js",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "version": "0.7.0-alpha.34",
7
+ "dependencies": {
8
+ "@effect/cli": "^0.36.21",
9
+ "@effect/platform-node": "^0.49.2",
10
+ "@effect/schema": "^0.66.16",
11
+ "effect": "^3.1.3",
12
+ "fast-check": "^3.17.2",
13
+ "ws": "^8.14.2",
14
+ "cojson": "0.7.0-alpha.29",
15
+ "cojson-transport-nodejs-ws": "0.7.0-alpha.29",
16
+ "jazz-tools": "0.7.0-alpha.34"
17
+ },
18
+ "devDependencies": {
19
+ "@types/ws": "^8.5.5",
20
+ "typescript": "^5.3.3",
21
+ "vitest": "^0.34.6"
22
+ },
23
+ "scripts": {
24
+ "test": "vitest",
25
+ "lint": "eslint src/**/*.ts",
26
+ "build": "npm run lint && rm -rf ./dist && tsc --sourceMap --outDir dist"
27
+ }
28
+ }
package/src/index.ts ADDED
@@ -0,0 +1,69 @@
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 "jazz-tools";
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
+ );
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["ESNext"],
4
+ "module": "esnext",
5
+ "target": "ES2020",
6
+ "moduleResolution": "bundler",
7
+ "moduleDetection": "force",
8
+ "strict": true,
9
+ "skipLibCheck": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "noUncheckedIndexedAccess": true,
12
+ "esModuleInterop": true
13
+ },
14
+ "include": ["./src/**/*"],
15
+ }