jazz-tools 0.7.0-alpha.1 → 0.7.0-alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/dist/coValues/account.js +7 -7
- package/dist/coValues/account.js.map +1 -1
- package/dist/coValues/coList.js +8 -8
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.js +15 -15
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.js +8 -8
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/coValues/extensions/imageDef.js +6 -11
- package/dist/coValues/extensions/imageDef.js.map +1 -1
- package/dist/coValues/group.js +13 -16
- package/dist/coValues/group.js.map +1 -1
- package/dist/implementation/refs.js +5 -4
- package/dist/implementation/refs.js.map +1 -1
- package/dist/index.js +0 -16
- package/dist/index.js.map +1 -1
- package/dist/tests/coList.test.js +5 -5
- package/dist/tests/coList.test.js.map +1 -1
- package/dist/tests/coMap.test.js +31 -48
- package/dist/tests/coMap.test.js.map +1 -1
- package/dist/tests/coStream.test.js +10 -10
- package/dist/tests/coStream.test.js.map +1 -1
- package/package.json +1 -1
- package/src/coValues/account.ts +11 -11
- package/src/coValues/coList.ts +10 -10
- package/src/coValues/coMap.ts +22 -22
- package/src/coValues/coStream.ts +10 -10
- package/src/coValues/extensions/imageDef.ts +14 -13
- package/src/coValues/group.ts +15 -16
- package/src/implementation/refs.ts +33 -10
- package/src/index.ts +0 -17
- package/src/tests/coList.test.ts +5 -5
- package/src/tests/coMap.test.ts +32 -46
- package/src/tests/coStream.test.ts +10 -10
package/CHANGELOG.md
CHANGED
package/dist/coValues/account.js
CHANGED
@@ -3,8 +3,8 @@ import { LocalNode } from "cojson";
|
|
3
3
|
import { Context } from "effect";
|
4
4
|
import { CoValueBase, Profile, ValueRef, inspect } from "../internal.js";
|
5
5
|
export class Account extends CoValueBase {
|
6
|
-
get
|
7
|
-
return this.constructor.
|
6
|
+
get _encoding() {
|
7
|
+
return this.constructor._encoding;
|
8
8
|
}
|
9
9
|
get _owner() {
|
10
10
|
return this;
|
@@ -18,9 +18,9 @@ export class Account extends CoValueBase {
|
|
18
18
|
const profileID = this._raw.get("profile");
|
19
19
|
const rootID = this._raw.get("root");
|
20
20
|
return {
|
21
|
-
profile: profileID && (new ValueRef(profileID, this._loadedAs, this.
|
21
|
+
profile: profileID && (new ValueRef(profileID, this._loadedAs, this._encoding.profile.ref())),
|
22
22
|
root: rootID &&
|
23
|
-
new ValueRef(rootID, this._loadedAs, this.
|
23
|
+
new ValueRef(rootID, this._loadedAs, this._encoding.root.ref()),
|
24
24
|
};
|
25
25
|
}
|
26
26
|
constructor(init, options) {
|
@@ -119,13 +119,13 @@ export class Account extends CoValueBase {
|
|
119
119
|
return this.toJSON();
|
120
120
|
}
|
121
121
|
static encoding(fields) {
|
122
|
-
this.
|
123
|
-
Object.assign(this.
|
122
|
+
this._encoding || (this._encoding = {});
|
123
|
+
Object.assign(this._encoding, fields);
|
124
124
|
}
|
125
125
|
}
|
126
126
|
_a = Account;
|
127
127
|
(() => {
|
128
|
-
_a.
|
128
|
+
_a._encoding = {
|
129
129
|
profile: { ref: () => Profile },
|
130
130
|
root: { json: true },
|
131
131
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/coValues/account.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAYnC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAYjC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzE,MAAM,OAAO,OAMT,SAAQ,WAAW;IAQnB,IAAI,
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/coValues/account.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAYnC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAYjC,OAA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, ValueRef, inspect, makeRefs, } from "../internal.js";
|
4
4
|
import { Schema } from "@effect/schema";
|
5
5
|
export class CoList extends Array {
|
6
|
-
get
|
7
|
-
return this.constructor.
|
6
|
+
get _encoding() {
|
7
|
+
return this.constructor._encoding;
|
8
8
|
}
|
9
9
|
get _owner() {
|
10
10
|
return this._raw.group instanceof RawAccount
|
@@ -12,7 +12,7 @@ export class CoList extends Array {
|
|
12
12
|
: Group.fromRaw(this._raw.group);
|
13
13
|
}
|
14
14
|
get _refs() {
|
15
|
-
return makeRefs((idx) => this._raw.get(idx), () => Array.from({ length: this._raw.entries().length }, (_, idx) => idx), this._loadedAs, (_idx) => this.
|
15
|
+
return makeRefs((idx) => this._raw.get(idx), () => Array.from({ length: this._raw.entries().length }, (_, idx) => idx), this._loadedAs, (_idx) => this._encoding._item.ref());
|
16
16
|
}
|
17
17
|
get _edits() {
|
18
18
|
throw new Error("Not implemented");
|
@@ -47,10 +47,10 @@ export class CoList extends Array {
|
|
47
47
|
},
|
48
48
|
_raw: { value: raw, enumerable: false },
|
49
49
|
});
|
50
|
-
return new Proxy(this, CoListProxyHandler(this.
|
50
|
+
return new Proxy(this, CoListProxyHandler(this._encoding._item));
|
51
51
|
}
|
52
52
|
toRawItems(items) {
|
53
|
-
const itemDescriptor = this.
|
53
|
+
const itemDescriptor = this._encoding._item;
|
54
54
|
const rawItems = itemDescriptor === "json"
|
55
55
|
? items
|
56
56
|
: "encoded" in itemDescriptor
|
@@ -97,7 +97,7 @@ export class CoList extends Array {
|
|
97
97
|
return deleted;
|
98
98
|
}
|
99
99
|
toJSON() {
|
100
|
-
const itemDescriptor = this.
|
100
|
+
const itemDescriptor = this._encoding._item;
|
101
101
|
if (itemDescriptor === "json") {
|
102
102
|
return this._raw.asArray();
|
103
103
|
}
|
@@ -120,8 +120,8 @@ export class CoList extends Array {
|
|
120
120
|
return new this(undefined, { fromRaw: raw });
|
121
121
|
}
|
122
122
|
static encoding(def) {
|
123
|
-
this.
|
124
|
-
Object.assign(this.
|
123
|
+
this._encoding || (this._encoding = {});
|
124
|
+
Object.assign(this._encoding, def);
|
125
125
|
}
|
126
126
|
}
|
127
127
|
_a = CoList;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../src/coValues/coList.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAapC,OAAO,EACH,OAAO,EACP,WAAW,EACX,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,MAAM,OAAO,MACT,SAAQ,KAAW;IAWnB,IAAI,
|
1
|
+
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../src/coValues/coList.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAapC,OAAO,EACH,OAAO,EACP,WAAW,EACX,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,MAAM,OAAO,MACT,SAAQ,KAAW;IAWnB,IAAI,SAAS;QAGT,OAAQ,IAAI,CAAC,WAA6B,CAAC,SAAS,CAAC;IACzD,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,YAAY,UAAU;YACxC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;YAClC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,KAAK;QAKL,OAAO,QAAQ,CACX,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAA2B,EACrD,GAAG,EAA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{ Schema } from "@effect/schema";
|
3
3
|
import { Account, CoValueBase, ValueRef, inspect, makeRefs, subscriptionsScopes, indexSignature, } from "../internal.js";
|
4
4
|
export class CoMap extends CoValueBase {
|
5
|
-
get
|
6
|
-
return this.constructor.
|
5
|
+
get _encoding() {
|
6
|
+
return this.constructor._encoding;
|
7
7
|
}
|
8
8
|
get _refs() {
|
9
|
-
return makeRefs((key) => this._raw.get(key), () => Object.keys(this.
|
10
|
-
const schema = this.
|
9
|
+
return makeRefs((key) => this._raw.get(key), () => Object.keys(this._encoding).filter((key) => {
|
10
|
+
const schema = this._encoding[key];
|
11
11
|
schema !== "json" && "ref" in schema;
|
12
|
-
}), this._loadedAs, (key) => this.
|
12
|
+
}), this._loadedAs, (key) => this._encoding[key].ref());
|
13
13
|
}
|
14
14
|
get _edits() {
|
15
15
|
return new Proxy(this, {
|
@@ -17,7 +17,7 @@ export class CoMap extends CoValueBase {
|
|
17
17
|
const rawEdit = target._raw.lastEditAt(key);
|
18
18
|
if (!rawEdit)
|
19
19
|
return undefined;
|
20
|
-
const descriptor = target.
|
20
|
+
const descriptor = target._encoding[key];
|
21
21
|
return {
|
22
22
|
value: descriptor === "json"
|
23
23
|
? rawEdit.value
|
@@ -39,7 +39,7 @@ export class CoMap extends CoValueBase {
|
|
39
39
|
}
|
40
40
|
constructor(init, options) {
|
41
41
|
super();
|
42
|
-
if (!this.
|
42
|
+
if (!this._encoding) {
|
43
43
|
throw new Error("No schema found in " +
|
44
44
|
this.constructor.name +
|
45
45
|
" - ensure that you have a `static { this.define({...}) }` block in the class definition.");
|
@@ -53,14 +53,14 @@ export class CoMap extends CoValueBase {
|
|
53
53
|
_raw: { value: raw, enumerable: false },
|
54
54
|
});
|
55
55
|
this.definePropertiesFromSchema();
|
56
|
-
if (this.
|
56
|
+
if (this._encoding[indexSignature]) {
|
57
57
|
return new Proxy(this, CoMapProxyHandler());
|
58
58
|
}
|
59
59
|
}
|
60
60
|
toJSON() {
|
61
61
|
const jsonedFields = this._raw.keys().map((key) => {
|
62
62
|
const tKey = key;
|
63
|
-
const descriptor = this.
|
63
|
+
const descriptor = this._encoding[tKey];
|
64
64
|
if (descriptor == "json" || "encode" in descriptor) {
|
65
65
|
return [key, this._raw.get(key)];
|
66
66
|
}
|
@@ -92,7 +92,7 @@ export class CoMap extends CoValueBase {
|
|
92
92
|
if (init)
|
93
93
|
for (const key of Object.keys(init)) {
|
94
94
|
const initValue = init[key];
|
95
|
-
const descriptor = (this.
|
95
|
+
const descriptor = (this._encoding[key] || this._encoding[indexSignature]);
|
96
96
|
if (descriptor === "json") {
|
97
97
|
rawInit[key] = initValue;
|
98
98
|
}
|
@@ -110,11 +110,11 @@ export class CoMap extends CoValueBase {
|
|
110
110
|
return raw;
|
111
111
|
}
|
112
112
|
static encoding(fields) {
|
113
|
-
this.
|
114
|
-
Object.assign(this.
|
113
|
+
this._encoding || (this._encoding = {});
|
114
|
+
Object.assign(this._encoding, fields);
|
115
115
|
}
|
116
116
|
definePropertiesFromSchema() {
|
117
|
-
for (const [key, fieldSchema] of Object.entries(this.
|
117
|
+
for (const [key, fieldSchema] of Object.entries(this._encoding)) {
|
118
118
|
if (key === "indexSignature")
|
119
119
|
continue;
|
120
120
|
const descriptor = fieldSchema;
|
@@ -181,7 +181,7 @@ _a = CoMap;
|
|
181
181
|
function CoMapProxyHandler() {
|
182
182
|
return {
|
183
183
|
get(target, key, receiver) {
|
184
|
-
const descriptor = target.
|
184
|
+
const descriptor = target._encoding[indexSignature];
|
185
185
|
if (key in target || typeof key === "symbol") {
|
186
186
|
return Reflect.get(target, key, receiver);
|
187
187
|
}
|
@@ -203,7 +203,7 @@ function CoMapProxyHandler() {
|
|
203
203
|
}
|
204
204
|
},
|
205
205
|
set(target, key, value, receiver) {
|
206
|
-
const descriptor = target.
|
206
|
+
const descriptor = target._encoding[indexSignature];
|
207
207
|
if (key in target || typeof key === "symbol") {
|
208
208
|
return Reflect.set(target, key, value, receiver);
|
209
209
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coMap.js","sourceRoot":"","sources":["../../src/coValues/coMap.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAYxC,OAAO,EACH,OAAO,EACP,WAAW,EACX,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,mBAAmB,EACnB,cAAc,GACjB,MAAM,gBAAgB,CAAC;AAuCxB,MAAM,OAAO,KACT,SAAQ,WAAW;IAWnB,IAAI,
|
1
|
+
{"version":3,"file":"coMap.js","sourceRoot":"","sources":["../../src/coValues/coMap.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAYxC,OAAO,EACH,OAAO,EACP,WAAW,EACX,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,mBAAmB,EACnB,cAAc,GACjB,MAAM,gBAAgB,CAAC;AAuCxB,MAAM,OAAO,KACT,SAAQ,WAAW;IAWnB,IAAI,SAAS;QAOT,OAAQ,IAAI,CAAC,WAA4B,CAAC,SAAS,CAAC;IACxD,CAAC;IAED,IAAI,KAAK;QAOL,OAAO,QAAQ,CACX,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAa,CAA2B,EAC/D,GAAG,EAAE,CACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;YACvC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CACzB,GAAkC,CAClB,CAAC;YACrB,MAAM,KAAK,MAAM,IAAI,KAAK,IAAI,MAAM,CAAC;QACzC,CAAC,CAAsB,EAC3B,IAAI,CAAC,SAAS,EACd,CAAC,GAAG,EAAE,EAAE,CAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAuB,CAAC,GAAG,EAAE,CACrD,CAAC;IACb,CAAC;IAED,IAAI,MAAM;QAQN,OAAO,IAAI,KAAK,CAA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GAAG,CAAC,CAAC;gBACnB,CAAC;YACL,CAAC;YAED,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,wBAAwB,CAAC,MAAM,EAAE,GAAG;YAChC,IAAI,GAAG,IAAI,MAAM,EAAE,CAAC;gBAChB,OAAO,OAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACzD,CAAC;iBAAM,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;gBAChC,OAAO;oBACH,UAAU,EAAE,IAAI;oBAChB,YAAY,EAAE,IAAI;oBAClB,QAAQ,EAAE,IAAI;iBACjB,CAAC;YACN,CAAC;QACL,CAAC;KACJ,CAAC;AACN,CAAC"}
|
@@ -3,8 +3,8 @@ import { cojsonInternals } from "cojson";
|
|
3
3
|
import { Account, CoValueBase, ValueRef, inspect } from "../internal.js";
|
4
4
|
import { Schema } from "@effect/schema";
|
5
5
|
export class CoStream extends CoValueBase {
|
6
|
-
get
|
7
|
-
return this.constructor.
|
6
|
+
get _encoding() {
|
7
|
+
return this.constructor._encoding;
|
8
8
|
}
|
9
9
|
get byMe() {
|
10
10
|
return this.by[this._loadedAs.id];
|
@@ -45,7 +45,7 @@ export class CoStream extends CoValueBase {
|
|
45
45
|
const rawEntry = this._raw.lastItemBy(accountID);
|
46
46
|
if (!rawEntry)
|
47
47
|
return;
|
48
|
-
return entryFromRawEntry(this, rawEntry, this._loadedAs, accountID, this.
|
48
|
+
return entryFromRawEntry(this, rawEntry, this._loadedAs, accountID, this._encoding._item);
|
49
49
|
},
|
50
50
|
configurable: true,
|
51
51
|
enumerable: true,
|
@@ -60,7 +60,7 @@ export class CoStream extends CoValueBase {
|
|
60
60
|
const by = cojsonInternals.accountOrAgentIDfromSessionID(sessionID);
|
61
61
|
return entryFromRawEntry(this, rawEntry, this._loadedAs, cojsonInternals.isAccountID(by)
|
62
62
|
? by
|
63
|
-
: undefined, this.
|
63
|
+
: undefined, this._encoding._item);
|
64
64
|
},
|
65
65
|
configurable: true,
|
66
66
|
enumerable: true,
|
@@ -74,7 +74,7 @@ export class CoStream extends CoValueBase {
|
|
74
74
|
this.updateEntries();
|
75
75
|
}
|
76
76
|
pushItem(item) {
|
77
|
-
const itemDescriptor = this.
|
77
|
+
const itemDescriptor = this._encoding._item;
|
78
78
|
if (itemDescriptor === "json") {
|
79
79
|
this._raw.push(item);
|
80
80
|
}
|
@@ -86,7 +86,7 @@ export class CoStream extends CoValueBase {
|
|
86
86
|
}
|
87
87
|
}
|
88
88
|
toJSON() {
|
89
|
-
const itemDescriptor = this.
|
89
|
+
const itemDescriptor = this._encoding._item;
|
90
90
|
const mapper = itemDescriptor === "json"
|
91
91
|
? (v) => v
|
92
92
|
: "encoded" in itemDescriptor
|
@@ -109,8 +109,8 @@ export class CoStream extends CoValueBase {
|
|
109
109
|
return this.toJSON();
|
110
110
|
}
|
111
111
|
static encoding(def) {
|
112
|
-
this.
|
113
|
-
Object.assign(this.
|
112
|
+
this._encoding || (this._encoding = {});
|
113
|
+
Object.assign(this._encoding, def);
|
114
114
|
}
|
115
115
|
}
|
116
116
|
_a = CoStream;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coStream.js","sourceRoot":"","sources":["../../src/coValues/coStream.ts"],"names":[],"mappings":";AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAUzC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAYxC,MAAM,OAAO,QACT,SAAQ,WAAW;IAanB,IAAI,
|
1
|
+
{"version":3,"file":"coStream.js","sourceRoot":"","sources":["../../src/coValues/coStream.ts"],"names":[],"mappings":";AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAUzC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAA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AiB,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,CAAC,IAAgB;QACjB,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,GAAG;QACC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;IAED,MAAM;QACF,OAAO;YACH,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,IAAI,CAAC,SAAS,EAAE;SACtB,CAAC;IACN,CAAC;IAED,CAAC,OAAO,CAAC;QACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;CACJ"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
import { BinaryCoStream, CoMap, indexSignature, subscriptionsScopes } from '../../internal.js';
|
1
|
+
import { BinaryCoStream, CoMap, indexSignature, subscriptionsScopes, } from "../../internal.js";
|
3
2
|
export class ImageDefinition extends CoMap {
|
4
3
|
get _highestResAvailable() {
|
5
4
|
if (!subscriptionsScopes.get(this)) {
|
@@ -29,13 +28,9 @@ export class ImageDefinition extends CoMap {
|
|
29
28
|
});
|
30
29
|
}
|
31
30
|
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
placeholderDataURL: "json",
|
38
|
-
[indexSignature]: { ref: () => BinaryCoStream },
|
39
|
-
});
|
40
|
-
})();
|
31
|
+
ImageDefinition.encoding({
|
32
|
+
originalSize: "json",
|
33
|
+
placeholderDataURL: "json",
|
34
|
+
[indexSignature]: { ref: () => BinaryCoStream },
|
35
|
+
});
|
41
36
|
//# sourceMappingURL=imageDef.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"imageDef.js","sourceRoot":"","sources":["../../../src/coValues/extensions/imageDef.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"imageDef.js","sourceRoot":"","sources":["../../../src/coValues/extensions/imageD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MAAM,EAAE,IAAI,CAAC,0BAA0B,CAAE;SAC5C,CACJ,CAAC;IACN,CAAC;CACJ;AACD,eAAe,CAAC,QAAQ,CAAC;IACrB,YAAY,EAAE,MAAM;IACpB,kBAAkB,EAAE,MAAM;IAC1B,CAAC,cAAc,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE;CAClD,CAAC,CAAC"}
|
package/dist/coValues/group.js
CHANGED
@@ -1,23 +1,20 @@
|
|
1
|
-
var _a
|
1
|
+
var _a;
|
2
2
|
import { Account, CoMap, CoValueBase, ValueRef, isControlledAccount, } from "../internal.js";
|
3
3
|
export class Profile extends CoMap {
|
4
4
|
}
|
5
|
-
|
6
|
-
(() => {
|
7
|
-
_a.encoding({ name: "json" });
|
8
|
-
})();
|
5
|
+
Profile.encoding({ name: "json" });
|
9
6
|
export class Group extends CoValueBase {
|
10
|
-
get
|
11
|
-
return this.constructor.
|
7
|
+
get _encoding() {
|
8
|
+
return this.constructor._encoding;
|
12
9
|
}
|
13
10
|
get _refs() {
|
14
11
|
const profileID = this._raw.get("profile");
|
15
12
|
const rootID = this._raw.get("root");
|
16
13
|
return {
|
17
14
|
profile: profileID &&
|
18
|
-
new ValueRef(profileID, this._loadedAs, this.
|
15
|
+
new ValueRef(profileID, this._loadedAs, this._encoding.profile.ref()),
|
19
16
|
root: rootID &&
|
20
|
-
new ValueRef(rootID, this._loadedAs, this.
|
17
|
+
new ValueRef(rootID, this._loadedAs, this._encoding.root.ref()),
|
21
18
|
};
|
22
19
|
}
|
23
20
|
constructor(init, options) {
|
@@ -76,21 +73,21 @@ export class Group extends CoValueBase {
|
|
76
73
|
this._raw.addMember(member === "everyone" ? member : member._raw, role);
|
77
74
|
}
|
78
75
|
static define(fields) {
|
79
|
-
this.
|
80
|
-
Object.assign(this.
|
76
|
+
this._encoding || (this._encoding = {});
|
77
|
+
Object.assign(this._encoding, fields);
|
81
78
|
}
|
82
79
|
}
|
83
|
-
|
80
|
+
_a = Group;
|
84
81
|
(() => {
|
85
|
-
|
82
|
+
_a.prototype._type = "Group";
|
86
83
|
})();
|
87
84
|
(() => {
|
88
|
-
|
85
|
+
_a._encoding = {
|
89
86
|
profile: { json: true },
|
90
87
|
root: { json: true },
|
91
88
|
};
|
92
|
-
Object.defineProperty(
|
93
|
-
get: () =>
|
89
|
+
Object.defineProperty(_a.prototype, "_encoding", {
|
90
|
+
get: () => _a._encoding,
|
94
91
|
});
|
95
92
|
})();
|
96
93
|
//# sourceMappingURL=group.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/coValues/group.ts"],"names":[],"mappings":";AAQA,OAAO,EACH,OAAO,EACP,KAAK,EACL,WAAW,EACX,QAAQ,EACR,mBAAmB,GACtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,OAAO,OAAQ,SAAQ,KAAuB;
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/coValues/group.ts"],"names":[],"mappings":";AAQA,OAAO,EACH,OAAO,EACP,KAAK,EACL,WAAW,EACX,QAAQ,EACR,mBAAmB,GACtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,OAAO,OAAQ,SAAQ,KAAuB;CAEnD;AACD,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAEnC,MAAM,OAAO,KAMT,SAAQ,WAAW;IAWnB,IAAI,SAAS;QAQT,OAAQ,IAAI,CAAC,WAA4B,CAAC,SAAS,CAAC;IACxD,CAAC;IAiBD,IAAI,KAAK;QAML,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAE1B,CAAC;QAChB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAEpB,CAAC;QAChB,OAAO;YACH,OAAO,EACH,SAAS;gBACR,IAAI,QAAQ,CACT,SAAS,EACT,IAAI,CAAC,SAAS,EAEV,I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;QACb,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;QACvB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;KAChB,CAAC;IACT,MAAM,CAAC,cAAc,CAAC,GAAK,SAAS,EAAE,WAAW,EAAE;QAC/C,GAAG,EAAE,GAAG,EAAE,CAAC,GAAK,SAAS;KAC5B,CAAC,CAAC;AACP,CAAC,GAAA,CAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Effect } from "effect";
|
2
|
-
import { subscriptionsScopes } from
|
2
|
+
import { subscriptionsScopes } from "../internal.js";
|
3
3
|
export class ValueRef {
|
4
4
|
constructor(id, controlledAccount, valueConstructor) {
|
5
5
|
this.id = id;
|
@@ -12,7 +12,9 @@ export class ValueRef {
|
|
12
12
|
// TODO: cache it for object identity!!!
|
13
13
|
const raw = this.controlledAccount._raw.core.node.getLoaded(this.id);
|
14
14
|
if (raw) {
|
15
|
-
const value = new this.valueConstructor(undefined, {
|
15
|
+
const value = new this.valueConstructor(undefined, {
|
16
|
+
fromRaw: raw,
|
17
|
+
});
|
16
18
|
this.cachedValue = value;
|
17
19
|
return value;
|
18
20
|
}
|
@@ -42,8 +44,7 @@ export class ValueRef {
|
|
42
44
|
return "unavailable";
|
43
45
|
}
|
44
46
|
else {
|
45
|
-
return new ValueRef(this.id, this.controlledAccount, this.valueConstructor)
|
46
|
-
.value;
|
47
|
+
return new ValueRef(this.id, this.controlledAccount, this.valueConstructor).value;
|
47
48
|
}
|
48
49
|
}
|
49
50
|
async load(options) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"refs.js","sourceRoot":"","sources":["../../src/implementation/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
1
|
+
{"version":3,"file":"refs.js","sourceRoot":"","sources":["../../src/implementation/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWhC,OA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CAAC,IAAI,EAAE;QACnB,GAAG,CAAC,MAAM,EAAE,GAAG;YACX,IAAI,GAAG,KAAK,MAAM,CAAC,QAAQ,EAAE,CAAC;gBAC1B,OAAO,QAAQ,CAAC;oBACZ,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,EAAE,CAAC;wBACjC,MAAM,IAAI,QAAQ,CACd,WAAW,CAAC,GAAG,CAAE,EACjB,iBAAiB,EACjB,sBAAsB,CAAC,GAAG,CAAC,CAC9B,CAAC;oBACN,CAAC;gBACL,CAAC,CAAC;YACN,CAAC;YACD,IAAI,OAAO,GAAG,KAAK,QAAQ;gBAAE,OAAO,SAAS,CAAC;YAC9C,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;gBACnB,OAAO,cAAc,EAAE,CAAC,MAAM,CAAC;YACnC,CAAC;YACD,MAAM,EAAE,GAAG,WAAW,CAAC,GAAW,CAAC,CAAC;YACpC,IAAI,CAAC,EAAE;gBAAE,OAAO,SAAS,CAAC;YAC1B,OAAO,IAAI,QAAQ,CACf,EAAiB,EACjB,iBAAiB,EACjB,sBAAsB,CAAC,GAAW,CAAC,CACtC,CAAC;QACN,CAAC;QACD,OAAO;YACH,OAAO,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QACzD,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.js
CHANGED
@@ -1,19 +1,3 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-namespace */
|
2
|
-
import { BinaryCoStream, CoMap, ImageDefinition, Account as Account_, Group as Group_, CoList, CoStream } from "./internal.js";
|
3
|
-
/** @category Schemas & CoValues - Schema definers */
|
4
|
-
export var Co;
|
5
|
-
(function (Co) {
|
6
|
-
Co.Map = CoMap;
|
7
|
-
Co.List = CoList;
|
8
|
-
Co.Stream = CoStream;
|
9
|
-
Co.BinaryStream = BinaryCoStream;
|
10
|
-
Co.Account = Account_;
|
11
|
-
Co.Group = Group_;
|
12
|
-
let media;
|
13
|
-
(function (media) {
|
14
|
-
media.ImageDef = ImageDefinition;
|
15
|
-
})(media = Co.media || (Co.media = {}));
|
16
|
-
})(Co || (Co = {}));
|
17
1
|
/** @category Internal types */
|
18
2
|
export { cojsonReady as jazzReady, cojsonInternals, MAX_RECOMMENDED_TX_SIZE, } from "cojson";
|
19
3
|
export { Encoders } from "./internal.js";
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EACH,WAAW,IAAI,SAAS,EAMxB,eAAe,EACf,uBAAuB,GAC1B,MAAM,QAAQ,CAAC;AAIhB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAM,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAgB,MAAM,eAAe,CAAC"}
|
@@ -3,7 +3,7 @@ import { webcrypto } from "node:crypto";
|
|
3
3
|
import { connectedPeers } from "cojson/src/streamUtils.js";
|
4
4
|
import { newRandomSessionID } from "cojson/src/coValueCore.js";
|
5
5
|
import { Effect, Queue } from "effect";
|
6
|
-
import {
|
6
|
+
import { Account, CoList, jazzReady } from "..";
|
7
7
|
if (!("crypto" in globalThis)) {
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
9
9
|
globalThis.crypto = webcrypto;
|
@@ -15,7 +15,7 @@ describe("Simple CoList operations", async () => {
|
|
15
15
|
const me = await Account.create({
|
16
16
|
name: "Hermes Puggington",
|
17
17
|
});
|
18
|
-
class TestList extends
|
18
|
+
class TestList extends CoList {
|
19
19
|
}
|
20
20
|
TestList.encoding({ _item: "json" });
|
21
21
|
const list = new TestList(["bread", "butter", "onion"], { owner: me });
|
@@ -102,16 +102,16 @@ describe("Simple CoList operations", async () => {
|
|
102
102
|
});
|
103
103
|
});
|
104
104
|
describe("CoList resolution", async () => {
|
105
|
-
class TwiceNestedList extends
|
105
|
+
class TwiceNestedList extends CoList {
|
106
106
|
joined() {
|
107
107
|
return this.join(",");
|
108
108
|
}
|
109
109
|
}
|
110
110
|
TwiceNestedList.encoding({ _item: "json" });
|
111
|
-
class NestedList extends
|
111
|
+
class NestedList extends CoList {
|
112
112
|
}
|
113
113
|
NestedList.encoding({ _item: { ref: () => TwiceNestedList } });
|
114
|
-
class TestList extends
|
114
|
+
class TestList extends CoList {
|
115
115
|
}
|
116
116
|
TestList.encoding({ _item: { ref: () => NestedList } });
|
117
117
|
const initNodeAndList = async () => {
|