@diory/client-js 0.2.0-rc14 → 0.2.0-rc16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,9 @@ class DioryClient {
23
23
  this.diosphere.resetRooms();
24
24
  const diosphereObject = (_a = (await this.getDiosphere())) !== null && _a !== void 0 ? _a : (0, getDefaultDiosphere_1.getDefaultDiosphere)(connections);
25
25
  this.diosphere.addDiosphere(diosphereObject);
26
+ await this.saveDiosphere();
26
27
  this.selectRoom({ id: '/' });
28
+ console.info(this.diosphere.toObject());
27
29
  return this.diosphere;
28
30
  };
29
31
  this.getDiosphere = async (connections) => {
@@ -32,7 +34,7 @@ class DioryClient {
32
34
  await Promise.all(this.getDiosphereClients(connections).map(async (connectionClient) => {
33
35
  try {
34
36
  diosphereObject = await connectionClient.getDiosphere();
35
- console.info(this.diosphere.toObject());
37
+ console.info(diosphereObject);
36
38
  }
37
39
  catch (error) {
38
40
  console.error(error);
@@ -65,7 +67,9 @@ class DioryClient {
65
67
  this.diograph.resetDiograph();
66
68
  const diographObject = (_a = (await this.getDiograph())) !== null && _a !== void 0 ? _a : (0, getDefaultDiograph_1.getDefaultDiograph)();
67
69
  this.diograph.addDiograph(diographObject);
70
+ await this.saveDiograph();
68
71
  this.focusDiory({ id: '/' });
72
+ console.info(this.diograph.toObject());
69
73
  return this.diograph;
70
74
  };
71
75
  this.getDiograph = async (connections) => {
@@ -97,11 +101,17 @@ class DioryClient {
97
101
  console.info('generateDiograph', connections);
98
102
  await Promise.all(this.getDiographClients(connections).map(async (connectionClient) => {
99
103
  const diographObject = await connectionClient.generateDiograph();
100
- Object.entries(diographObject).forEach(([key, dioryObject]) => {
101
- key === '/'
102
- ? this.diograph.addDioryLink({ id: '/' }, diographObject['/'])
103
- : this.diograph.addDiory(dioryObject);
104
- });
104
+ console.info(diographObject);
105
+ try {
106
+ Object.entries(diographObject).forEach(([key, dioryObject]) => {
107
+ key === '/'
108
+ ? this.diograph.addDioryLink({ id: '/' }, diographObject['/'])
109
+ : this.diograph.addDiory(dioryObject);
110
+ });
111
+ }
112
+ catch (error) {
113
+ console.error(error);
114
+ }
105
115
  await connectionClient.saveDiograph(this.diograph.toObject());
106
116
  console.info(this.diograph.toObject());
107
117
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diory/client-js",
3
- "version": "0.2.0-rc14",
3
+ "version": "0.2.0-rc16",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "Olli-Pekka Pohjola <op@diory.me>, Jouni Alanen <jouni@diory.me>",
@@ -47,9 +47,11 @@ class DioryClient implements IDioryClient {
47
47
  this.diosphere.resetRooms()
48
48
  const diosphereObject = (await this.getDiosphere()) ?? getDefaultDiosphere(connections)
49
49
  this.diosphere.addDiosphere(diosphereObject)
50
+ await this.saveDiosphere()
50
51
 
51
52
  this.selectRoom({ id: '/' })
52
53
 
54
+ console.info(this.diosphere.toObject())
53
55
  return this.diosphere
54
56
  }
55
57
 
@@ -63,7 +65,7 @@ class DioryClient implements IDioryClient {
63
65
  this.getDiosphereClients(connections).map(async (connectionClient) => {
64
66
  try {
65
67
  diosphereObject = await connectionClient.getDiosphere()
66
- console.info(this.diosphere.toObject())
68
+ console.info(diosphereObject)
67
69
  } catch (error) {
68
70
  console.error(error)
69
71
  }
@@ -104,9 +106,11 @@ class DioryClient implements IDioryClient {
104
106
  this.diograph.resetDiograph()
105
107
  const diographObject = (await this.getDiograph()) ?? getDefaultDiograph()
106
108
  this.diograph.addDiograph(diographObject)
109
+ await this.saveDiograph()
107
110
 
108
111
  this.focusDiory({ id: '/' })
109
112
 
113
+ console.info(this.diograph.toObject())
110
114
  return this.diograph
111
115
  }
112
116
 
@@ -150,11 +154,17 @@ class DioryClient implements IDioryClient {
150
154
  await Promise.all(
151
155
  this.getDiographClients(connections).map(async (connectionClient) => {
152
156
  const diographObject = await connectionClient.generateDiograph()
153
- Object.entries(diographObject).forEach(([key, dioryObject]) => {
154
- key === '/'
155
- ? this.diograph.addDioryLink({ id: '/' }, diographObject['/'])
156
- : this.diograph.addDiory(dioryObject)
157
- })
157
+ console.info(diographObject)
158
+
159
+ try {
160
+ Object.entries(diographObject).forEach(([key, dioryObject]) => {
161
+ key === '/'
162
+ ? this.diograph.addDioryLink({ id: '/' }, diographObject['/'])
163
+ : this.diograph.addDiory(dioryObject)
164
+ })
165
+ } catch (error) {
166
+ console.error(error)
167
+ }
158
168
 
159
169
  await connectionClient.saveDiograph(this.diograph.toObject())
160
170
  console.info(this.diograph.toObject())