jazz-tools 0.8.5 → 0.8.12

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.8.12
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [6ed75eb]
8
+ - cojson@0.8.12
9
+
10
+ ## 0.8.11
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [1ed4ab5]
15
+ - cojson@0.8.11
16
+
3
17
  ## 0.8.5
4
18
 
5
19
  ### 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,CAAC,KAAU;IAChC,OAAO,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC;AAC9C,CAA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,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(options) {
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, options?.onProgress);
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(options) {
49
- const result = await this.loadHelper(options);
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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,32 +5,31 @@ export class SubscriptionScope {
5
5
  subscriber;
6
6
  entries = new Map();
7
7
  rootEntry;
8
- onUpdate;
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.onUpdate = onUpdate;
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 = rootSchema.fromRaw(rawUpdate);
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,EAA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B,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;wBACjC,IAAI,CAAC,cAAc,EAAE,CAAC;oBAC1B,CAAC,CAAC,CAAC;oBAEH,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBAC9B,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,UAAU,CACN,EAAe,EACf,SAAuB,EACvB,OAAyB,IAAI,GAAG,EAAE;QAElC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,OAAO;QACzB,mBAAmB;YACf,OAAO,CAAC,GAAG,CACP,cAAc,EACd,SAAS,EACT,IAAI,EACJ,EAAE,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"}
1
+ {"version":3,"file":"subscriptionScope.js","sourceRoot":"","sources":["../../../src/implementation/subscriptionScope.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,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IAAI,CAAC,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;AAavB,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,MAAM,eAAe,CAAC;AAEhE,OAAO,EAGH,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,GACxB,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,KA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AQ,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(options) {
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, options?.onProgress);
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(options) {
49
- const result = await this.loadHelper(options);
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,S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onUpdate;
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.onUpdate = onUpdate;
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 = rootSchema.fromRaw(rawUpdate);
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,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,CAAC;oBAC1B,CAAC,CAAC,CAAC;oBAEH,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBAC9B,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,UAAU,CACN,EAAe,EACf,SAAuB,EACvB,OAAyB,IAAI,GAAG,EAAE;QAElC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,OAAO;QACzB,mBAAmB;YACf,OAAO,CAAC,GAAG,CACP,cAAc,EACd,SAAS,EACT,IAAI,EACJ,EAAE,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"}
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,OAA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,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,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAa9E,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,MAAM,eAAe,CAAC;AAEhE,OAAO,EAGH,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,GACxB,MAAM,eAAe,CAAC"}
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
@@ -19,10 +19,10 @@
19
19
  },
20
20
  "type": "module",
21
21
  "license": "MIT",
22
- "version": "0.8.5",
22
+ "version": "0.8.12",
23
23
  "dependencies": {
24
24
  "fast-check": "^3.17.2",
25
- "cojson": "0.8.5"
25
+ "cojson": "0.8.12"
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>,
package/src/exports.ts ADDED
@@ -0,0 +1,35 @@
1
+ export type {
2
+ InviteSecret,
3
+ Peer,
4
+ SessionID,
5
+ AgentID,
6
+ SyncMessage,
7
+ CryptoProvider,
8
+ CoValueUniqueness,
9
+ } from "cojson";
10
+
11
+ export type { ID, CoValue } from "./internal.js";
12
+
13
+ export { Encoders, co } from "./internal.js";
14
+
15
+ export { CoMap, type CoMapInit } from "./internal.js";
16
+ export { CoList } from "./internal.js";
17
+ export { CoStream, BinaryCoStream } from "./internal.js";
18
+ export { Group, Profile } from "./internal.js";
19
+ export { Account, isControlledAccount, type AccountClass } from "./internal.js";
20
+ export { ImageDefinition } from "./internal.js";
21
+ export { CoValueBase, type CoValueClass } from "./internal.js";
22
+ export type { DepthsIn, DeeplyLoaded } from "./internal.js";
23
+
24
+ export { loadCoValue, subscribeToCoValue, createCoValueObservable } from "./internal.js";
25
+
26
+ export {
27
+ type AuthMethod,
28
+ type AuthResult,
29
+ createJazzContext,
30
+ fixedCredentialsAuth,
31
+ ephemeralCredentialsAuth,
32
+ AnonymousJazzAgent,
33
+ createAnonymousJazzContext,
34
+ randomSessionProvider,
35
+ } from "./internal.js";
@@ -48,16 +48,13 @@ export class Ref<out V extends CoValue> {
48
48
  }
49
49
  }
50
50
 
51
- private async loadHelper(options?: {
52
- onProgress: (p: number) => void;
53
- }): Promise<V | "unavailable"> {
51
+ private async loadHelper(): Promise<V | "unavailable"> {
54
52
  const node =
55
53
  "node" in this.controlledAccount
56
54
  ? this.controlledAccount.node
57
55
  : this.controlledAccount._raw.core.node;
58
56
  const raw = await node.load(
59
57
  this.id as unknown as CoID<RawCoValue>,
60
- options?.onProgress,
61
58
  );
62
59
  if (raw === "unavailable") {
63
60
  return "unavailable";
@@ -66,10 +63,8 @@ export class Ref<out V extends CoValue> {
66
63
  }
67
64
  }
68
65
 
69
- async load(options?: {
70
- onProgress: (p: number) => void;
71
- }): Promise<V | undefined> {
72
- const result = await this.loadHelper(options);
66
+ async load(): Promise<V | undefined> {
67
+ const result = await this.loadHelper();
73
68
  if (result === "unavailable") {
74
69
  return undefined;
75
70
  } else {
@@ -26,10 +26,10 @@ export class SubscriptionScope<Root extends CoValue> {
26
26
  >();
27
27
  rootEntry: {
28
28
  state: "loaded";
29
- value: Root;
29
+ value: RawCoValue;
30
30
  rawUnsub: () => void;
31
31
  };
32
- onUpdate: (newRoot: Root) => void;
32
+ scheduleUpdate: () => void;
33
33
  scheduledUpdate: boolean = false;
34
34
  cachedValues: { [id: ID<CoValue>]: CoValue } = {};
35
35
  parents: { [id: ID<CoValue>]: Set<ID<CoValue>> } = {};
@@ -41,7 +41,7 @@ export class SubscriptionScope<Root extends CoValue> {
41
41
  ) {
42
42
  this.rootEntry = {
43
43
  state: "loaded" as const,
44
- value: root,
44
+ value: root._raw,
45
45
  rawUnsub: () => {}, // placeholder
46
46
  };
47
47
  this.entries.set(root.id, this.rootEntry);
@@ -49,22 +49,21 @@ export class SubscriptionScope<Root extends CoValue> {
49
49
  subscriptionsScopes.set(root, this);
50
50
 
51
51
  this.subscriber = root._loadedAs;
52
- this.onUpdate = onUpdate;
52
+ this.scheduleUpdate = () => {
53
+ const value = rootSchema.fromRaw(this.rootEntry.value) as Root;
54
+ subscriptionsScopes.set(value, this);
55
+ onUpdate(value);
56
+ };
57
+
53
58
  this.rootEntry.rawUnsub = root._raw.core.subscribe(
54
59
  (rawUpdate: RawCoValue | undefined) => {
55
60
  if (!rawUpdate) return;
56
- this.rootEntry.value = rootSchema.fromRaw(rawUpdate) as Root;
57
- // console.log("root update", this.rootEntry.value.toJSON());
58
- subscriptionsScopes.set(this.rootEntry.value, this);
61
+ this.rootEntry.value = rawUpdate;
59
62
  this.scheduleUpdate();
60
63
  },
61
64
  );
62
65
  }
63
66
 
64
- scheduleUpdate() {
65
- this.onUpdate(this.rootEntry.value);
66
- }
67
-
68
67
  onRefAccessedOrSet(
69
68
  fromId: ID<CoValue>,
70
69
  accessedOrSetId: ID<CoValue> | undefined,
@@ -1,40 +1,7 @@
1
+ export * from "./exports.js";
2
+
1
3
  export {
2
4
  cojsonInternals,
3
5
  MAX_RECOMMENDED_TX_SIZE,
4
6
  PureJSCrypto,
5
7
  } from "cojson/native";
6
- export type {
7
- InviteSecret,
8
- Peer,
9
- SessionID,
10
- AgentID,
11
- SyncMessage,
12
- CryptoProvider,
13
- CoValueUniqueness,
14
- } from "cojson";
15
-
16
- export type { ID, CoValue } from "./internal.js";
17
-
18
- export { Encoders, co } from "./internal.js";
19
-
20
- export { CoMap, type CoMapInit } from "./internal.js";
21
- export { CoList } from "./internal.js";
22
- export { CoStream, BinaryCoStream } from "./internal.js";
23
- export { Group, Profile } from "./internal.js";
24
- export { Account, isControlledAccount, type AccountClass } from "./internal.js";
25
- export { ImageDefinition } from "./internal.js";
26
- export { CoValueBase, type CoValueClass } from "./internal.js";
27
- export type { DepthsIn, DeeplyLoaded } from "./internal.js";
28
-
29
- export { loadCoValue, subscribeToCoValue } from "./internal.js";
30
-
31
- export {
32
- type AuthMethod,
33
- type AuthResult,
34
- createJazzContext,
35
- fixedCredentialsAuth,
36
- ephemeralCredentialsAuth,
37
- AnonymousJazzAgent,
38
- createAnonymousJazzContext,
39
- randomSessionProvider,
40
- } from "./internal.js";
package/src/index.web.ts CHANGED
@@ -1,36 +1,3 @@
1
- export { cojsonInternals, MAX_RECOMMENDED_TX_SIZE, WasmCrypto } from "cojson";
2
- export type {
3
- InviteSecret,
4
- Peer,
5
- SessionID,
6
- AgentID,
7
- SyncMessage,
8
- CryptoProvider,
9
- CoValueUniqueness,
10
- } from "cojson";
11
-
12
- export type { ID, CoValue } from "./internal.js";
13
-
14
- export { Encoders, co } from "./internal.js";
1
+ export * from "./exports.js";
15
2
 
16
- export { CoMap, type CoMapInit } from "./internal.js";
17
- export { CoList } from "./internal.js";
18
- export { CoStream, BinaryCoStream } from "./internal.js";
19
- export { Group, Profile } from "./internal.js";
20
- export { Account, isControlledAccount, type AccountClass } from "./internal.js";
21
- export { ImageDefinition } from "./internal.js";
22
- export { CoValueBase, type CoValueClass } from "./internal.js";
23
- export type { DepthsIn, DeeplyLoaded } from "./internal.js";
24
-
25
- export { loadCoValue, subscribeToCoValue } from "./internal.js";
26
-
27
- export {
28
- type AuthMethod,
29
- type AuthResult,
30
- createJazzContext,
31
- fixedCredentialsAuth,
32
- ephemeralCredentialsAuth,
33
- AnonymousJazzAgent,
34
- createAnonymousJazzContext,
35
- randomSessionProvider,
36
- } from "./internal.js";
3
+ export { cojsonInternals, MAX_RECOMMENDED_TX_SIZE, WasmCrypto } from "cojson";
@@ -0,0 +1,348 @@
1
+ const Crypto = await WasmCrypto.create();
2
+ import { expect, describe, it, vi, onTestFinished } from "vitest";
3
+ import { connectedPeers } from "cojson/src/streamUtils.js";
4
+ import {
5
+ Account,
6
+ CoList,
7
+ CoMap,
8
+ CoStream,
9
+ WasmCrypto,
10
+ co,
11
+ isControlledAccount,
12
+ createJazzContext,
13
+ fixedCredentialsAuth,
14
+ } from "../index.web.js";
15
+ import {
16
+ BinaryCoStream,
17
+ Group,
18
+ randomSessionProvider,
19
+ subscribeToCoValue,
20
+ } from "../internal.js";
21
+
22
+ class ChatRoom extends CoMap {
23
+ messages = co.ref(MessagesList);
24
+ name = co.string;
25
+ }
26
+
27
+ class Message extends CoMap {
28
+ text = co.string;
29
+ reactions = co.ref(ReactionsStream);
30
+ attachment = co.optional.ref(BinaryCoStream);
31
+ }
32
+
33
+ class MessagesList extends CoList.Of(co.ref(Message)) {}
34
+ class ReactionsStream extends CoStream.Of(co.string) {}
35
+
36
+ async function setupAccount() {
37
+ const me = await Account.create({
38
+ creationProps: { name: "Hermes Puggington" },
39
+ crypto: Crypto,
40
+ });
41
+
42
+ const [initialAsPeer, secondPeer] = connectedPeers("initial", "second", {
43
+ peer1role: "server",
44
+ peer2role: "client",
45
+ });
46
+
47
+ if (!isControlledAccount(me)) {
48
+ throw "me is not a controlled account";
49
+ }
50
+ me._raw.core.node.syncManager.addPeer(secondPeer);
51
+ const { account: meOnSecondPeer } = await createJazzContext({
52
+ auth: fixedCredentialsAuth({
53
+ accountID: me.id,
54
+ secret: me._raw.agentSecret,
55
+ }),
56
+ sessionProvider: randomSessionProvider,
57
+ peersToLoadFrom: [initialAsPeer],
58
+ crypto: Crypto,
59
+ });
60
+
61
+ return { me, meOnSecondPeer };
62
+ }
63
+
64
+ function createChatRoom(me: Account | Group, name: string) {
65
+ return ChatRoom.create(
66
+ { messages: MessagesList.create([], { owner: me }), name },
67
+ { owner: me },
68
+ );
69
+ }
70
+
71
+ function createMessage(me: Account | Group, text: string) {
72
+ return Message.create(
73
+ { text, reactions: ReactionsStream.create([], { owner: me }) },
74
+ { owner: me },
75
+ );
76
+ }
77
+
78
+ describe("subscribeToCoValue", () => {
79
+ it("subscribes to a CoMap", async () => {
80
+ const { me, meOnSecondPeer } = await setupAccount();
81
+
82
+ const chatRoom = createChatRoom(me, "General");
83
+ const updateFn = vi.fn();
84
+
85
+ const unsubscribe = subscribeToCoValue(
86
+ ChatRoom,
87
+ chatRoom.id,
88
+ meOnSecondPeer,
89
+ {},
90
+ updateFn,
91
+ );
92
+
93
+ onTestFinished(unsubscribe);
94
+
95
+ await waitFor(() => {
96
+ expect(updateFn).toHaveBeenCalled();
97
+ });
98
+
99
+ expect(updateFn).toHaveBeenCalledWith(
100
+ expect.objectContaining({
101
+ id: chatRoom.id,
102
+ messages: null,
103
+ name: "General",
104
+ }),
105
+ );
106
+
107
+ updateFn.mockClear();
108
+
109
+ await waitFor(() => {
110
+ expect(updateFn).toHaveBeenCalled();
111
+ });
112
+
113
+ expect(updateFn).toHaveBeenCalledWith(
114
+ expect.objectContaining({
115
+ id: chatRoom.id,
116
+ name: "General",
117
+ messages: expect.any(Array),
118
+ }),
119
+ );
120
+
121
+ updateFn.mockClear();
122
+ chatRoom.name = "Lounge";
123
+
124
+ await waitFor(() => {
125
+ expect(updateFn).toHaveBeenCalled();
126
+ });
127
+
128
+ expect(updateFn).toHaveBeenCalledWith(
129
+ expect.objectContaining({
130
+ id: chatRoom.id,
131
+ name: "Lounge",
132
+ messages: expect.any(Array),
133
+ }),
134
+ );
135
+ });
136
+
137
+ it("shouldn't fire updates until the declared load depth isn't reached", async () => {
138
+ const { me, meOnSecondPeer } = await setupAccount();
139
+
140
+ const chatRoom = createChatRoom(me, "General");
141
+ const updateFn = vi.fn();
142
+
143
+ const unsubscribe = subscribeToCoValue(
144
+ ChatRoom,
145
+ chatRoom.id,
146
+ meOnSecondPeer,
147
+ {
148
+ messages: [],
149
+ },
150
+ updateFn,
151
+ );
152
+
153
+ onTestFinished(unsubscribe);
154
+
155
+ await waitFor(() => {
156
+ expect(updateFn).toHaveBeenCalled();
157
+ });
158
+
159
+ expect(updateFn).toHaveBeenCalledTimes(1);
160
+ expect(updateFn).toHaveBeenCalledWith(
161
+ expect.objectContaining({
162
+ id: chatRoom.id,
163
+ name: "General",
164
+ messages: expect.any(Array),
165
+ }),
166
+ );
167
+ });
168
+
169
+ it("should fire updates when a ref entity is updates", async () => {
170
+ const { me, meOnSecondPeer } = await setupAccount();
171
+
172
+ const chatRoom = createChatRoom(me, "General");
173
+ const message = createMessage(me, "Hello Luigi, are you ready to save the princess?");
174
+ chatRoom.messages?.push(message);
175
+
176
+ const updateFn = vi.fn()
177
+
178
+ const unsubscribe = subscribeToCoValue(
179
+ ChatRoom,
180
+ chatRoom.id,
181
+ meOnSecondPeer,
182
+ {
183
+ messages: [{
184
+ }],
185
+ },
186
+ updateFn,
187
+ );
188
+
189
+ onTestFinished(unsubscribe);
190
+
191
+ await waitFor(() => {
192
+ const lastValue = updateFn.mock.lastCall[0];
193
+
194
+ expect(lastValue?.messages?.[0]?.text).toBe(message.text);
195
+ });
196
+
197
+ message.text = "Nevermind, she was gone to the supermarket";
198
+ updateFn.mockClear();
199
+
200
+ await waitFor(() => {
201
+ expect(updateFn).toHaveBeenCalled();
202
+ });
203
+
204
+ const lastValue = updateFn.mock.lastCall[0];
205
+ expect(lastValue?.messages?.[0]?.text).toBe("Nevermind, she was gone to the supermarket");
206
+ });
207
+
208
+ it("should handle the updates as immutable changes", async () => {
209
+ const { me, meOnSecondPeer } = await setupAccount();
210
+
211
+ const chatRoom = createChatRoom(me, "General");
212
+ const message = createMessage(me, "Hello Luigi, are you ready to save the princess?");
213
+ const message2 = createMessage(me, "Let's go!");
214
+ chatRoom.messages?.push(message);
215
+ chatRoom.messages?.push(message2);
216
+
217
+ const updateFn = vi.fn()
218
+
219
+ const unsubscribe = subscribeToCoValue(
220
+ ChatRoom,
221
+ chatRoom.id,
222
+ meOnSecondPeer,
223
+ {
224
+ messages: [{
225
+ reactions: [],
226
+ }],
227
+ },
228
+ updateFn,
229
+ );
230
+
231
+ onTestFinished(unsubscribe);
232
+
233
+ await waitFor(() => {
234
+ const lastValue = updateFn.mock.lastCall[0];
235
+
236
+ expect(lastValue?.messages?.[0]?.text).toBe(message.text);
237
+ });
238
+
239
+ const initialValue = updateFn.mock.lastCall[0];
240
+ const initialMessagesList = initialValue?.messages;
241
+ const initialMessage1 = initialValue?.messages[0];
242
+ const initialMessage2 = initialValue?.messages[1];
243
+ const initialMessageReactions = initialValue?.messages[0].reactions;
244
+
245
+ message.reactions?.push("👍");
246
+
247
+ updateFn.mockClear();
248
+
249
+ await waitFor(() => {
250
+ expect(updateFn).toHaveBeenCalled();
251
+ });
252
+
253
+ const lastValue = updateFn.mock.lastCall[0];
254
+ expect(lastValue).not.toBe(initialValue);
255
+ expect(lastValue.messages).not.toBe(initialMessagesList);
256
+ expect(lastValue.messages[0]).not.toBe(initialMessage1);
257
+ expect(lastValue.messages[0].reactions).not.toBe(initialMessageReactions);
258
+
259
+ // This shouldn't change
260
+ expect(lastValue.messages[1]).toBe(initialMessage2);
261
+
262
+ // TODO: The initial should point at that snapshot in time
263
+ // expect(lastValue.messages).not.toBe(initialValue.messages);
264
+ // expect(lastValue.messages[0]).not.toBe(initialValue.messages[0]);
265
+ // expect(lastValue.messages[1]).toBe(initialValue.messages[1]);
266
+ // expect(lastValue.messages[0].reactions).not.toBe(initialValue.messages[0].reactions);
267
+ });
268
+
269
+ it("should keep the same identity on the ref entities when a property is updated", async () => {
270
+ const { me, meOnSecondPeer } = await setupAccount();
271
+
272
+ const chatRoom = createChatRoom(me, "General");
273
+ const message = createMessage(me, "Hello Luigi, are you ready to save the princess?");
274
+ const message2 = createMessage(me, "Let's go!");
275
+ chatRoom.messages?.push(message);
276
+ chatRoom.messages?.push(message2);
277
+
278
+ const updateFn = vi.fn()
279
+
280
+ const unsubscribe = subscribeToCoValue(
281
+ ChatRoom,
282
+ chatRoom.id,
283
+ meOnSecondPeer,
284
+ {
285
+ messages: [{
286
+ reactions: [],
287
+ }],
288
+ },
289
+ updateFn,
290
+ );
291
+
292
+ onTestFinished(unsubscribe);
293
+
294
+ await waitFor(() => {
295
+ const lastValue = updateFn.mock.lastCall[0];
296
+
297
+ expect(lastValue?.messages?.[0]?.text).toBe(message.text);
298
+ expect(lastValue?.messages?.[1]?.text).toBe(message2.text);
299
+ });
300
+
301
+ const initialValue = updateFn.mock.lastCall[0];
302
+ chatRoom.name = "Me and Luigi";
303
+
304
+ updateFn.mockClear();
305
+
306
+ await waitFor(() => {
307
+ expect(updateFn).toHaveBeenCalled();
308
+ });
309
+
310
+ const lastValue = updateFn.mock.lastCall[0];
311
+ expect(lastValue).not.toBe(initialValue);
312
+ expect(lastValue.name).toBe("Me and Luigi");
313
+ expect(initialValue.name).toBe("General");
314
+
315
+ expect(lastValue.messages).toBe(initialValue.messages);
316
+ expect(lastValue.messages[0]).toBe(initialValue.messages[0]);
317
+ expect(lastValue.messages[1]).toBe(initialValue.messages[1]);
318
+ });
319
+ });
320
+
321
+
322
+ function waitFor(callback: () => boolean | void) {
323
+ return new Promise<void>((resolve, reject) => {
324
+ const checkPassed = () => {
325
+ try {
326
+ return { ok: callback(), error: null };
327
+ } catch (error) {
328
+ return { ok: false, error };
329
+ }
330
+ };
331
+
332
+ let retries = 0;
333
+
334
+ const interval = setInterval(() => {
335
+ const { ok, error } = checkPassed();
336
+
337
+ if (ok !== false) {
338
+ clearInterval(interval);
339
+ resolve();
340
+ }
341
+
342
+ if (++retries > 10) {
343
+ clearInterval(interval);
344
+ reject(error);
345
+ }
346
+ }, 100);
347
+ });
348
+ }
@@ -1,16 +0,0 @@
1
-
2
- > jazz-tools@0.8.3 build /Users/anselm/jazz/jazz/packages/jazz-tools
3
- > npm run lint && rm -rf ./dist && pnpm run build:web && pnpm run build:native
4
-
5
-
6
- > jazz-tools@0.8.3 lint
7
- > eslint . --ext ts,tsx
8
-
9
-
10
- > jazz-tools@0.8.3 build:web /Users/anselm/jazz/jazz/packages/jazz-tools
11
- > tsc --sourceMap --outDir dist/web -p tsconfig.web.json
12
-
13
-
14
- > jazz-tools@0.8.3 build:native /Users/anselm/jazz/jazz/packages/jazz-tools
15
- > tsc --sourceMap --outDir dist/native -p tsconfig.native.json
16
-
@@ -1,4 +0,0 @@
1
-
2
- > jazz-tools@0.7.35-guest-auth.5 lint /Users/anselm/jazz/jazz/packages/jazz-tools
3
- > eslint . --ext ts,tsx
4
-
@@ -1,144 +0,0 @@
1
-
2
- > jazz-tools@0.7.35-unique.2 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) 64ms
9
- stdout | unknown test
10
- TestMap schema undefined
11
-
12
- ✓ src/tests/deepLoading.test.ts (3 tests) 83ms
13
- stdout | src/tests/coList.test.ts > Simple CoList operations > Mutation > splice
14
- [ 'bread', 'onion' ] 0
15
- [ 'bread', 'salt', 'onion' ] 1
16
-
17
- stdout | src/tests/coList.test.ts > CoList resolution > Subscription & auto-resolution
18
- subscribedList?.[0]?.[0]?.[0] undefined
19
- subscribedList?.[0]?.[0]?.[0] undefined
20
- subscribedList?.[0]?.[0]?.[0] a
21
- subscribedList?.[0]?.[0]?.[0] x
22
- subscribedList?.[0]?.[0]?.[0] y
23
- subscribedList?.[0]?.[0]?.[0] w
24
-
25
- ✓ src/tests/coList.test.ts (10 tests) 190ms
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-09-05T17:35:38.414Z,
32
- tx: {
33
- sessionID: 'co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_ziAMdGVstAxF',
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-09-05T17:35:38.414Z,
44
- tx: {
45
- sessionID: 'co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_ziAMdGVstAxF',
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-09-05T17:35:38.414Z,
56
- tx: {
57
- sessionID: 'co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_ziAMdGVstAxF',
58
- txIndex: 0
59
- }
60
- }
61
- subscribedStream[me.id]?.value?.[me.id]?.value {
62
- id: 'co_zHELVqRmAN6YuGDpKqVrSXJ5qe1',
63
- _type: 'CoStream',
64
- perSession: undefined,
65
- co_zURWEpvoH1e35FGHVxadgXKU8Ri: 'milk',
66
- in: { co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_ziAMdGVstAxF: 'milk' }
67
- }
68
- subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value milk
69
- subscribedStream[me.id] {
70
- value: [Getter],
71
- ref: [Getter],
72
- by: [Getter],
73
- madeAt: 2024-09-05T17:35:38.414Z,
74
- tx: {
75
- sessionID: 'co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_ziAMdGVstAxF',
76
- txIndex: 0
77
- }
78
- }
79
- subscribedStream[me.id]?.value?.[me.id]?.value {
80
- id: 'co_zHELVqRmAN6YuGDpKqVrSXJ5qe1',
81
- _type: 'CoStream',
82
- perSession: undefined,
83
- co_zURWEpvoH1e35FGHVxadgXKU8Ri: 'bread',
84
- in: {
85
- co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_ziAMdGVstAxF: 'milk',
86
- co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_zgik2JjD86Qa: 'bread'
87
- }
88
- }
89
- subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value bread
90
- subscribedStream[me.id] {
91
- value: [Getter],
92
- ref: [Getter],
93
- by: [Getter],
94
- madeAt: 2024-09-05T17:35:38.424Z,
95
- tx: {
96
- sessionID: 'co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_zgik2JjD86Qa',
97
- txIndex: 0
98
- }
99
- }
100
- subscribedStream[me.id]?.value?.[me.id]?.value {
101
- id: 'co_zJmdvJY15XJkWF3n3rwPgGfebxa',
102
- _type: 'CoStream',
103
- perSession: undefined,
104
- co_zURWEpvoH1e35FGHVxadgXKU8Ri: 'butter',
105
- in: { co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_zgik2JjD86Qa: 'butter' }
106
- }
107
- subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value butter
108
- subscribedStream[me.id] {
109
- value: [Getter],
110
- ref: [Getter],
111
- by: [Getter],
112
- madeAt: 2024-09-05T17:35:38.424Z,
113
- tx: {
114
- sessionID: 'co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_zgik2JjD86Qa',
115
- txIndex: 0
116
- }
117
- }
118
- subscribedStream[me.id]?.value?.[me.id]?.value {
119
- id: 'co_zJmdvJY15XJkWF3n3rwPgGfebxa',
120
- _type: 'CoStream',
121
- perSession: undefined,
122
- co_zURWEpvoH1e35FGHVxadgXKU8Ri: 'jam',
123
- in: { co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_zgik2JjD86Qa: 'jam' }
124
- }
125
- subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value jam
126
-
127
- ✓ src/tests/coStream.test.ts (10 tests) 205ms
128
- stdout | src/tests/coMap.test.ts > CoMap resolution > Subscription & auto-resolution
129
- subscribedMap.nested?.twiceNested?.taste undefined
130
- subscribedMap.nested?.twiceNested?.taste undefined
131
- subscribedMap.nested?.twiceNested?.taste sour
132
- subscribedMap.nested?.twiceNested?.taste sour
133
- subscribedMap.nested?.twiceNested?.taste sweet
134
- subscribedMap.nested?.twiceNested?.taste sweet
135
- subscribedMap.nested?.twiceNested?.taste salty
136
- subscribedMap.nested?.twiceNested?.taste umami
137
-
138
- ✓ src/tests/coMap.test.ts (20 tests) 257ms
139
-
140
- Test Files 5 passed (5)
141
- Tests 44 passed (44)
142
- Start at 18:35:37
143
- Duration 929ms (transform 419ms, setup 0ms, collect 2.29s, tests 799ms, environment 0ms, prepare 298ms)
144
-