@diory/client-js 0.2.0-rc13 → 0.2.0-rc14
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.
- package/dist/dioryClient/defaultDiograph.json +22 -21
- package/dist/dioryClient/defaultDiosphere.d.ts +21 -0
- package/dist/dioryClient/defaultDiosphere.js +26 -0
- package/dist/dioryClient/defaultDiosphere.json +19 -19
- package/dist/dioryClient/dioryClient.js +4 -7
- package/dist/dioryClient/getDefaultDiograph.d.ts +2 -0
- package/dist/dioryClient/getDefaultDiograph.js +17 -0
- package/dist/dioryClient/getDefaultDiosphere.d.ts +2 -0
- package/dist/dioryClient/getDefaultDiosphere.js +13 -0
- package/package.json +1 -1
- package/src/dioryClient/dioryClient.ts +4 -4
- package/src/dioryClient/getDefaultDiograph.ts +18 -0
- package/src/dioryClient/getDefaultDiosphere.ts +14 -0
- package/src/dioryClient/defaultDiograph.json +0 -23
- package/src/dioryClient/defaultDiosphere.json +0 -23
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
"/": {
|
|
3
|
+
"id": "welcome-root-diory"
|
|
4
|
+
},
|
|
5
|
+
"welcome-root-diory": {
|
|
6
|
+
"id": "welcome-root-diory",
|
|
7
|
+
"text": "Room",
|
|
8
|
+
"image": "",
|
|
9
|
+
"links": [
|
|
10
|
+
{
|
|
11
|
+
"id": "welcome-diory"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"modified": "2020-01-03T14:03:04.751Z"
|
|
15
|
+
},
|
|
16
|
+
"welcome-diory": {
|
|
17
|
+
"id": "welcome-diory",
|
|
18
|
+
"image": "",
|
|
19
|
+
"modified": "2020-01-03T14:03:04.751Z",
|
|
20
|
+
"text": "Welcome to Diory",
|
|
21
|
+
"latitude": 60.01366036242365,
|
|
22
|
+
"longitude": 20.007133483886722
|
|
23
|
+
}
|
|
23
24
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const diosphere: {
|
|
2
|
+
rooms: {
|
|
3
|
+
'/': {
|
|
4
|
+
id: string
|
|
5
|
+
created: string
|
|
6
|
+
modified: string
|
|
7
|
+
}
|
|
8
|
+
'welcome-room': {
|
|
9
|
+
id: string
|
|
10
|
+
text: string
|
|
11
|
+
doors: never[]
|
|
12
|
+
connections: {
|
|
13
|
+
id: string
|
|
14
|
+
client: string
|
|
15
|
+
address: string
|
|
16
|
+
}[]
|
|
17
|
+
created: string
|
|
18
|
+
modified: string
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
3
|
+
exports.diosphere = void 0
|
|
4
|
+
exports.diosphere = {
|
|
5
|
+
rooms: {
|
|
6
|
+
'/': {
|
|
7
|
+
id: 'welcome-room',
|
|
8
|
+
created: '2024-03-24T14:56:21.243Z',
|
|
9
|
+
modified: '2024-03-24T14:56:21.243Z',
|
|
10
|
+
},
|
|
11
|
+
'welcome-room': {
|
|
12
|
+
id: 'welcome-room',
|
|
13
|
+
text: 'Wellcome',
|
|
14
|
+
doors: [],
|
|
15
|
+
connections: [
|
|
16
|
+
{
|
|
17
|
+
id: 'welcome-connection',
|
|
18
|
+
client: 'LocalClient',
|
|
19
|
+
address: 'public/welcome-room',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
created: '2024-03-24T14:56:21.243Z',
|
|
23
|
+
modified: '2024-03-24T14:56:21.243Z',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"created": "2024-03-24T14:56:21.243Z",
|
|
20
|
-
"modified": "2024-03-24T14:56:21.243Z"
|
|
2
|
+
"rooms": {
|
|
3
|
+
"/": {
|
|
4
|
+
"id": "welcome-room",
|
|
5
|
+
"created": "2024-03-24T14:56:21.243Z",
|
|
6
|
+
"modified": "2024-03-24T14:56:21.243Z"
|
|
7
|
+
},
|
|
8
|
+
"welcome-room": {
|
|
9
|
+
"id": "welcome-room",
|
|
10
|
+
"text": "Wellcome room",
|
|
11
|
+
"doors": [],
|
|
12
|
+
"connections": [
|
|
13
|
+
{
|
|
14
|
+
"id": "welcome-room",
|
|
15
|
+
"client": "LocalClient",
|
|
16
|
+
"address": "public/welcome-room"
|
|
21
17
|
}
|
|
18
|
+
],
|
|
19
|
+
"created": "2024-03-24T14:56:21.243Z",
|
|
20
|
+
"modified": "2024-03-24T14:56:21.243Z"
|
|
22
21
|
}
|
|
22
|
+
}
|
|
23
23
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.DioryClient = void 0;
|
|
7
4
|
const diosphere_js_1 = require("@diory/diosphere-js");
|
|
8
5
|
const diograph_1 = require("@diograph/diograph");
|
|
9
6
|
const getConnectionClients_1 = require("../utils/getConnectionClients");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
7
|
+
const getDefaultDiosphere_1 = require("./getDefaultDiosphere");
|
|
8
|
+
const getDefaultDiograph_1 = require("./getDefaultDiograph");
|
|
12
9
|
class DioryClient {
|
|
13
10
|
constructor(dataClients) {
|
|
14
11
|
this.dataClients = [];
|
|
@@ -24,7 +21,7 @@ class DioryClient {
|
|
|
24
21
|
console.info('initialiseDiosphere', connections);
|
|
25
22
|
this.connections = connections;
|
|
26
23
|
this.diosphere.resetRooms();
|
|
27
|
-
const diosphereObject = (_a = (await this.getDiosphere())) !== null && _a !== void 0 ? _a :
|
|
24
|
+
const diosphereObject = (_a = (await this.getDiosphere())) !== null && _a !== void 0 ? _a : (0, getDefaultDiosphere_1.getDefaultDiosphere)(connections);
|
|
28
25
|
this.diosphere.addDiosphere(diosphereObject);
|
|
29
26
|
this.selectRoom({ id: '/' });
|
|
30
27
|
return this.diosphere;
|
|
@@ -66,7 +63,7 @@ class DioryClient {
|
|
|
66
63
|
console.info('initialiseDiograph', roomObject);
|
|
67
64
|
this.selectRoom(roomObject);
|
|
68
65
|
this.diograph.resetDiograph();
|
|
69
|
-
const diographObject = (_a = (await this.getDiograph())) !== null && _a !== void 0 ? _a :
|
|
66
|
+
const diographObject = (_a = (await this.getDiograph())) !== null && _a !== void 0 ? _a : (0, getDefaultDiograph_1.getDefaultDiograph)();
|
|
70
67
|
this.diograph.addDiograph(diographObject);
|
|
71
68
|
this.focusDiory({ id: '/' });
|
|
72
69
|
return this.diograph;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultDiograph = void 0;
|
|
4
|
+
const diograph_1 = require("@diograph/diograph");
|
|
5
|
+
const getDefaultDiograph = () => {
|
|
6
|
+
const diograph = new diograph_1.Diograph();
|
|
7
|
+
const diory = diograph.addDiory({
|
|
8
|
+
text: 'Welcome to Diory',
|
|
9
|
+
latlng: '60.01366036242365, 20.007133483886722',
|
|
10
|
+
});
|
|
11
|
+
diograph.addDiory({
|
|
12
|
+
text: 'Room root',
|
|
13
|
+
links: [{ id: diory.id }],
|
|
14
|
+
}, '/');
|
|
15
|
+
return diograph.toObject();
|
|
16
|
+
};
|
|
17
|
+
exports.getDefaultDiograph = getDefaultDiograph;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultDiosphere = void 0;
|
|
4
|
+
const diosphere_js_1 = require("@diory/diosphere-js");
|
|
5
|
+
const getDefaultDiosphere = (connections) => {
|
|
6
|
+
const diosphere = new diosphere_js_1.Diosphere();
|
|
7
|
+
diosphere.addRoom({
|
|
8
|
+
text: 'Welcome room',
|
|
9
|
+
connections,
|
|
10
|
+
}, '/');
|
|
11
|
+
return diosphere.toObject();
|
|
12
|
+
};
|
|
13
|
+
exports.getDefaultDiosphere = getDefaultDiosphere;
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@ import { Diograph, IDiograph, IDiographObject, IDiory, IDioryObject } from '@dio
|
|
|
11
11
|
import { IDioryClient, IDataClient } from '../types'
|
|
12
12
|
import { getConnectionClients } from '../utils/getConnectionClients'
|
|
13
13
|
|
|
14
|
-
import
|
|
15
|
-
import
|
|
14
|
+
import { getDefaultDiosphere } from './getDefaultDiosphere'
|
|
15
|
+
import { getDefaultDiograph } from './getDefaultDiograph'
|
|
16
16
|
|
|
17
17
|
class DioryClient implements IDioryClient {
|
|
18
18
|
dataClients: IDataClient[] = []
|
|
@@ -45,7 +45,7 @@ class DioryClient implements IDioryClient {
|
|
|
45
45
|
this.connections = connections
|
|
46
46
|
|
|
47
47
|
this.diosphere.resetRooms()
|
|
48
|
-
const diosphereObject = (await this.getDiosphere()) ??
|
|
48
|
+
const diosphereObject = (await this.getDiosphere()) ?? getDefaultDiosphere(connections)
|
|
49
49
|
this.diosphere.addDiosphere(diosphereObject)
|
|
50
50
|
|
|
51
51
|
this.selectRoom({ id: '/' })
|
|
@@ -102,7 +102,7 @@ class DioryClient implements IDioryClient {
|
|
|
102
102
|
this.selectRoom(roomObject)
|
|
103
103
|
|
|
104
104
|
this.diograph.resetDiograph()
|
|
105
|
-
const diographObject = (await this.getDiograph()) ??
|
|
105
|
+
const diographObject = (await this.getDiograph()) ?? getDefaultDiograph()
|
|
106
106
|
this.diograph.addDiograph(diographObject)
|
|
107
107
|
|
|
108
108
|
this.focusDiory({ id: '/' })
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Diograph, IDiographObject } from '@diograph/diograph'
|
|
2
|
+
|
|
3
|
+
export const getDefaultDiograph = (): IDiographObject => {
|
|
4
|
+
const diograph = new Diograph()
|
|
5
|
+
const diory = diograph.addDiory({
|
|
6
|
+
text: 'Welcome to Diory',
|
|
7
|
+
latlng: '60.01366036242365, 20.007133483886722',
|
|
8
|
+
})
|
|
9
|
+
diograph.addDiory(
|
|
10
|
+
{
|
|
11
|
+
text: 'Room root',
|
|
12
|
+
links: [{ id: diory.id }],
|
|
13
|
+
},
|
|
14
|
+
'/',
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
return diograph.toObject()
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Diosphere, IConnectionObject, IDiosphereObject } from '@diory/diosphere-js'
|
|
2
|
+
|
|
3
|
+
export const getDefaultDiosphere = (connections: IConnectionObject[]): IDiosphereObject => {
|
|
4
|
+
const diosphere = new Diosphere()
|
|
5
|
+
diosphere.addRoom(
|
|
6
|
+
{
|
|
7
|
+
text: 'Welcome room',
|
|
8
|
+
connections,
|
|
9
|
+
},
|
|
10
|
+
'/',
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
return diosphere.toObject()
|
|
14
|
+
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"/": {
|
|
3
|
-
"id": "welcome-root-diory"
|
|
4
|
-
},
|
|
5
|
-
"welcome-root-diory": {
|
|
6
|
-
"id": "welcome-root-diory",
|
|
7
|
-
"image": "",
|
|
8
|
-
"links": [
|
|
9
|
-
{
|
|
10
|
-
"id": "welcome-diory"
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"modified": "2020-01-03T14:03:04.751Z"
|
|
14
|
-
},
|
|
15
|
-
"welcome-diory": {
|
|
16
|
-
"id": "welcome-diory",
|
|
17
|
-
"image": "",
|
|
18
|
-
"modified": "2020-01-03T14:03:04.751Z",
|
|
19
|
-
"text": "Welcome to Diory",
|
|
20
|
-
"latitude": 60.01366036242365,
|
|
21
|
-
"longitude": 20.007133483886722
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"rooms": {
|
|
3
|
-
"/": {
|
|
4
|
-
"id": "welcome-room",
|
|
5
|
-
"created": "2024-03-24T14:56:21.243Z",
|
|
6
|
-
"modified": "2024-03-24T14:56:21.243Z"
|
|
7
|
-
},
|
|
8
|
-
"welcome-room": {
|
|
9
|
-
"id": "welcome-room",
|
|
10
|
-
"text": "Wellcome room",
|
|
11
|
-
"doors": [],
|
|
12
|
-
"connections": [
|
|
13
|
-
{
|
|
14
|
-
"id": "welcome-room",
|
|
15
|
-
"client": "LocalClient",
|
|
16
|
-
"address": "public/welcome-room"
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"created": "2024-03-24T14:56:21.243Z",
|
|
20
|
-
"modified": "2024-03-24T14:56:21.243Z"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|