jazz-tools 0.7.0-alpha.8 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +3 -10
- package/.prettierrc.js +9 -0
- package/.turbo/turbo-build.log +3 -19
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +140 -0
- package/CHANGELOG.md +304 -0
- package/README.md +10 -2
- package/dist/coValues/account.js +59 -41
- package/dist/coValues/account.js.map +1 -1
- package/dist/coValues/coList.js +49 -46
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.js +143 -44
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.js +144 -35
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/coValues/deepLoading.js +60 -0
- package/dist/coValues/deepLoading.js.map +1 -0
- package/dist/coValues/extensions/imageDef.js +10 -7
- package/dist/coValues/extensions/imageDef.js.map +1 -1
- package/dist/coValues/group.js +49 -13
- package/dist/coValues/group.js.map +1 -1
- package/dist/coValues/interfaces.js +70 -31
- package/dist/coValues/interfaces.js.map +1 -1
- package/dist/implementation/devtoolsFormatters.js +114 -0
- package/dist/implementation/devtoolsFormatters.js.map +1 -0
- package/dist/implementation/refs.js +58 -18
- package/dist/implementation/refs.js.map +1 -1
- package/dist/implementation/schema.js +58 -0
- package/dist/implementation/schema.js.map +1 -0
- package/dist/implementation/subscriptionScope.js +19 -1
- package/dist/implementation/subscriptionScope.js.map +1 -1
- package/dist/implementation/symbols.js +5 -0
- package/dist/implementation/symbols.js.map +1 -0
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/dist/internal.js +5 -2
- package/dist/internal.js.map +1 -1
- package/dist/tests/coList.test.js +51 -48
- package/dist/tests/coList.test.js.map +1 -1
- package/dist/tests/coMap.test.js +131 -73
- package/dist/tests/coMap.test.js.map +1 -1
- package/dist/tests/coStream.test.js +56 -41
- package/dist/tests/coStream.test.js.map +1 -1
- package/dist/tests/deepLoading.test.js +188 -0
- package/dist/tests/deepLoading.test.js.map +1 -0
- package/dist/tests/groupsAndAccounts.test.js +83 -0
- package/dist/tests/groupsAndAccounts.test.js.map +1 -0
- package/package.json +17 -9
- package/src/coValues/account.ts +113 -125
- package/src/coValues/coList.ts +87 -103
- package/src/coValues/coMap.ts +200 -147
- package/src/coValues/coStream.ts +264 -80
- package/src/coValues/deepLoading.ts +229 -0
- package/src/coValues/extensions/imageDef.ts +17 -13
- package/src/coValues/group.ts +92 -58
- package/src/coValues/interfaces.ts +215 -115
- package/src/implementation/devtoolsFormatters.ts +110 -0
- package/src/implementation/inspect.ts +1 -1
- package/src/implementation/refs.ts +80 -28
- package/src/implementation/schema.ts +138 -0
- package/src/implementation/subscriptionScope.ts +48 -12
- package/src/implementation/symbols.ts +11 -0
- package/src/index.ts +12 -8
- package/src/internal.ts +7 -3
- package/src/tests/coList.test.ts +77 -62
- package/src/tests/coMap.test.ts +201 -113
- package/src/tests/coStream.test.ts +113 -84
- package/src/tests/deepLoading.test.ts +301 -0
- package/src/tests/groupsAndAccounts.test.ts +91 -0
- package/dist/implementation/encoding.js +0 -26
- package/dist/implementation/encoding.js.map +0 -1
- package/src/implementation/encoding.ts +0 -105
package/dist/coValues/coMap.js
CHANGED
@@ -1,48 +1,107 @@
|
|
1
1
|
var _a;
|
2
|
-
import {
|
3
|
-
import { Account, CoValueBase, Ref, SchemaInit, inspect, makeRefs, subscriptionsScopes, ItemsSym, InitValues, } from "../internal.js";
|
2
|
+
import { encodeSync, decodeSync } from "@effect/schema/Schema";
|
3
|
+
import { Account, CoValueBase, Ref, SchemaInit, inspect, makeRefs, subscriptionsScopes, ItemsSym, InitValues, isRefEncoded, } from "../internal.js";
|
4
|
+
/**
|
5
|
+
* CoMaps are collaborative versions of plain objects, mapping string-like keys to values.
|
6
|
+
*
|
7
|
+
* @categoryDescription Declaration
|
8
|
+
* Declare your own CoMap schemas by subclassing `CoMap` and assigning field schemas with `co`.
|
9
|
+
*
|
10
|
+
* ```ts
|
11
|
+
* import { co, CoMap } from "jazz-tools";
|
12
|
+
*
|
13
|
+
* class Person extends CoMap {
|
14
|
+
* name = co.string;
|
15
|
+
* age = co.number;
|
16
|
+
* pet = co.ref(Animal);
|
17
|
+
* }
|
18
|
+
* ```
|
19
|
+
*
|
20
|
+
* @categoryDescription Content
|
21
|
+
* You can access properties you declare on a `CoMap` (using `co`) as if they were normal properties on a plain object, using dot notation, `Object.keys()`, etc.
|
22
|
+
*
|
23
|
+
* ```ts
|
24
|
+
* person.name;
|
25
|
+
* person["age"];
|
26
|
+
* person.age = 42;
|
27
|
+
* person.pet?.name;
|
28
|
+
* Object.keys(person);
|
29
|
+
* // => ["name", "age", "pet"]
|
30
|
+
* ```
|
31
|
+
*
|
32
|
+
* @category CoValues
|
33
|
+
* */
|
4
34
|
export class CoMap extends CoValueBase {
|
5
|
-
|
6
|
-
|
35
|
+
/** @internal */
|
36
|
+
get _schema() {
|
37
|
+
return this.constructor._schema;
|
7
38
|
}
|
39
|
+
/**
|
40
|
+
* If property `prop` is a `co.ref(...)`, you can use `coMaps._refs.prop` to access
|
41
|
+
* the `Ref` instead of the potentially loaded/null value.
|
42
|
+
* This allows you to always get the ID or load the value manually.
|
43
|
+
*
|
44
|
+
* @example
|
45
|
+
* ```ts
|
46
|
+
* person._refs.pet.id; // => ID<Animal>
|
47
|
+
* person._refs.pet.value;
|
48
|
+
* // => Animal | undefined
|
49
|
+
* const pet = await person._refs.pet.load();
|
50
|
+
* ```
|
51
|
+
*
|
52
|
+
* @category Content */
|
8
53
|
get _refs() {
|
9
|
-
return makeRefs((key) => this._raw.get(key), () =>
|
10
|
-
const
|
11
|
-
|
12
|
-
|
54
|
+
return makeRefs((key) => this._raw.get(key), () => {
|
55
|
+
const keys = this._raw.keys().filter((key) => {
|
56
|
+
const schema = this._schema[key] ||
|
57
|
+
this._schema[ItemsSym];
|
58
|
+
return schema && schema !== "json" && isRefEncoded(schema);
|
59
|
+
});
|
60
|
+
return keys;
|
61
|
+
}, this._loadedAs, (key) => (this._schema[key] ||
|
62
|
+
this._schema[ItemsSym]));
|
13
63
|
}
|
64
|
+
/** @category Collaboration */
|
14
65
|
get _edits() {
|
15
66
|
return new Proxy(this, {
|
16
67
|
get(target, key) {
|
17
68
|
const rawEdit = target._raw.lastEditAt(key);
|
18
69
|
if (!rawEdit)
|
19
70
|
return undefined;
|
20
|
-
const descriptor = target.
|
71
|
+
const descriptor = target._schema[key];
|
21
72
|
return {
|
22
73
|
value: descriptor === "json"
|
23
74
|
? rawEdit.value
|
24
75
|
: "encoded" in descriptor
|
25
|
-
?
|
26
|
-
: new Ref(rawEdit.value, target._loadedAs, descriptor).accessFrom(target),
|
27
|
-
ref: descriptor !== "json" &&
|
76
|
+
? decodeSync(descriptor.encoded)(rawEdit.value)
|
77
|
+
: new Ref(rawEdit.value, target._loadedAs, descriptor).accessFrom(target, "_edits." + key.toString() + ".value"),
|
78
|
+
ref: descriptor !== "json" && isRefEncoded(descriptor)
|
28
79
|
? new Ref(rawEdit.value, target._loadedAs, descriptor)
|
29
80
|
: undefined,
|
30
81
|
by: rawEdit.by &&
|
31
82
|
new Ref(rawEdit.by, target._loadedAs, {
|
32
|
-
ref:
|
33
|
-
|
83
|
+
ref: Account,
|
84
|
+
optional: false,
|
85
|
+
}).accessFrom(target, "_edits." + key.toString() + ".by"),
|
34
86
|
madeAt: rawEdit.at,
|
35
87
|
};
|
36
88
|
},
|
37
89
|
});
|
38
90
|
}
|
91
|
+
/** @internal */
|
39
92
|
get _loadedAs() {
|
40
93
|
return Account.fromNode(this._raw.core.node);
|
41
94
|
}
|
42
|
-
|
95
|
+
/** @internal */
|
96
|
+
constructor(
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
98
|
+
options) {
|
43
99
|
super();
|
44
|
-
if (
|
45
|
-
this[InitValues] = {
|
100
|
+
if ("owner" in options) {
|
101
|
+
this[InitValues] = {
|
102
|
+
init: options.init,
|
103
|
+
owner: options.owner,
|
104
|
+
};
|
46
105
|
}
|
47
106
|
else if ("fromRaw" in options) {
|
48
107
|
Object.defineProperties(this, {
|
@@ -58,14 +117,20 @@ export class CoMap extends CoValueBase {
|
|
58
117
|
}
|
59
118
|
return new Proxy(this, CoMapProxyHandler);
|
60
119
|
}
|
120
|
+
/** @category Creation */
|
121
|
+
static create(init, options) {
|
122
|
+
return new this({ init, owner: options.owner });
|
123
|
+
}
|
61
124
|
toJSON() {
|
62
125
|
const jsonedFields = this._raw.keys().map((key) => {
|
63
126
|
const tKey = key;
|
64
|
-
const descriptor = this.
|
127
|
+
const descriptor = (this._schema[tKey] ||
|
128
|
+
this._schema[ItemsSym]);
|
65
129
|
if (descriptor == "json" || "encode" in descriptor) {
|
66
130
|
return [key, this._raw.get(key)];
|
67
131
|
}
|
68
|
-
else if (
|
132
|
+
else if (isRefEncoded(descriptor)) {
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
69
134
|
const jsonedRef = this[tKey]?.toJSON();
|
70
135
|
return [key, jsonedRef];
|
71
136
|
}
|
@@ -82,27 +147,44 @@ export class CoMap extends CoValueBase {
|
|
82
147
|
[inspect]() {
|
83
148
|
return this.toJSON();
|
84
149
|
}
|
150
|
+
/** @internal */
|
151
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
85
152
|
rawFromInit(init, owner) {
|
86
153
|
const rawOwner = owner._raw;
|
87
154
|
const rawInit = {};
|
88
155
|
if (init)
|
89
156
|
for (const key of Object.keys(init)) {
|
90
157
|
const initValue = init[key];
|
91
|
-
const descriptor = (this.
|
158
|
+
const descriptor = (this._schema[key] || this._schema[ItemsSym]);
|
92
159
|
if (descriptor === "json") {
|
93
160
|
rawInit[key] = initValue;
|
94
161
|
}
|
95
|
-
else if (
|
162
|
+
else if (isRefEncoded(descriptor)) {
|
96
163
|
if (initValue) {
|
97
164
|
rawInit[key] = initValue.id;
|
98
165
|
}
|
99
166
|
}
|
100
167
|
else if ("encoded" in descriptor) {
|
101
|
-
rawInit[key] =
|
168
|
+
rawInit[key] = encodeSync(descriptor.encoded)(
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
170
|
+
initValue);
|
102
171
|
}
|
103
172
|
}
|
104
173
|
return rawOwner.createMap(rawInit);
|
105
174
|
}
|
175
|
+
/** @category Declaration */
|
176
|
+
static Record(value) {
|
177
|
+
var _b;
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
179
|
+
class RecordLikeCoMap extends _a {
|
180
|
+
constructor() {
|
181
|
+
super(...arguments);
|
182
|
+
this[_b] = value;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
_b = ItemsSym;
|
186
|
+
return RecordLikeCoMap;
|
187
|
+
}
|
106
188
|
}
|
107
189
|
_a = CoMap;
|
108
190
|
(() => {
|
@@ -110,8 +192,10 @@ _a = CoMap;
|
|
110
192
|
})();
|
111
193
|
function tryInit(map) {
|
112
194
|
if (map[InitValues] &&
|
113
|
-
(map.
|
114
|
-
Object.keys(map[InitValues].init).every(
|
195
|
+
(map._schema[ItemsSym] ||
|
196
|
+
Object.keys(map[InitValues].init).every(
|
197
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
198
|
+
(key) => map._schema[key]))) {
|
115
199
|
const raw = map.rawFromInit(map[InitValues].init, map[InitValues].owner);
|
116
200
|
Object.defineProperties(map, {
|
117
201
|
id: {
|
@@ -126,14 +210,15 @@ function tryInit(map) {
|
|
126
210
|
// TODO: cache handlers per descriptor for performance?
|
127
211
|
const CoMapProxyHandler = {
|
128
212
|
get(target, key, receiver) {
|
129
|
-
if (key === "
|
213
|
+
if (key === "_schema") {
|
130
214
|
return Reflect.get(target, key);
|
131
215
|
}
|
132
216
|
else if (key in target) {
|
133
217
|
return Reflect.get(target, key, receiver);
|
134
218
|
}
|
135
219
|
else {
|
136
|
-
const descriptor = (target.
|
220
|
+
const descriptor = (target._schema[key] ||
|
221
|
+
target._schema[ItemsSym]);
|
137
222
|
if (descriptor && typeof key === "string") {
|
138
223
|
const raw = target._raw.get(key);
|
139
224
|
if (descriptor === "json") {
|
@@ -142,12 +227,12 @@ const CoMapProxyHandler = {
|
|
142
227
|
else if ("encoded" in descriptor) {
|
143
228
|
return raw === undefined
|
144
229
|
? undefined
|
145
|
-
:
|
230
|
+
: decodeSync(descriptor.encoded)(raw);
|
146
231
|
}
|
147
|
-
else if (
|
232
|
+
else if (isRefEncoded(descriptor)) {
|
148
233
|
return raw === undefined
|
149
234
|
? undefined
|
150
|
-
: new Ref(raw, target._loadedAs, descriptor).accessFrom(receiver);
|
235
|
+
: new Ref(raw, target._loadedAs, descriptor).accessFrom(receiver, key);
|
151
236
|
}
|
152
237
|
}
|
153
238
|
else {
|
@@ -160,24 +245,26 @@ const CoMapProxyHandler = {
|
|
160
245
|
if ((typeof key === "string" || ItemsSym) &&
|
161
246
|
typeof value === "object" &&
|
162
247
|
SchemaInit in value) {
|
163
|
-
(_b = target.constructor).
|
164
|
-
target.constructor.
|
248
|
+
(_b = target.constructor)._schema || (_b._schema = {});
|
249
|
+
target.constructor._schema[key] =
|
165
250
|
value[SchemaInit];
|
166
251
|
tryInit(target);
|
167
252
|
return true;
|
168
253
|
}
|
169
|
-
const descriptor = (target.
|
170
|
-
target.
|
254
|
+
const descriptor = (target._schema[key] ||
|
255
|
+
target._schema[ItemsSym]);
|
171
256
|
if (descriptor && typeof key === "string") {
|
172
257
|
if (descriptor === "json") {
|
173
258
|
target._raw.set(key, value);
|
174
259
|
}
|
175
260
|
else if ("encoded" in descriptor) {
|
176
|
-
target._raw.set(key,
|
261
|
+
target._raw.set(key, encodeSync(descriptor.encoded)(value));
|
177
262
|
}
|
178
|
-
else if (
|
263
|
+
else if (isRefEncoded(descriptor)) {
|
179
264
|
target._raw.set(key, value.id);
|
180
|
-
subscriptionsScopes
|
265
|
+
subscriptionsScopes
|
266
|
+
.get(target)
|
267
|
+
?.onRefAccessedOrSet(target.id, value.id);
|
181
268
|
}
|
182
269
|
return true;
|
183
270
|
}
|
@@ -190,8 +277,8 @@ const CoMapProxyHandler = {
|
|
190
277
|
if ("value" in attributes &&
|
191
278
|
typeof attributes.value === "object" &&
|
192
279
|
SchemaInit in attributes.value) {
|
193
|
-
(_b = target.constructor).
|
194
|
-
target.constructor.
|
280
|
+
(_b = target.constructor)._schema || (_b._schema = {});
|
281
|
+
target.constructor._schema[key] =
|
195
282
|
attributes.value[SchemaInit];
|
196
283
|
tryInit(target);
|
197
284
|
return true;
|
@@ -202,11 +289,11 @@ const CoMapProxyHandler = {
|
|
202
289
|
},
|
203
290
|
ownKeys(target) {
|
204
291
|
const keys = Reflect.ownKeys(target).filter((k) => k !== ItemsSym);
|
205
|
-
for (const key of Reflect.ownKeys(target.
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
}
|
292
|
+
// for (const key of Reflect.ownKeys(target._schema)) {
|
293
|
+
// if (key !== ItemsSym && !keys.includes(key)) {
|
294
|
+
// keys.push(key);
|
295
|
+
// }
|
296
|
+
// }
|
210
297
|
for (const key of target._raw.keys()) {
|
211
298
|
if (!keys.includes(key)) {
|
212
299
|
keys.push(key);
|
@@ -219,7 +306,8 @@ const CoMapProxyHandler = {
|
|
219
306
|
return Reflect.getOwnPropertyDescriptor(target, key);
|
220
307
|
}
|
221
308
|
else {
|
222
|
-
const descriptor = (target.
|
309
|
+
const descriptor = (target._schema[key] ||
|
310
|
+
target._schema[ItemsSym]);
|
223
311
|
if (descriptor || key in target._raw.ops) {
|
224
312
|
return {
|
225
313
|
enumerable: true,
|
@@ -229,5 +317,16 @@ const CoMapProxyHandler = {
|
|
229
317
|
}
|
230
318
|
}
|
231
319
|
},
|
320
|
+
deleteProperty(target, key) {
|
321
|
+
const descriptor = (target._schema[key] ||
|
322
|
+
target._schema[ItemsSym]);
|
323
|
+
if (typeof key === "string" && descriptor) {
|
324
|
+
target._raw.delete(key);
|
325
|
+
return true;
|
326
|
+
}
|
327
|
+
else {
|
328
|
+
return Reflect.deleteProperty(target, key);
|
329
|
+
}
|
330
|
+
},
|
232
331
|
};
|
233
332
|
//# sourceMappingURL=coMap.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coMap.js","sourceRoot":"","sources":["../../src/coValues/coMap.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"coMap.js","sourceRoot":"","sources":["../../src/coValues/coMap.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAW/D,OAAO,EACH,OAAO,EACP,WAAW,EACX,GAAG,EACH,UAAU,EACV,OAAO,EACP,QAAQ,EACR,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,YAAY,GACf,MAAM,gBAAgB,CAAC;AAcxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6BM;AACN,MAAM,OAAO,KAAM,SAAQ,WAAW;IAgBlC,gBAAgB;IAChB,IAAI,OAAO;QACP,OAAQ,IAAI,CAAC,WAA4B,CAAC,OAEf,CAAC;IAChC,CAAC;IAED;;;;;;;;;;;;;2BAauB;IACvB,IAAI,KAAK;QAGL,OAAO,QAAQ,CACX,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAa,CAA2B,EAC/D,GAAG,EAAE;YACD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;gBACzC,MAAM,MAAM,GACR,IAAI,CAAC,OAAO,CAAC,GAAgC,CAAC;oBAC7C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAwB,CAAC;gBACnD,OAAO,MAAM,IAAI,MAAM,KAAK,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;YAC/D,CAAC,CAAmB,CAAC;YAErB,OAAO,IAAI,CAAC;QAChB,CAAC,EACD,IAAI,CAAC,SAAS,EACd,CAAC,GAAG,EAAE,EAAE,CACJ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;YACd,IAAI,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