jazz-tools 0.7.0-alpha.4 → 0.7.0-alpha.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. package/.eslintrc.cjs +3 -10
  2. package/.prettierrc.js +9 -0
  3. package/.turbo/turbo-build.log +3 -19
  4. package/.turbo/turbo-lint.log +4 -0
  5. package/.turbo/turbo-test.log +140 -0
  6. package/CHANGELOG.md +252 -0
  7. package/README.md +10 -2
  8. package/dist/coValues/account.js +104 -50
  9. package/dist/coValues/account.js.map +1 -1
  10. package/dist/coValues/coList.js +165 -112
  11. package/dist/coValues/coList.js.map +1 -1
  12. package/dist/coValues/coMap.js +243 -163
  13. package/dist/coValues/coMap.js.map +1 -1
  14. package/dist/coValues/coStream.js +256 -73
  15. package/dist/coValues/coStream.js.map +1 -1
  16. package/dist/coValues/deepLoading.js +57 -0
  17. package/dist/coValues/deepLoading.js.map +1 -0
  18. package/dist/coValues/extensions/imageDef.js +14 -8
  19. package/dist/coValues/extensions/imageDef.js.map +1 -1
  20. package/dist/coValues/group.js +49 -38
  21. package/dist/coValues/group.js.map +1 -1
  22. package/dist/coValues/interfaces.js +66 -26
  23. package/dist/coValues/interfaces.js.map +1 -1
  24. package/dist/implementation/devtoolsFormatters.js +114 -0
  25. package/dist/implementation/devtoolsFormatters.js.map +1 -0
  26. package/dist/implementation/refs.js +60 -19
  27. package/dist/implementation/refs.js.map +1 -1
  28. package/dist/implementation/schema.js +44 -1
  29. package/dist/implementation/schema.js.map +1 -1
  30. package/dist/implementation/subscriptionScope.js +19 -1
  31. package/dist/implementation/subscriptionScope.js.map +1 -1
  32. package/dist/implementation/symbols.js +5 -0
  33. package/dist/implementation/symbols.js.map +1 -0
  34. package/dist/index.js +4 -5
  35. package/dist/index.js.map +1 -1
  36. package/dist/internal.js +4 -1
  37. package/dist/internal.js.map +1 -1
  38. package/dist/tests/coList.test.js +51 -52
  39. package/dist/tests/coList.test.js.map +1 -1
  40. package/dist/tests/coMap.test.js +196 -75
  41. package/dist/tests/coMap.test.js.map +1 -1
  42. package/dist/tests/coStream.test.js +95 -85
  43. package/dist/tests/coStream.test.js.map +1 -1
  44. package/dist/tests/deepLoading.test.js +188 -0
  45. package/dist/tests/deepLoading.test.js.map +1 -0
  46. package/dist/tests/groupsAndAccounts.test.js +83 -0
  47. package/dist/tests/groupsAndAccounts.test.js.map +1 -0
  48. package/package.json +17 -9
  49. package/src/coValues/account.ts +184 -153
  50. package/src/coValues/coList.ts +220 -173
  51. package/src/coValues/coMap.ts +322 -312
  52. package/src/coValues/coStream.ts +397 -135
  53. package/src/coValues/deepLoading.ts +215 -0
  54. package/src/coValues/extensions/imageDef.ts +16 -17
  55. package/src/coValues/group.ts +95 -111
  56. package/src/coValues/interfaces.ts +217 -115
  57. package/src/implementation/devtoolsFormatters.ts +110 -0
  58. package/src/implementation/inspect.ts +1 -1
  59. package/src/implementation/refs.ts +91 -38
  60. package/src/implementation/schema.ts +87 -46
  61. package/src/implementation/subscriptionScope.ts +44 -12
  62. package/src/implementation/symbols.ts +11 -0
  63. package/src/index.ts +13 -9
  64. package/src/internal.ts +6 -2
  65. package/src/tests/coList.test.ts +67 -66
  66. package/src/tests/coMap.test.ts +226 -123
  67. package/src/tests/coStream.test.ts +141 -131
  68. package/src/tests/deepLoading.test.ts +301 -0
  69. package/src/tests/groupsAndAccounts.test.ts +91 -0
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", "**/tests/*"],
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
@@ -0,0 +1,9 @@
1
+ /** @type {import("prettier").Config} */
2
+ const config = {
3
+ trailingComma: "all",
4
+ tabWidth: 4,
5
+ semi: true,
6
+ singleQuote: false,
7
+ };
8
+
9
+ export default config;
@@ -1,24 +1,8 @@
1
1
 
