@diory/client-js 0.2.1 → 0.2.2
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.
|
@@ -15,8 +15,8 @@ declare class DioryClient implements IDioryClient {
|
|
|
15
15
|
initialiseDiograph: (roomObject: IRoomObject) => Promise<IDiograph>;
|
|
16
16
|
getDiograph: () => Promise<IDiographObject | undefined>;
|
|
17
17
|
saveDiograph: () => Promise<IDiographObject>;
|
|
18
|
-
importDiograph: () => Promise<IDiograph>;
|
|
19
|
-
generateDiograph: () => Promise<IDiographObject | undefined>;
|
|
18
|
+
importDiograph: (connections?: IConnectionObject[]) => Promise<IDiograph>;
|
|
19
|
+
generateDiograph: (connections?: IConnectionObject[]) => Promise<IDiographObject | undefined>;
|
|
20
20
|
getDiosphereClients: (connections?: IConnectionObject[]) => import("../types").IConnectionClient[];
|
|
21
21
|
initialiseDiosphere: (connections: IConnectionObject[]) => Promise<IDiosphere>;
|
|
22
22
|
getDiosphere: () => Promise<IDiosphereObject | undefined>;
|
|
@@ -23,13 +23,12 @@ class DioryClient {
|
|
|
23
23
|
};
|
|
24
24
|
this.initialiseDiograph = async (roomObject) => {
|
|
25
25
|
var _a;
|
|
26
|
-
console.info('initialiseDiograph', roomObject);
|
|
26
|
+
console.info('initialiseDiograph: room', roomObject);
|
|
27
27
|
this.selectRoom(roomObject);
|
|
28
28
|
this.diograph.resetDiograph();
|
|
29
29
|
const diographObject = (_a = (await this.getDiograph())) !== null && _a !== void 0 ? _a : (0, getDefaultDiograph_1.getDefaultDiograph)();
|
|
30
30
|
this.diograph.addDiograph(diographObject);
|
|
31
31
|
this.focusDiory({ id: '/' });
|
|
32
|
-
console.info(this.diograph.toObject());
|
|
33
32
|
return this.diograph;
|
|
34
33
|
};
|
|
35
34
|
this.getDiograph = async () => {
|
|
@@ -57,9 +56,9 @@ class DioryClient {
|
|
|
57
56
|
}));
|
|
58
57
|
return diographObject;
|
|
59
58
|
};
|
|
60
|
-
this.importDiograph = async () => {
|
|
59
|
+
this.importDiograph = async (connections) => {
|
|
61
60
|
var _a;
|
|
62
|
-
const diographObject = await this.generateDiograph();
|
|
61
|
+
const diographObject = await this.generateDiograph(connections);
|
|
63
62
|
if (diographObject) {
|
|
64
63
|
const diory = (_a = this.diory) === null || _a === void 0 ? void 0 : _a.toObject();
|
|
65
64
|
Object.entries(diographObject).forEach(([key, dioryObject]) => {
|
|
@@ -77,10 +76,10 @@ class DioryClient {
|
|
|
77
76
|
}
|
|
78
77
|
return this.diograph;
|
|
79
78
|
};
|
|
80
|
-
this.generateDiograph = async () => {
|
|
81
|
-
console.info('generateDiograph');
|
|
79
|
+
this.generateDiograph = async (connections) => {
|
|
80
|
+
console.info('generateDiograph', connections);
|
|
82
81
|
let diographObject;
|
|
83
|
-
await Promise.all(this.getDiographClients().map(async (connectionClient) => {
|
|
82
|
+
await Promise.all(this.getDiographClients(connections).map(async (connectionClient) => {
|
|
84
83
|
diographObject = await connectionClient.generateDiograph();
|
|
85
84
|
console.info(diographObject);
|
|
86
85
|
return;
|
|
@@ -92,13 +91,12 @@ class DioryClient {
|
|
|
92
91
|
};
|
|
93
92
|
this.initialiseDiosphere = async (connections) => {
|
|
94
93
|
var _a;
|
|
95
|
-
console.info('initialiseDiosphere', connections);
|
|
94
|
+
console.info('initialiseDiosphere: connections', connections);
|
|
96
95
|
this.connections = connections;
|
|
97
96
|
this.diosphere.resetRooms();
|
|
98
97
|
const diosphereObject = (_a = (await this.getDiosphere())) !== null && _a !== void 0 ? _a : (0, getDefaultDiosphere_1.getDefaultDiosphere)(connections);
|
|
99
98
|
this.diosphere.addDiosphere(diosphereObject);
|
|
100
99
|
this.selectRoom({ id: '/' });
|
|
101
|
-
console.info(this.diosphere.toObject());
|
|
102
100
|
return this.diosphere;
|
|
103
101
|
};
|
|
104
102
|
this.getDiosphere = async () => {
|
package/dist/types.d.ts
CHANGED
|
@@ -52,8 +52,8 @@ export interface IDioryClient {
|
|
|
52
52
|
initialiseDiograph: (roomObject: IRoomObject) => Promise<IDiograph>;
|
|
53
53
|
getDiograph: () => Promise<IDiographObject | undefined>;
|
|
54
54
|
saveDiograph: () => Promise<IDiographObject>;
|
|
55
|
-
importDiograph: () => Promise<IDiograph>;
|
|
56
|
-
generateDiograph: () => Promise<IDiographObject | undefined>;
|
|
55
|
+
importDiograph: (connections?: IConnectionObject[]) => Promise<IDiograph>;
|
|
56
|
+
generateDiograph: (connections?: IConnectionObject[]) => Promise<IDiographObject | undefined>;
|
|
57
57
|
diosphere: IDiosphere;
|
|
58
58
|
initialiseDiosphere: (connections: IConnectionObject[]) => Promise<IDiosphere>;
|
|
59
59
|
getDiosphere: () => Promise<IDiosphereObject | undefined>;
|
package/package.json
CHANGED
|
@@ -46,7 +46,7 @@ class DioryClient implements IDioryClient {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
initialiseDiograph = async (roomObject: IRoomObject): Promise<IDiograph> => {
|
|
49
|
-
console.info('initialiseDiograph', roomObject)
|
|
49
|
+
console.info('initialiseDiograph: room', roomObject)
|
|
50
50
|
this.selectRoom(roomObject)
|
|
51
51
|
|
|
52
52
|
this.diograph.resetDiograph()
|
|
@@ -55,7 +55,6 @@ class DioryClient implements IDioryClient {
|
|
|
55
55
|
|
|
56
56
|
this.focusDiory({ id: '/' })
|
|
57
57
|
|
|
58
|
-
console.info(this.diograph.toObject())
|
|
59
58
|
return this.diograph
|
|
60
59
|
}
|
|
61
60
|
|
|
@@ -93,8 +92,8 @@ class DioryClient implements IDioryClient {
|
|
|
93
92
|
return diographObject
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
importDiograph = async (): Promise<IDiograph> => {
|
|
97
|
-
const diographObject = await this.generateDiograph()
|
|
95
|
+
importDiograph = async (connections?: IConnectionObject[]): Promise<IDiograph> => {
|
|
96
|
+
const diographObject = await this.generateDiograph(connections)
|
|
98
97
|
|
|
99
98
|
if (diographObject) {
|
|
100
99
|
const diory = this.diory?.toObject()
|
|
@@ -115,12 +114,14 @@ class DioryClient implements IDioryClient {
|
|
|
115
114
|
return this.diograph
|
|
116
115
|
}
|
|
117
116
|
|
|
118
|
-
generateDiograph = async (
|
|
119
|
-
|
|
117
|
+
generateDiograph = async (
|
|
118
|
+
connections?: IConnectionObject[],
|
|
119
|
+
): Promise<IDiographObject | undefined> => {
|
|
120
|
+
console.info('generateDiograph', connections)
|
|
120
121
|
|
|
121
122
|
let diographObject
|
|
122
123
|
await Promise.all(
|
|
123
|
-
this.getDiographClients().map(async (connectionClient) => {
|
|
124
|
+
this.getDiographClients(connections).map(async (connectionClient) => {
|
|
124
125
|
diographObject = await connectionClient.generateDiograph()
|
|
125
126
|
console.info(diographObject)
|
|
126
127
|
return
|
|
@@ -135,7 +136,7 @@ class DioryClient implements IDioryClient {
|
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
initialiseDiosphere = async (connections: IConnectionObject[]): Promise<IDiosphere> => {
|
|
138
|
-
console.info('initialiseDiosphere', connections)
|
|
139
|
+
console.info('initialiseDiosphere: connections', connections)
|
|
139
140
|
this.connections = connections
|
|
140
141
|
|
|
141
142
|
this.diosphere.resetRooms()
|
|
@@ -144,7 +145,6 @@ class DioryClient implements IDioryClient {
|
|
|
144
145
|
|
|
145
146
|
this.selectRoom({ id: '/' })
|
|
146
147
|
|
|
147
|
-
console.info(this.diosphere.toObject())
|
|
148
148
|
return this.diosphere
|
|
149
149
|
}
|
|
150
150
|
|
package/src/types.ts
CHANGED
|
@@ -62,8 +62,8 @@ export interface IDioryClient {
|
|
|
62
62
|
initialiseDiograph: (roomObject: IRoomObject) => Promise<IDiograph>
|
|
63
63
|
getDiograph: () => Promise<IDiographObject | undefined>
|
|
64
64
|
saveDiograph: () => Promise<IDiographObject>
|
|
65
|
-
importDiograph: () => Promise<IDiograph>
|
|
66
|
-
generateDiograph: () => Promise<IDiographObject | undefined>
|
|
65
|
+
importDiograph: (connections?: IConnectionObject[]) => Promise<IDiograph>
|
|
66
|
+
generateDiograph: (connections?: IConnectionObject[]) => Promise<IDiographObject | undefined>
|
|
67
67
|
diosphere: IDiosphere
|
|
68
68
|
initialiseDiosphere: (connections: IConnectionObject[]) => Promise<IDiosphere>
|
|
69
69
|
getDiosphere: () => Promise<IDiosphereObject | undefined>
|