jazz-tools 0.8.3 → 0.8.11
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +17 -0
- package/dist/native/coValues/interfaces.js +15 -0
- package/dist/native/coValues/interfaces.js.map +1 -1
- package/dist/native/exports.js +11 -0
- package/dist/native/exports.js.map +1 -0
- package/dist/native/implementation/refs.js +4 -4
- package/dist/native/implementation/refs.js.map +1 -1
- package/dist/native/implementation/schema.js +14 -9
- package/dist/native/implementation/schema.js.map +1 -1
- package/dist/native/implementation/subscriptionScope.js +8 -9
- package/dist/native/implementation/subscriptionScope.js.map +1 -1
- package/dist/native/index.native.js +1 -10
- package/dist/native/index.native.js.map +1 -1
- package/dist/web/coValues/interfaces.js +15 -0
- package/dist/web/coValues/interfaces.js.map +1 -1
- package/dist/web/exports.js +11 -0
- package/dist/web/exports.js.map +1 -0
- package/dist/web/implementation/refs.js +4 -4
- package/dist/web/implementation/refs.js.map +1 -1
- package/dist/web/implementation/schema.js +14 -9
- package/dist/web/implementation/schema.js.map +1 -1
- package/dist/web/implementation/subscriptionScope.js +8 -9
- package/dist/web/implementation/subscriptionScope.js.map +1 -1
- package/dist/web/index.web.js +1 -10
- package/dist/web/index.web.js.map +1 -1
- package/package.json +6 -6
- package/src/coValues/interfaces.ts +34 -0
- package/src/exports.ts +35 -0
- package/src/implementation/refs.ts +3 -8
- package/src/implementation/schema.ts +21 -13
- package/src/implementation/subscriptionScope.ts +10 -11
- package/src/index.native.ts +2 -35
- package/src/index.web.ts +2 -35
- package/src/tests/coMap.test.ts +1 -1
- package/src/tests/schema.test.ts +205 -0
- package/src/tests/subscribe.test.ts +348 -0
- package/.turbo/turbo-build.log +0 -8
- package/.turbo/turbo-lint.log +0 -4
- package/.turbo/turbo-test.log +0 -144
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# jazz-tools
|
2
2
|
|
3
|
+
## 0.8.11
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies [1ed4ab5]
|
8
|
+
- cojson@0.8.11
|
9
|
+
|
10
|
+
## 0.8.5
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- c3f4e6b: Fix order of exports fields in package.json
|
15
|
+
- d9152ed: Allow interface types as generic argument in co.json
|
16
|
+
- Updated dependencies [c3f4e6b]
|
17
|
+
- Updated dependencies [d9152ed]
|
18
|
+
- cojson@0.8.5
|
19
|
+
|
3
20
|
## 0.8.3
|
4
21
|
|
5
22
|
### Patch Changes
|
@@ -103,6 +103,21 @@ export function subscribeToCoValue(cls, id, as, depth, listener, onUnavailable)
|
|
103
103
|
unsubscribe && unsubscribe();
|
104
104
|
};
|
105
105
|
}
|
106
|
+
export function createCoValueObservable() {
|
107
|
+
let currentValue = undefined;
|
108
|
+
function subscribe(cls, id, as, depth, listener, onUnavailable) {
|
109
|
+
const unsubscribe = subscribeToCoValue(cls, id, as, depth, (value) => {
|
110
|
+
currentValue = value;
|
111
|
+
listener();
|
112
|
+
}, onUnavailable);
|
113
|
+
return unsubscribe;
|
114
|
+
}
|
115
|
+
const observable = {
|
116
|
+
getCurrentValue: () => currentValue,
|
117
|
+
subscribe,
|
118
|
+
};
|
119
|
+
return observable;
|
120
|
+
}
|
106
121
|
export function subscribeToExistingCoValue(existing, depth, listener) {
|
107
122
|
return subscribeToCoValue(existing.constructor, existing.id, existing._loadedAs, depth, listener);
|
108
123
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/coValues/interfaces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EACH,OAAO,EACP,KAAK,EACL,iBAAiB,EACjB,GAAG,EACH,OAAO,EACP,mBAAmB,EACnB,kBAAkB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAmCjD,8DAA8D;AAC9D,MAAM,UAAU,SAAS,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CAAC;AACtB,CAAC;AAED,MAAM,UAAU,0BAA0B,CACtC,QAAW,EACX,KAA0B,EAC1B,QAAiD;IAEjD,OAAO,kBAAkB,CACrB,QAAQ,CAAC,WAA8B,EACvC,QAAQ,CAAC,EAAE,EACX,QAAQ,CAAC,SAAS,EAClB,KAAK,EACL,QAAQ,CACX,CAAC;AACN,CAAC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export { Encoders, co } from "./internal.js";
|
2
|
+
export { CoMap } from "./internal.js";
|
3
|
+
export { CoList } from "./internal.js";
|
4
|
+
export { CoStream, BinaryCoStream } from "./internal.js";
|
5
|
+
export { Group, Profile } from "./internal.js";
|
6
|
+
export { Account, isControlledAccount } from "./internal.js";
|
7
|
+
export { ImageDefinition } from "./internal.js";
|
8
|
+
export { CoValueBase } from "./internal.js";
|
9
|
+
export { loadCoValue, subscribeToCoValue, createCoValueObservable } from "./internal.js";
|
10
|
+
export { createJazzContext, fixedCredentialsAuth, ephemeralCredentialsAuth, AnonymousJazzAgent, createAnonymousJazzContext, randomSessionProvider, } from "./internal.js";
|
11
|
+
//# sourceMappingURL=exports.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAkB,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,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,EAGH,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,GACxB,MAAM,eAAe,CAAC"}
|
@@ -33,11 +33,11 @@ export class Ref {
|
|
33
33
|
return null;
|
34
34
|
}
|
35
35
|
}
|
36
|
-
async loadHelper(
|
36
|
+
async loadHelper() {
|
37
37
|
const node = "node" in this.controlledAccount
|
38
38
|
? this.controlledAccount.node
|
39
39
|
: this.controlledAccount._raw.core.node;
|
40
|
-
const raw = await node.load(this.id
|
40
|
+
const raw = await node.load(this.id);
|
41
41
|
if (raw === "unavailable") {
|
42
42
|
return "unavailable";
|
43
43
|
}
|
@@ -45,8 +45,8 @@ export class Ref {
|
|
45
45
|
return new Ref(this.id, this.controlledAccount, this.schema).value;
|
46
46
|
}
|
47
47
|
}
|
48
|
-
async load(
|
49
|
-
const result = await this.loadHelper(
|
48
|
+
async load() {
|
49
|
+
const result = await this.loadHelper();
|
50
50
|
if (result === "unavailable") {
|
51
51
|
return undefined;
|
52
52
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"refs.js","sourceRoot":"","sources":["../../../src/implementation/refs.ts"],"names":[],"mappings":"AASA,OAAO,EACH,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,GACtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAuB,CAAC;AAEpD,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B,MAAM,OAAO,GAAG;IAEC;IACA;IACA;IAHb,YACa,EAAS,EACT,iBAA+C,EAC/C,MAAqB;QAFrB,OAAE,GAAF,EAAE,CAAO;QACT,sBAAiB,GAAjB,iBAAiB,CAA8B;QAC/C,WAAM,GAAN,MAAM,CAAe;QAE9B,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,E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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;QACD,wBAAwB,CAAC,MAAM,EAAE,GAAG;YAChC,MAAM,EAAE,GAAG,WAAW,CAAC,GAAW,CAAC,CAAC;YACpC,IAAI,EAAE,EAAE,CAAC;gBACL,OAAO;oBACH,UAAU,EAAE,IAAI;oBAChB,YAAY,EAAE,IAAI;oBAClB,QAAQ,EAAE,IAAI;iBACjB,CAAC;YACN,CAAC;iBAAM,CAAC;gBACJ,OAAO,OAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACzD,CAAC;QACL,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
@@ -1,4 +1,11 @@
|
|
1
|
-
import { isCoValueClass, } from "../internal.js";
|
1
|
+
import { isCoValueClass, SchemaInit, ItemsSym, MembersSym, } from "../internal.js";
|
2
|
+
/** @category Schema definition */
|
3
|
+
export const Encoders = {
|
4
|
+
Date: {
|
5
|
+
encode: (value) => value.toISOString(),
|
6
|
+
decode: (value) => new Date(value),
|
7
|
+
},
|
8
|
+
};
|
2
9
|
const optional = {
|
3
10
|
ref: optionalRef,
|
4
11
|
json() {
|
@@ -21,6 +28,9 @@ const optional = {
|
|
21
28
|
null: {
|
22
29
|
[SchemaInit]: "json",
|
23
30
|
},
|
31
|
+
Date: {
|
32
|
+
[SchemaInit]: { encoded: Encoders.Date },
|
33
|
+
},
|
24
34
|
literal(..._lit) {
|
25
35
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
26
36
|
return { [SchemaInit]: "json" };
|
@@ -40,6 +50,9 @@ export const co = {
|
|
40
50
|
null: {
|
41
51
|
[SchemaInit]: "json",
|
42
52
|
},
|
53
|
+
Date: {
|
54
|
+
[SchemaInit]: { encoded: Encoders.Date },
|
55
|
+
},
|
43
56
|
literal(..._lit) {
|
44
57
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
45
58
|
return { [SchemaInit]: "json" };
|
@@ -80,12 +93,4 @@ export function instantiateRefEncoded(schema, raw) {
|
|
80
93
|
? schema.ref.fromRaw(raw)
|
81
94
|
: schema.ref(raw).fromRaw(raw);
|
82
95
|
}
|
83
|
-
import { SchemaInit, ItemsSym, MembersSym } from "./symbols.js";
|
84
|
-
/** @category Schema definition */
|
85
|
-
export const Encoders = {
|
86
|
-
Date: {
|
87
|
-
encode: (value) => value.toISOString(),
|
88
|
-
decode: (value) => new Date(value),
|
89
|
-
},
|
90
|
-
};
|
91
96
|
//# sourceMappingURL=schema.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/implementation/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,cAAc,
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/implementation/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,cAAc,EAEd,UAAU,EACV,QAAQ,EACR,UAAU,GACb,MAAM,gBAAgB,CAAC;AAGxB,kCAAkC;AAClC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACpB,IAAI,EAAE;QACF,MAAM,EAAE,CAAC,KAAW,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;QAC5C,MAAM,EAAE,CAAC,KAAgB,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,KAAe,CAAC;KAC1D;CACJ,CAAC;AAYF,MAAM,QAAQ,GAAG;IACb,GAAG,EAAE,WAAW;IAChB,IAAI;QACA,8DAA8D;QAC9D,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,MAAuB,EAAS,CAAC;IAC5D,CAAC;IACD,OAAO,CAAI,GAAuB;QAC9B,8DAA8D;QAC9D,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAmB,EAAS,CAAC;IACtE,CAAC;IACD,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,QAAoB;IAC3B,OAAO,EAAE,UAAwB;IACjC,QAAQ;CACX,CAAC;AAEF,SAAS,WAAW,CAChB,GAA+C;IAE/C,OAAO,GAAG,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACxC,CAAC;AAUD,SAAS,GAAG,CAIR,GAA+C,EAC/C,OAAiB;IAIjB,OAAO;QACH,CAAC,UAAU,CAAC,EAAE;YACV,GAAG,EAAE,GAAG;YACR,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,KAAK;SACtB;QAClB,8DAA8D;KAC1D,CAAC;AACb,CAAC;AASD,MAAM,UAAU,YAAY,CACxB,MAAc;IAEd,OAAO,CACH,OAAO,MAAM,KAAK,QAAQ;QAC1B,KAAK,IAAI,MAAM;QACf,UAAU,IAAI,MAAM;QACpB,OAAO,MAAM,CAAC,GAAG,KAAK,UAAU,CACnC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,qBAAqB,CACjC,MAAqB,EACrB,GAAe;IAEf,OAAO,cAAc,CAAI,MAAM,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;QACzB,CAAC,CACK,MAAM,CAAC,GAGV,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC"}
|
@@ -5,32 +5,31 @@ export class SubscriptionScope {
|
|
5
5
|
subscriber;
|
6
6
|
entries = new Map();
|
7
7
|
rootEntry;
|
8
|
-
|
8
|
+
scheduleUpdate;
|
9
9
|
scheduledUpdate = false;
|
10
10
|
cachedValues = {};
|
11
11
|
parents = {};
|
12
12
|
constructor(root, rootSchema, onUpdate) {
|
13
13
|
this.rootEntry = {
|
14
14
|
state: "loaded",
|
15
|
-
value: root,
|
15
|
+
value: root._raw,
|
16
16
|
rawUnsub: () => { }, // placeholder
|
17
17
|
};
|
18
18
|
this.entries.set(root.id, this.rootEntry);
|
19
19
|
subscriptionsScopes.set(root, this);
|
20
20
|
this.subscriber = root._loadedAs;
|
21
|
-
this.
|
21
|
+
this.scheduleUpdate = () => {
|
22
|
+
const value = rootSchema.fromRaw(this.rootEntry.value);
|
23
|
+
subscriptionsScopes.set(value, this);
|
24
|
+
onUpdate(value);
|
25
|
+
};
|
22
26
|
this.rootEntry.rawUnsub = root._raw.core.subscribe((rawUpdate) => {
|
23
27
|
if (!rawUpdate)
|
24
28
|
return;
|
25
|
-
this.rootEntry.value =
|
26
|
-
// console.log("root update", this.rootEntry.value.toJSON());
|
27
|
-
subscriptionsScopes.set(this.rootEntry.value, this);
|
29
|
+
this.rootEntry.value = rawUpdate;
|
28
30
|
this.scheduleUpdate();
|
29
31
|
});
|
30
32
|
}
|
31
|
-
scheduleUpdate() {
|
32
|
-
this.onUpdate(this.rootEntry.value);
|
33
|
-
}
|
34
33
|
onRefAccessedOrSet(fromId, accessedOrSetId) {
|
35
34
|
// console.log("onRefAccessedOrSet", this.scopeID, accessedOrSetId);
|
36
35
|
if (!accessedOrSetId) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"subscriptionScope.js","sourceRoot":"","sources":["../../../src/implementation/subscriptionScope.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAI3C,CAAC;AAEJ,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAElC,MAAM,OAAO,iBAAiB;IAC1B,OAAO,GAAW,SAAS,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,UAAU,CAA+B;IACzC,OAAO,GAAG,IAAI,GAAG,EAId,CAAC;IACJ,SAAS,CAIP;IACF,
|
1
|
+
{"version":3,"file":"subscriptionScope.js","sourceRoot":"","sources":["../../../src/implementation/subscriptionScope.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,OAAO,EA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AC,OAAO,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACJ"}
|
@@ -1,12 +1,3 @@
|
|
1
|
+
export * from "./exports.js";
|
1
2
|
export { cojsonInternals, MAX_RECOMMENDED_TX_SIZE, PureJSCrypto, } from "cojson/native";
|
2
|
-
export { Encoders, co } from "./internal.js";
|
3
|
-
export { CoMap } from "./internal.js";
|
4
|
-
export { CoList } from "./internal.js";
|
5
|
-
export { CoStream, BinaryCoStream } from "./internal.js";
|
6
|
-
export { Group, Profile } from "./internal.js";
|
7
|
-
export { Account, isControlledAccount } from "./internal.js";
|
8
|
-
export { ImageDefinition } from "./internal.js";
|
9
|
-
export { CoValueBase } from "./internal.js";
|
10
|
-
export { loadCoValue, subscribeToCoValue } from "./internal.js";
|
11
|
-
export { createJazzContext, fixedCredentialsAuth, ephemeralCredentialsAuth, AnonymousJazzAgent, createAnonymousJazzContext, randomSessionProvider, } from "./internal.js";
|
12
3
|
//# sourceMappingURL=index.native.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../src/index.native.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,uBAAuB,EACvB,YAAY,GACf,MAAM,eAAe,CAAC
|
1
|
+
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../src/index.native.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,EACH,eAAe,EACf,uBAAuB,EACvB,YAAY,GACf,MAAM,eAAe,CAAC"}
|
@@ -103,6 +103,21 @@ export function subscribeToCoValue(cls, id, as, depth, listener, onUnavailable)
|
|
103
103
|
unsubscribe && unsubscribe();
|
104
104
|
};
|
105
105
|
}
|
106
|
+
export function createCoValueObservable() {
|
107
|
+
let currentValue = undefined;
|
108
|
+
function subscribe(cls, id, as, depth, listener, onUnavailable) {
|
109
|
+
const unsubscribe = subscribeToCoValue(cls, id, as, depth, (value) => {
|
110
|
+
currentValue = value;
|
111
|
+
listener();
|
112
|
+
}, onUnavailable);
|
113
|
+
return unsubscribe;
|
114
|
+
}
|
115
|
+
const observable = {
|
116
|
+
getCurrentValue: () => currentValue,
|
117
|
+
subscribe,
|
118
|
+
};
|
119
|
+
return observable;
|
120
|
+
}
|
106
121
|
export function subscribeToExistingCoValue(existing, depth, listener) {
|
107
122
|
return subscribeToCoValue(existing.constructor, existing.id, existing._loadedAs, depth, listener);
|
108
123
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/coValues/interfaces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EACH,OAAO,EACP,KAAK,EACL,iBAAiB,EACjB,GAAG,EACH,OAAO,EACP,mBAAmB,EACnB,kBAAkB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAmCjD,8DAA8D;AAC9D,MAAM,UAAU,SAAS,CAAC,KAAU;IAChC,OAAO,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,cAAc;AAC1B,8DAA8D;AAC9D,KAAU;IAEV,OAAO,OAAO,KAAK,KAAK,UAAU,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC;AACtE,CAAC;AAOD,gBAAgB;AAChB,MAAM,OAAO,WAAW;IAOpB,IAAI,MAAM;QACN,MAAM,KAAK,GACP,IAAI,CAAC,IAAI,CAAC,KAAK,YAAY,UAAU;YACjC,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;QAEzC,MAAM,QAAQ,GAAG,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,QAA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AC,CAAC,CAAC;IAEP,OAAO,SAAS,qBAAqB;QACjC,YAAY,GAAG,IAAI,CAAC;QACpB,WAAW,IAAI,WAAW,EAAE,CAAC;IACjC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,uBAAuB;IACnC,IAAI,YAAY,GAAuC,SAAS,CAAC;IAEjE,SAAS,SAAS,CACd,GAAoB,EACpB,EAAS,EACT,EAAgC,EAChC,KAA0B,EAC1B,QAAoB,EACpB,aAA0B;QAE1B,MAAM,WAAW,GAAG,kBAAkB,CAClC,GAAG,EACH,EAAE,EACF,EAAE,EACF,KAAK,EACL,CAAC,KAAK,EAAE,EAAE;YACN,YAAY,GAAG,KAAK,CAAC;YACrB,QAAQ,EAAE,CAAC;QACf,CAAC,EACD,aAAa,CAChB,CAAC;QAEF,OAAO,WAAW,CAAA;IACtB,CAAC;IAED,MAAM,UAAU,GAAG;QACf,eAAe,EAAE,GAAG,EAAE,CAAC,YAAY;QACnC,SAAS;KACZ,CAAC;IAEF,OAAO,UAAU,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,0BAA0B,CACtC,QAAW,EACX,KAA0B,EAC1B,QAAiD;IAEjD,OAAO,kBAAkB,CACrB,QAAQ,CAAC,WAA8B,EACvC,QAAQ,CAAC,EAAE,EACX,QAAQ,CAAC,SAAS,EAClB,KAAK,EACL,QAAQ,CACX,CAAC;AACN,CAAC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export { Encoders, co } from "./internal.js";
|
2
|
+
export { CoMap } from "./internal.js";
|
3
|
+
export { CoList } from "./internal.js";
|
4
|
+
export { CoStream, BinaryCoStream } from "./internal.js";
|
5
|
+
export { Group, Profile } from "./internal.js";
|
6
|
+
export { Account, isControlledAccount } from "./internal.js";
|
7
|
+
export { ImageDefinition } from "./internal.js";
|
8
|
+
export { CoValueBase } from "./internal.js";
|
9
|
+
export { loadCoValue, subscribeToCoValue, createCoValueObservable } from "./internal.js";
|
10
|
+
export { createJazzContext, fixedCredentialsAuth, ephemeralCredentialsAuth, AnonymousJazzAgent, createAnonymousJazzContext, randomSessionProvider, } from "./internal.js";
|
11
|
+
//# sourceMappingURL=exports.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAkB,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,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,EAGH,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,GACxB,MAAM,eAAe,CAAC"}
|
@@ -33,11 +33,11 @@ export class Ref {
|
|
33
33
|
return null;
|
34
34
|
}
|
35
35
|
}
|
36
|
-
async loadHelper(
|
36
|
+
async loadHelper() {
|
37
37
|
const node = "node" in this.controlledAccount
|
38
38
|
? this.controlledAccount.node
|
39
39
|
: this.controlledAccount._raw.core.node;
|
40
|
-
const raw = await node.load(this.id
|
40
|
+
const raw = await node.load(this.id);
|
41
41
|
if (raw === "unavailable") {
|
42
42
|
return "unavailable";
|
43
43
|
}
|
@@ -45,8 +45,8 @@ export class Ref {
|
|
45
45
|
return new Ref(this.id, this.controlledAccount, this.schema).value;
|
46
46
|
}
|
47
47
|
}
|
48
|
-
async load(
|
49
|
-
const result = await this.loadHelper(
|
48
|
+
async load() {
|
49
|
+
const result = await this.loadHelper();
|
50
50
|
if (result === "unavailable") {
|
51
51
|
return undefined;
|
52
52
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"refs.js","sourceRoot":"","sources":["../../../src/implementation/refs.ts"],"names":[],"mappings":"AASA,OAAO,EACH,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,GACtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAuB,CAAC;AAEpD,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B,MAAM,OAAO,GAAG;IAEC;IACA;IACA;IAHb,YACa,EAAS,EACT,iBAA+C,EAC/C,MAAqB;QAFrB,OAAE,GAAF,EAAE,CAAO;QACT,sBAAiB,GAAjB,iBAAiB,CAA8B;QAC/C,WAAM,GAAN,MAAM,CAAe;QAE9B,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QACjE,CAAC;IACL,CAAC;IAED,IAAI,KAAK;QACL,MAAM,IAAI,GACN,MAAM,IAAI,IAAI,CAAC,iBAAiB;YAC5B,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI;YAC7B,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAChD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAiC,CAAC,CAAC;QACnE,IAAI,GAAG,EAAE,CAAC;YACN,IAAI,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC9B,IAAI,KAAK,EAAE,CAAC;gBACR,oDAAoD;YACxD,CAAC;iBAAM,CAAC;gBACJ,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,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chemaInit, ItemsSym, MembersSym, } from "../internal.js";
|
2
|
+
/** @category Schema definition */
|
3
|
+
export const Encoders = {
|
4
|
+
Date: {
|
5
|
+
encode: (value) => value.toISOString(),
|
6
|
+
decode: (value) => new Date(value),
|
7
|
+
},
|
8
|
+
};
|
2
9
|
const optional = {
|
3
10
|
ref: optionalRef,
|
4
11
|
json() {
|
@@ -21,6 +28,9 @@ const optional = {
|
|
21
28
|
null: {
|
22
29
|
[SchemaInit]: "json",
|
23
30
|
},
|
31
|
+
Date: {
|
32
|
+
[SchemaInit]: { encoded: Encoders.Date },
|
33
|
+
},
|
24
34
|
literal(..._lit) {
|
25
35
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
26
36
|
return { [SchemaInit]: "json" };
|
@@ -40,6 +50,9 @@ export const co = {
|
|
40
50
|
null: {
|
41
51
|
[SchemaInit]: "json",
|
42
52
|
},
|
53
|
+
Date: {
|
54
|
+
[SchemaInit]: { encoded: Encoders.Date },
|
55
|
+
},
|
43
56
|
literal(..._lit) {
|
44
57
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
45
58
|
return { [SchemaInit]: "json" };
|
@@ -80,12 +93,4 @@ export function instantiateRefEncoded(schema, raw) {
|
|
80
93
|
? schema.ref.fromRaw(raw)
|
81
94
|
: schema.ref(raw).fromRaw(raw);
|
82
95
|
}
|
83
|
-
import { SchemaInit, ItemsSym, MembersSym } from "./symbols.js";
|
84
|
-
/** @category Schema definition */
|
85
|
-
export const Encoders = {
|
86
|
-
Date: {
|
87
|
-
encode: (value) => value.toISOString(),
|
88
|
-
decode: (value) => new Date(value),
|
89
|
-
},
|
90
|
-
};
|
91
96
|
//# sourceMappingURL=schema.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/implementation/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,cAAc,
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/implementation/schema.ts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qB,CACjC,MAAqB,EACrB,GAAe;IAEf,OAAO,cAAc,CAAI,MAAM,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;QACzB,CAAC,CACK,MAAM,CAAC,GAGV,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC"}
|
@@ -5,32 +5,31 @@ export class SubscriptionScope {
|
|
5
5
|
subscriber;
|
6
6
|
entries = new Map();
|
7
7
|
rootEntry;
|
8
|
-
|
8
|
+
scheduleUpdate;
|
9
9
|
scheduledUpdate = false;
|
10
10
|
cachedValues = {};
|
11
11
|
parents = {};
|
12
12
|
constructor(root, rootSchema, onUpdate) {
|
13
13
|
this.rootEntry = {
|
14
14
|
state: "loaded",
|
15
|
-
value: root,
|
15
|
+
value: root._raw,
|
16
16
|
rawUnsub: () => { }, // placeholder
|
17
17
|
};
|
18
18
|
this.entries.set(root.id, this.rootEntry);
|
19
19
|
subscriptionsScopes.set(root, this);
|
20
20
|
this.subscriber = root._loadedAs;
|
21
|
-
this.
|
21
|
+
this.scheduleUpdate = () => {
|
22
|
+
const value = rootSchema.fromRaw(this.rootEntry.value);
|
23
|
+
subscriptionsScopes.set(value, this);
|
24
|
+
onUpdate(value);
|
25
|
+
};
|
22
26
|
this.rootEntry.rawUnsub = root._raw.core.subscribe((rawUpdate) => {
|
23
27
|
if (!rawUpdate)
|
24
28
|
return;
|
25
|
-
this.rootEntry.value =
|
26
|
-
// console.log("root update", this.rootEntry.value.toJSON());
|
27
|
-
subscriptionsScopes.set(this.rootEntry.value, this);
|
29
|
+
this.rootEntry.value = rawUpdate;
|
28
30
|
this.scheduleUpdate();
|
29
31
|
});
|
30
32
|
}
|
31
|
-
scheduleUpdate() {
|
32
|
-
this.onUpdate(this.rootEntry.value);
|
33
|
-
}
|
34
33
|
onRefAccessedOrSet(fromId, accessedOrSetId) {
|
35
34
|
// console.log("onRefAccessedOrSet", this.scopeID, accessedOrSetId);
|
36
35
|
if (!accessedOrSetId) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"subscriptionScope.js","sourceRoot":"","sources":["../../../src/implementation/subscriptionScope.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAI3C,CAAC;AAEJ,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAElC,MAAM,OAAO,iBAAiB;IAC1B,OAAO,GAAW,SAAS,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,UAAU,CAA+B;IACzC,OAAO,GAAG,IAAI,GAAG,EAId,CAAC;IACJ,SAAS,CAIP;IACF,
|
1
|
+
{"version":3,"file":"subscriptionScope.js","sourceRoot":"","sources":["../../../src/implementation/subscriptionScope.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAI3C,CAAC;AAEJ,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAElC,MAAM,OAAO,iBAAiB;IAC1B,OAAO,GAAW,SAAS,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,UAAU,CAA+B;IACzC,OAAO,GAAG,IAAI,GAAG,EAId,CAAC;IACJ,SAAS,CAIP;IACF,cAAc,CAAa;IAC3B,eAAe,GAAY,KAAK,CAAC;IACjC,YAAY,GAAmC,EAAE,CAAC;IAClD,OAAO,GAA4C,EAAE,CAAC;IAEtD,YACI,IAAU,EACV,UAAqD,EACrD,QAAiC;QAEjC,IAAI,CAAC,SAAS,GAAG;YACb,KAAK,EAAE,QAAiB;YACxB,KAAK,EAAE,IAAI,CAAC,IAAI;YAChB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,cAAc;SACrC,CAAC;QACF,IAA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E,EACF,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CACxB,CAAC;QACN,OAAO,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACb,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;YAC1C,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC;IACL,CAAC;IAED,cAAc;QACV,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YACxC,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC3B,KAAK,CAAC,QAAQ,EAAE,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACJ,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAClC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACJ"}
|
package/dist/web/index.web.js
CHANGED
@@ -1,12 +1,3 @@
|
|
1
|
+
export * from "./exports.js";
|
1
2
|
export { cojsonInternals, MAX_RECOMMENDED_TX_SIZE, WasmCrypto } from "cojson";
|
2
|
-
export { Encoders, co } from "./internal.js";
|
3
|
-
export { CoMap } from "./internal.js";
|
4
|
-
export { CoList } from "./internal.js";
|
5
|
-
export { CoStream, BinaryCoStream } from "./internal.js";
|
6
|
-
export { Group, Profile } from "./internal.js";
|
7
|
-
export { Account, isControlledAccount } from "./internal.js";
|
8
|
-
export { ImageDefinition } from "./internal.js";
|
9
|
-
export { CoValueBase } from "./internal.js";
|
10
|
-
export { loadCoValue, subscribeToCoValue } from "./internal.js";
|
11
|
-
export { createJazzContext, fixedCredentialsAuth, ephemeralCredentialsAuth, AnonymousJazzAgent, createAnonymousJazzContext, randomSessionProvider, } from "./internal.js";
|
12
3
|
//# sourceMappingURL=index.web.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.web.js","sourceRoot":"","sources":["../../src/index.web.ts"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"index.web.js","sourceRoot":"","sources":["../../src/index.web.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC"}
|
package/package.json
CHANGED
@@ -7,22 +7,22 @@
|
|
7
7
|
"exports": {
|
8
8
|
".": {
|
9
9
|
"react-native": "./dist/native/index.native.js",
|
10
|
-
"
|
11
|
-
"
|
10
|
+
"types": "./src/index.web.ts",
|
11
|
+
"default": "./dist/web/index.web.js"
|
12
12
|
},
|
13
13
|
"./native": {
|
14
14
|
"react-native": "./dist/native/index.native.js",
|
15
|
-
"
|
16
|
-
"
|
15
|
+
"types": "./src/index.native.ts",
|
16
|
+
"default": "./dist/native/index.native.js"
|
17
17
|
},
|
18
18
|
"./src/*": "./src/*"
|
19
19
|
},
|
20
20
|
"type": "module",
|
21
21
|
"license": "MIT",
|
22
|
-
"version": "0.8.
|
22
|
+
"version": "0.8.11",
|
23
23
|
"dependencies": {
|
24
24
|
"fast-check": "^3.17.2",
|
25
|
-
"cojson": "0.8.
|
25
|
+
"cojson": "0.8.11"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
28
|
"typescript": "^5.3.3",
|
@@ -213,6 +213,40 @@ export function subscribeToCoValue<V extends CoValue, Depth>(
|
|
213
213
|
};
|
214
214
|
}
|
215
215
|
|
216
|
+
export function createCoValueObservable<V extends CoValue, Depth>() {
|
217
|
+
let currentValue: DeeplyLoaded<V, Depth> | undefined = undefined;
|
218
|
+
|
219
|
+
function subscribe(
|
220
|
+
cls: CoValueClass<V>,
|
221
|
+
id: ID<V>,
|
222
|
+
as: Account | AnonymousJazzAgent,
|
223
|
+
depth: Depth & DepthsIn<V>,
|
224
|
+
listener: () => void,
|
225
|
+
onUnavailable?: () => void,
|
226
|
+
) {
|
227
|
+
const unsubscribe = subscribeToCoValue(
|
228
|
+
cls,
|
229
|
+
id,
|
230
|
+
as,
|
231
|
+
depth,
|
232
|
+
(value) => {
|
233
|
+
currentValue = value;
|
234
|
+
listener();
|
235
|
+
},
|
236
|
+
onUnavailable,
|
237
|
+
);
|
238
|
+
|
239
|
+
return unsubscribe
|
240
|
+
}
|
241
|
+
|
242
|
+
const observable = {
|
243
|
+
getCurrentValue: () => currentValue,
|
244
|
+
subscribe,
|
245
|
+
};
|
246
|
+
|
247
|
+
return observable;
|
248
|
+
}
|
249
|
+
|
216
250
|
export function subscribeToExistingCoValue<V extends CoValue, Depth>(
|
217
251
|
existing: V,
|
218
252
|
depth: Depth & DepthsIn<V>,
|