2
- > jazz-js@0.6.1 build /Users/anselm/jazz/jazz/packages/jazz-js
2
+ > jazz-tools@0.7.0-alpha.41 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-js@0.6.1 lint
7
- > eslint src/**/*.ts
6
+ > jazz-tools@0.7.0-alpha.41 lint
7
+ > eslint . --ext ts,tsx
8
8
 
9
-
10
- /Users/anselm/jazz/jazz/packages/jazz-js/src/tests/binaryCoStream.test.ts
11
- 0:0 warning File ignored because of a matching ignore pattern. Use "--no-ignore" to override
12
-
13
- /Users/anselm/jazz/jazz/packages/jazz-js/src/tests/coList.test.ts
14
- 0:0 warning File ignored because of a matching ignore pattern. Use "--no-ignore" to override
15
-
16
- /Users/anselm/jazz/jazz/packages/jazz-js/src/tests/coMap.test.ts
17
- 0:0 warning File ignored because of a matching ignore pattern. Use "--no-ignore" to override
18
-
19
- /Users/anselm/jazz/jazz/packages/jazz-js/src/tests/coStream.test.ts
20
- 0:0 warning File ignored because of a matching ignore pattern. Use "--no-ignore" to override
21
-
22
- ✖ 4 problems (0 errors, 4 warnings)
23
-
24
-  ELIFECYCLE  Command failed.
@@ -0,0 +1,4 @@
1
+
2
+ > jazz-tools@0.7.0-alpha.37 lint /Users/anselm/jazz/jazz/packages/jazz-tools
3
+ > eslint . --ext ts,tsx
4
+
@@ -0,0 +1,140 @@
1
+
2
+ > jazz-tools@0.7.0-alpha.37 test /Users/anselm/jazz/jazz/packages/jazz-tools
3
+ > vitest --run
4
+
5
+
6
+ RUN v0.34.6 /Users/anselm/jazz/jazz/packages/jazz-tools
7
+
8
+ ✓ src/tests/groupsAndAccounts.test.ts (1 test) 41ms
9
+ stdout | unknown test
10
+ TestMap schema undefined
11
+
12
+ ✓ src/tests/deepLoading.test.ts (3 tests) 86ms
13
+ ✓ src/tests/coList.test.ts (10 tests) 160ms
14
+ stdout | src/tests/coList.test.ts > Simple CoList operations > Mutation > splice
15
+ [ 'bread', 'onion' ] 0
16
+ [ 'bread', 'salt', 'onion' ] 1
17
+
18
+ stdout | src/tests/coList.test.ts > CoList resolution > Subscription & auto-resolution
19
+ subscribedList?.[0]?.[0]?.[0] undefined
20
+ subscribedList?.[0]?.[0]?.[0] undefined
21
+ subscribedList?.[0]?.[0]?.[0] a
22
+ subscribedList?.[0]?.[0]?.[0] x
23
+ subscribedList?.[0]?.[0]?.[0] y
24
+ subscribedList?.[0]?.[0]?.[0] w
25
+
26
+ stdout | src/tests/coStream.test.ts > CoStream resolution > Subscription & auto-resolution
27
+ subscribedStream[me.id] {
28
+ value: [Getter],
29
+ ref: [Getter],
30
+ by: [Getter],
31
+ madeAt: 2024-05-24T20:46:44.463Z,
32
+ tx: {
33
+ sessionID: 'co_zNCLRSU2cPfqfz9aEAA1vL2JsF5_session_z75hUWuWjTuX',
34
+ txIndex: 0
35
+ }
36
+ }
37
+ subscribedStream[me.id]?.value?.[me.id]?.value undefined
38
+ subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value undefined
39
+ subscribedStream[me.id] {
40
+ value: [Getter],
41
+ ref: [Getter],
42
+ by: [Getter],
43
+ madeAt: 2024-05-24T20:46:44.463Z,
44
+ tx: {
45
+ sessionID: 'co_zNCLRSU2cPfqfz9aEAA1vL2JsF5_session_z75hUWuWjTuX',
46
+ txIndex: 0
47
+ }
48
+ }
49
+ subscribedStream[me.id]?.value?.[me.id]?.value null
50
+ subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value undefined
51
+ subscribedStream[me.id] {
52
+ value: [Getter],
53
+ ref: [Getter],
54
+ by: [Getter],
55
+ madeAt: 2024-05-24T20:46:44.463Z,
56
+ tx: {
57
+ sessionID: 'co_zNCLRSU2cPfqfz9aEAA1vL2JsF5_session_z75hUWuWjTuX',
58
+ txIndex: 0
59
+ }
60
+ }
61
+ subscribedStream[me.id]?.value?.[me.id]?.value {
62
+ id: 'co_zGQiwntfLWcU3pybwp6nq8VhcEr',
63
+ _type: 'CoStream',
64
+ co_zNCLRSU2cPfqfz9aEAA1vL2JsF5: 'milk',
65
+ in: { co_zNCLRSU2cPfqfz9aEAA1vL2JsF5_session_z75hUWuWjTuX: 'milk' }
66
+ }
67
+ subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value milk
68
+ subscribedStream[me.id] {
69
+ value: [Getter],
70
+ ref: [Getter],
71
+ by: [Getter],
72
+ madeAt: 2024-05-24T20:46:44.463Z,
73
+ tx: {
74
+ sessionID: 'co_zNCLRSU2cPfqfz9aEAA1vL2JsF5_session_z75hUWuWjTuX',
75
+ txIndex: 0
76
+ }
77
+ }
78
+ subscribedStream[me.id]?.value?.[me.id]?.value {
79
+ id: 'co_zGQiwntfLWcU3pybwp6nq8VhcEr',
80
+ _type: 'CoStream',
81
+ co_zNCLRSU2cPfqfz9aEAA1vL2JsF5: 'bread',
82
+ in: {
83
+ co_zNCLRSU2cPfqfz9aEAA1vL2JsF5_session_z75hUWuWjTuX: 'milk',
84
+ co_zNCLRSU2cPfqfz9aEAA1vL2JsF5_session_zSWSUsvvX8KW: 'bread'
85
+ }
86
+ }
87
+ subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value bread
88
+ subscribedStream[me.id] {
89
+ value: [Getter],
90
+ ref: [Getter],
91
+ by: [Getter],
92
+ madeAt: 2024-05-24T20:46:44.481Z,
93
+ tx: {
94
+ sessionID: 'co_zNCLRSU2cPfqfz9aEAA1vL2JsF5_session_zSWSUsvvX8KW',
95
+ txIndex: 0
96
+ }
97
+ }
98
+ subscribedStream[me.id]?.value?.[me.id]?.value {
99
+ id: 'co_zhX5ZcvxQW4w2LJ99rBQ6NmBziS',
100
+ _type: 'CoStream',
101
+ co_zNCLRSU2cPfqfz9aEAA1vL2JsF5: 'butter',
102
+ in: { co_zNCLRSU2cPfqfz9aEAA1vL2JsF5_session_zSWSUsvvX8KW: 'butter' }
103
+ }
104
+ subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value butter
105
+ subscribedStream[me.id] {
106
+ value: [Getter],
107
+ ref: [Getter],
108
+ by: [Getter],
109
+ madeAt: 2024-05-24T20:46:44.481Z,
110
+ tx: {
111
+ sessionID: 'co_zNCLRSU2cPfqfz9aEAA1vL2JsF5_session_zSWSUsvvX8KW',
112
+ txIndex: 0
113
+ }
114
+ }
115
+ subscribedStream[me.id]?.value?.[me.id]?.value {
116
+ id: 'co_zhX5ZcvxQW4w2LJ99rBQ6NmBziS',
117
+ _type: 'CoStream',
118
+ co_zNCLRSU2cPfqfz9aEAA1vL2JsF5: 'jam',
119
+ in: { co_zNCLRSU2cPfqfz9aEAA1vL2JsF5_session_zSWSUsvvX8KW: 'jam' }
120
+ }
121
+ subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value jam
122
+
123
+ ✓ src/tests/coStream.test.ts (10 tests) 181ms
124
+ ✓ src/tests/coMap.test.ts (11 tests) 203ms
125
+ stdout | src/tests/coMap.test.ts > CoMap resolution > Subscription & auto-resolution
126
+ subscribedMap.nested?.twiceNested?.taste undefined
127
+ subscribedMap.nested?.twiceNested?.taste undefined
128
+ subscribedMap.nested?.twiceNested?.taste sour
129
+ subscribedMap.nested?.twiceNested?.taste sour
130
+ subscribedMap.nested?.twiceNested?.taste sweet
131
+ subscribedMap.nested?.twiceNested?.taste sweet
132
+ subscribedMap.nested?.twiceNested?.taste salty
133
+ subscribedMap.nested?.twiceNested?.taste umami
134
+
135
+
136
+ Test Files 5 passed (5)
137
+ Tests 35 passed (35)
138
+ Start at 21:46:43
139
+ Duration 805ms (transform 212ms, setup 0ms, collect 2.19s, tests 671ms, environment 0ms, prepare 225ms)
140
+
package/CHANGELOG.md CHANGED
@@ -1,5 +1,257 @@
1
1
  # jazz-autosub
2
2
 
3
+ ## 0.7.0-alpha.42
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed bug with newRandomSessionID being called before crypto was ready
8
+ - Updated dependencies
9
+ - cojson@0.7.0-alpha.42
10
+ - cojson-transport-nodejs-ws@0.7.0-alpha.42
11
+
12
+ ## 0.7.0-alpha.41
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+ - cojson-transport-nodejs-ws@0.7.0-alpha.41
18
+
19
+ ## 0.7.0-alpha.39
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+ - cojson@0.7.0-alpha.39
25
+ - cojson-transport-nodejs-ws@0.7.0-alpha.39
26
+
27
+ ## 0.7.0-alpha.38
28
+
29
+ ### Patch Changes
30
+
31
+ - Fix infinite recursion in subscriptionScope
32
+ - Fix type of init param for CoMap.create
33
+ - Implement deep loading, simplify API
34
+ - Updated dependencies
35
+ - cojson@0.7.0-alpha.38
36
+ - cojson-transport-nodejs-ws@0.7.0-alpha.38
37
+
38
+ ## 0.7.0-alpha.37
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies
43
+ - cojson@0.7.0-alpha.37
44
+ - cojson-transport-nodejs-ws@0.7.0-alpha.37
45
+
46
+ ## 0.7.0-alpha.36
47
+
48
+ ### Patch Changes
49
+
50
+ - 1a35307: Implement first devtools formatters
51
+ - 6b0418f: Fix image resolution loading
52
+ - 1a35307: Add ability to declare minimum required data in subscribe & Improve property access tracing
53
+ - Updated dependencies [1a35307]
54
+ - Updated dependencies [1a35307]
55
+ - cojson@0.7.0-alpha.36
56
+ - cojson-transport-nodejs-ws@0.7.0-alpha.36
57
+
58
+ ## 0.7.0-alpha.35
59
+
60
+ ### Patch Changes
61
+
62
+ - Cache CoValue proxies
63
+ - Updated dependencies
64
+ - cojson@0.7.0-alpha.35
65
+ - cojson-transport-nodejs-ws@0.7.0-alpha.35
66
+
67
+ ## 0.7.0-alpha.34
68
+
69
+ ### Patch Changes
70
+
71
+ - Extract jazz cli into jazz-run package
72
+
73
+ ## 0.7.0-alpha.32
74
+
75
+ ### Patch Changes
76
+
77
+ - Introduce jazz-tools CLI
78
+ - Clean up exports
79
+
80
+ ## 0.7.0-alpha.31
81
+
82
+ ### Patch Changes
83
+
84
+ - Get rid of self generics, new create syntax
85
+
86
+ ## 0.7.0-alpha.30
87
+
88
+ ### Patch Changes
89
+
90
+ - CoValue casting & auto-subbing \_owner
91
+
92
+ ## 0.7.0-alpha.29
93
+
94
+ ### Patch Changes
95
+
96
+ - Reintroduce changes from main
97
+ - Updated dependencies
98
+ - cojson@0.7.0-alpha.29
99
+
100
+ ## 0.7.0-alpha.28
101
+
102
+ ### Patch Changes
103
+
104
+ - Implement profile visibility based on groups & new migration signature
105
+ - Updated dependencies
106
+ - cojson@0.7.0-alpha.28
107
+
108
+ ## 0.7.0-alpha.27
109
+
110
+ ### Patch Changes
111
+
112
+ - Fix CoList.splice / RawCoList.append
113
+ - Fix Costream[...].all
114
+ - Updated dependencies
115
+ - cojson@0.7.0-alpha.27
116
+
117
+ ## 0.7.0-alpha.26
118
+
119
+ ### Patch Changes
120
+
121
+ - Fix CoMap.Record.toJSON()
122
+
123
+ ## 0.7.0-alpha.25
124
+
125
+ ### Patch Changes
126
+
127
+ - Make Account -> Profile a lazy ref schema
128
+
129
+ ## 0.7.0-alpha.24
130
+
131
+ ### Patch Changes
132
+
133
+ - Relax types of CoMap.\_schema
134
+ - Fix schema of Account & Group
135
+ - Make sure delete on CoMaps deletes keys
136
+ - Updated dependencies
137
+ - cojson@0.7.0-alpha.24
138
+
139
+ ## 0.7.0-alpha.23
140
+
141
+ ### Patch Changes
142
+
143
+ - CoMap fixes and improvements
144
+
145
+ ## 0.7.0-alpha.22
146
+
147
+ ### Patch Changes
148
+
149
+ - Fix CoMap \_refs for co.items
150
+
151
+ ## 0.7.0-alpha.21
152
+
153
+ ### Patch Changes
154
+
155
+ - Add maxWidth option for loading images
156
+
157
+ ## 0.7.0-alpha.20
158
+
159
+ ### Patch Changes
160
+
161
+ - Make fast-check a direct dependency to help dev time resolution
162
+
163
+ ## 0.7.0-alpha.19
164
+
165
+ ### Patch Changes
166
+
167
+ - More precise imports from @effect/schema
168
+
169
+ ## 0.7.0-alpha.17
170
+
171
+ ### Patch Changes
172
+
173
+ - Use effect 3.0
174
+
175
+ ## 0.7.0-alpha.16
176
+
177
+ ### Patch Changes
178
+
179
+ - Make CoMaps even more subclassable
180
+
181
+ ## 0.7.0-alpha.15
182
+
183
+ ### Patch Changes
184
+
185
+ - More superclass-compatible CoMaps
186
+
187
+ ## 0.7.0-alpha.14
188
+
189
+ ### Patch Changes
190
+
191
+ - Fix CoStream types
192
+
193
+ ## 0.7.0-alpha.13
194
+
195
+ ### Patch Changes
196
+
197
+ - Add .all to CoStreamEntry
198
+
199
+ ## 0.7.0-alpha.12
200
+
201
+ ### Patch Changes
202
+
203
+ - Fix variance of ID.\_\_type
204
+
205
+ ## 0.7.0-alpha.11
206
+
207
+ ### Patch Changes
208
+
209
+ - Support stricter TS lint rules
210
+ - Updated dependencies
211
+ - cojson@0.7.0-alpha.11
212
+
213
+ ## 0.7.0-alpha.10
214
+
215
+ ### Patch Changes
216
+
217
+ - Clean up API more & re-add jazz-nodejs
218
+ - Updated dependencies
219
+ - cojson@0.7.0-alpha.10
220
+
221
+ ## 0.7.0-alpha.9
222
+
223
+ ### Patch Changes
224
+
225
+ - Even friendlier for subclassing CoMap
226
+
227
+ ## 0.7.0-alpha.8
228
+
229
+ ### Patch Changes
230
+
231
+ - More subclass-friendly types in CoMap
232
+
233
+ ## 0.7.0-alpha.7
234
+
235
+ ### Patch Changes
236
+
237
+ - Consistent proxy based API
238
+ - Updated dependencies
239
+ - cojson@0.7.0-alpha.7
240
+
241
+ ## 0.7.0-alpha.6
242
+
243
+ ### Patch Changes
244
+
245
+ - CoMap fix
246
+
247
+ ## 0.7.0-alpha.5
248
+
249
+ ### Patch Changes
250
+
251
+ - Refactoring
252
+ - Updated dependencies
253
+ - cojson@0.7.0-alpha.5
254
+
3
255
  ## 0.7.0-alpha.4
4
256
 
5
257
  ### Patch Changes
package/README.md CHANGED
@@ -1,3 +1,11 @@
1
- # CoJSON
1
+ # `jazz-tools`
2
2
 
3
- [See the top-level README](../../README.md#cojson)
3
+ The base implementation for Jazz (see [jazz.tools](https://jazz.tools)), a framework for distributed state.
4
+
5
+ Provides a high-level API around the CoJSON protocol.
6
+
7
+ ## Environments and bindings
8
+
9
+ - `jazz-browser` (Vanilla JavaScript)
10
+ - `jazz-react` (React apps)
11
+ - `jazz-nodejs` (NodeJS or Bun server workers)