@diory/client-js 0.1.0

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.
@@ -0,0 +1,44 @@
1
+ name: Publish to NPM
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: 'Specify the version to publish'
8
+ required: true
9
+
10
+ jobs:
11
+ publish:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: write
15
+
16
+ steps:
17
+ - name: Checkout code
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Setup Node.js
21
+ uses: actions/setup-node@v4
22
+ with:
23
+ node-version-file: '.nvmrc'
24
+ registry-url: 'https://registry.npmjs.org'
25
+
26
+ - name: Install dependencies
27
+ run: yarn install
28
+
29
+ - name: Build
30
+ run: yarn build
31
+
32
+ - name: Update version using Yarn
33
+ run: |
34
+ git config user.email "<>"
35
+ git config user.name "GitHub Actions Bot"
36
+ yarn version --new-version ${{ github.event.inputs.version }}
37
+
38
+ - name: Push version update commit
39
+ run: git push origin HEAD --follow-tags
40
+
41
+ - name: Publish to NPM
42
+ run: npm publish --access=public --tag=next
43
+ env:
44
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
@@ -0,0 +1,23 @@
1
+ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
+
4
+ name: Test (yarn test)
5
+
6
+ on: [push]
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ env:
12
+ CI: false
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ with:
16
+ submodules: recursive
17
+ - name: Use Node.js
18
+ uses: actions/setup-node@v4
19
+ with:
20
+ node-version-file: '.nvmrc'
21
+ - run: yarn
22
+ - run: yarn build
23
+ - run: yarn test
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 20.10.0
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Diosphere
2
+
3
+ ## Install
4
+
5
+ ```
6
+ npm install @diory/client-js
7
+ # or
8
+ yarn add @diory/client-js
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```
14
+ const clients = [localClient, S3Client, ...]
15
+ const { diosphere, room, diograph, diory } = DioryClient(clients)
16
+ diosphere.initialise([connection])
17
+ diosphere.enterRoom(room)
18
+ diograph.focusDiory(diory)
19
+ console.log('Hello Diosphere!', diosphere.toObject())
20
+ ```
21
+
22
+ ### Internal methods
23
+
24
+ ```
25
+ client.getDiosphere()
26
+ client.saveDiosphere()
27
+ client.getDiograph()
28
+ client.saveDiograph()
29
+ ```
30
+
31
+ ## Development
32
+
33
+ Compile typescript in real time to `/dist` folder:
34
+
35
+ ```
36
+ yarn build-watch
37
+ ```
38
+
39
+ Run unit tests in the background:
40
+
41
+ ```
42
+ yarn test-watch
43
+ ```
@@ -0,0 +1,14 @@
1
+ import { IDiographObject } from '@diograph/diograph';
2
+ import { IConnectionObject, IDiosphereObject } from '@diory/diosphere-js';
3
+ import { IConnectionClient, IDataClient } from './types';
4
+ declare class ConnectionClient implements IConnectionClient {
5
+ type: string;
6
+ client: IDataClient;
7
+ connection: IConnectionObject;
8
+ constructor(dataClient: IDataClient, connection: IConnectionObject);
9
+ getDiosphere: () => Promise<any>;
10
+ saveDiosphere: (diosphereObject: IDiosphereObject) => Promise<boolean>;
11
+ getDiograph: () => Promise<any>;
12
+ saveDiograph: (diographObject: IDiographObject) => Promise<boolean>;
13
+ }
14
+ export { ConnectionClient };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectionClient = void 0;
4
+ const path_browserify_1 = require("path-browserify");
5
+ const DIOSPHERE_JSON = 'diosphere.json';
6
+ const DIOGRAPH_JSON = 'diograph.json';
7
+ class ConnectionClient {
8
+ constructor(dataClient, connection) {
9
+ this.getDiosphere = async () => {
10
+ const diosphereString = await this.client.readTextItem((0, path_browserify_1.join)(this.connection.address, DIOSPHERE_JSON));
11
+ return JSON.parse(diosphereString);
12
+ };
13
+ this.saveDiosphere = async (diosphereObject) => {
14
+ const diosphereString = JSON.stringify(diosphereObject);
15
+ return this.client.writeItem((0, path_browserify_1.join)(this.connection.address, DIOSPHERE_JSON), diosphereString);
16
+ };
17
+ this.getDiograph = async () => {
18
+ const diographString = await this.client.readTextItem((0, path_browserify_1.join)(this.connection.address, DIOGRAPH_JSON));
19
+ return JSON.parse(diographString);
20
+ };
21
+ this.saveDiograph = async (diographObject) => {
22
+ const diosphereString = JSON.stringify(diographObject);
23
+ return this.client.writeItem((0, path_browserify_1.join)(this.connection.address, DIOGRAPH_JSON), diosphereString);
24
+ };
25
+ this.type = dataClient.type;
26
+ this.client = dataClient;
27
+ this.connection = connection;
28
+ }
29
+ }
30
+ exports.ConnectionClient = ConnectionClient;
@@ -0,0 +1,20 @@
1
+ import { IConnectionObject, IDiosphere, IRoom, IRoomObject } from '@diory/diosphere-js';
2
+ import { IDiograph, IDiory, IDioryObject } from '@diograph/diograph';
3
+ import { IDataClient, IDioryClient } from './types';
4
+ declare class DioryClient implements IDioryClient {
5
+ dataClients: IDataClient[];
6
+ connections: IConnectionObject[];
7
+ diosphere: IDiosphere;
8
+ room?: IRoom;
9
+ diograph: IDiograph;
10
+ diory?: IDiory;
11
+ constructor(dataClients: IDataClient[]);
12
+ initialise: (connections: IConnectionObject[]) => Promise<void>;
13
+ getDiosphere: () => Promise<void>;
14
+ saveDiosphere: () => Promise<void>;
15
+ enterRoom: (roomObject: IRoomObject) => Promise<IRoom>;
16
+ getDiograph: () => Promise<void>;
17
+ saveDiograph: () => Promise<void>;
18
+ focusDiory: (dioryObject: IDioryObject) => IDiory;
19
+ }
20
+ export { DioryClient };
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DioryClient = void 0;
4
+ const diosphere_js_1 = require("@diory/diosphere-js");
5
+ const diograph_1 = require("@diograph/diograph");
6
+ const connectionClient_1 = require("./connectionClient");
7
+ function getDataClient(dataClients, { client }) {
8
+ return dataClients.find(({ type }) => type === client);
9
+ }
10
+ function getConnectionClients(dataClients, connections) {
11
+ return connections
12
+ .filter(({ client }) => dataClients.some(({ type }) => type === client))
13
+ .map((connection) => {
14
+ const dataClient = getDataClient(dataClients, connection);
15
+ return new connectionClient_1.ConnectionClient(dataClient, connection);
16
+ });
17
+ }
18
+ class DioryClient {
19
+ constructor(dataClients) {
20
+ this.dataClients = [];
21
+ this.connections = [];
22
+ this.initialise = async (connections) => {
23
+ this.connections = connections;
24
+ await this.getDiosphere();
25
+ await this.enterRoom({ id: '/' });
26
+ await this.focusDiory({ id: '/' });
27
+ return;
28
+ };
29
+ this.getDiosphere = async () => {
30
+ console.info('getDiosphere', this.connections);
31
+ if (this.connections) {
32
+ const connectionClients = getConnectionClients(this.dataClients, this.connections);
33
+ await Promise.all(connectionClients.map(async (connectionClient) => {
34
+ const diosphereObject = await connectionClient.getDiosphere();
35
+ console.info(diosphereObject);
36
+ return this.diosphere.initialise(diosphereObject);
37
+ }));
38
+ }
39
+ return;
40
+ };
41
+ this.saveDiosphere = async () => {
42
+ console.info('saveDiosphere', this.connections);
43
+ if (this.connections) {
44
+ const connectionClients = getConnectionClients(this.dataClients, this.connections);
45
+ await Promise.all(connectionClients.map((connectionClient) => {
46
+ console.info(this.diosphere.toObject());
47
+ return connectionClient.saveDiosphere(this.diosphere.toObject());
48
+ }));
49
+ }
50
+ return;
51
+ };
52
+ this.enterRoom = async (roomObject) => {
53
+ this.room = this.diosphere.getRoom(roomObject);
54
+ await this.getDiograph();
55
+ return this.room;
56
+ };
57
+ this.getDiograph = async () => {
58
+ var _a, _b;
59
+ console.info('getDiograph', (_a = this.room) === null || _a === void 0 ? void 0 : _a.connections);
60
+ if ((_b = this.room) === null || _b === void 0 ? void 0 : _b.connections) {
61
+ const connectionClients = getConnectionClients(this.dataClients, this.room.connections);
62
+ await Promise.all(connectionClients.map(async (connectionClient) => {
63
+ const diographObject = await connectionClient.getDiograph();
64
+ console.info(diographObject);
65
+ return this.diograph.initialise(diographObject);
66
+ }));
67
+ }
68
+ return;
69
+ };
70
+ this.saveDiograph = async () => {
71
+ var _a, _b;
72
+ console.info('saveDiograph', (_a = this.room) === null || _a === void 0 ? void 0 : _a.connections);
73
+ if ((_b = this.room) === null || _b === void 0 ? void 0 : _b.connections) {
74
+ const connectionClients = getConnectionClients(this.dataClients, this.room.connections);
75
+ await Promise.all(connectionClients.map((connectionClient) => {
76
+ console.info(this.diograph.toObject());
77
+ return connectionClient.saveDiograph(this.diograph.toObject());
78
+ }));
79
+ }
80
+ return;
81
+ };
82
+ this.focusDiory = (dioryObject) => {
83
+ return (this.diory = this.diograph.getDiory(dioryObject));
84
+ };
85
+ this.dataClients = dataClients;
86
+ this.diosphere = new diosphere_js_1.Diosphere();
87
+ this.diograph = new diograph_1.Diograph();
88
+ this.diosphere.saveDiosphere = this.saveDiosphere;
89
+ this.diograph.saveDiograph = this.saveDiograph;
90
+ }
91
+ }
92
+ exports.DioryClient = DioryClient;
File without changes
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ describe('dioryClient', () => {
3
+ describe('initialise()', () => {
4
+ it('should initialise with connections', () => {
5
+ expect(true).toEqual(true);
6
+ });
7
+ });
8
+ });
@@ -0,0 +1,3 @@
1
+ export { DioryClient } from './dioryClient';
2
+ export { ConnectionClient } from './connectionClient';
3
+ export { IDioryClient, IConnectionClient, IDataClient } from './types';
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectionClient = exports.DioryClient = void 0;
4
+ var dioryClient_1 = require("./dioryClient");
5
+ Object.defineProperty(exports, "DioryClient", { enumerable: true, get: function () { return dioryClient_1.DioryClient; } });
6
+ var connectionClient_1 = require("./connectionClient");
7
+ Object.defineProperty(exports, "ConnectionClient", { enumerable: true, get: function () { return connectionClient_1.ConnectionClient; } });
@@ -0,0 +1,40 @@
1
+ /// <reference types="node" />
2
+ import { IConnectionObject, IDiosphere, IDiosphereObject, IRoom, IRoomObject } from '@diory/diosphere-js';
3
+ import { IDiograph, IDiory } from '@diograph/diograph';
4
+ import { IDiographObject, IDioryObject } from '@diograph/diograph';
5
+ export interface IDataClient {
6
+ type: string;
7
+ readTextItem(url: string): Promise<string>;
8
+ readItem(url: string): Promise<Buffer>;
9
+ readToStream(url: string): any;
10
+ exists(url: string): Promise<boolean>;
11
+ writeTextItem(url: string, fileContent: string): Promise<boolean>;
12
+ writeItem(url: string, fileContent: Buffer | string): Promise<boolean>;
13
+ deleteItem(url: string): Promise<boolean>;
14
+ deleteFolder(url: string): Promise<void>;
15
+ list(url: string): Promise<string[]>;
16
+ }
17
+ export interface IConnectionClient {
18
+ type: string;
19
+ client: IDataClient;
20
+ connection: IConnectionObject;
21
+ getDiosphere: () => Promise<IDiosphereObject>;
22
+ saveDiosphere: (diosphereObject: IDiosphereObject) => void;
23
+ getDiograph: () => Promise<IDiographObject>;
24
+ saveDiograph: (diographObject: IDiographObject) => void;
25
+ }
26
+ export interface IDioryClient {
27
+ dataClients: IDataClient[];
28
+ connections: IConnectionObject[];
29
+ diosphere: IDiosphere;
30
+ room?: IRoom;
31
+ diograph: IDiograph;
32
+ diory?: IDiory;
33
+ initialise: (connections: IConnectionObject[]) => Promise<void>;
34
+ getDiosphere: () => void;
35
+ saveDiosphere: () => void;
36
+ enterRoom: (roomObject: IRoomObject) => Promise<IRoom>;
37
+ getDiograph: () => void;
38
+ saveDiograph: () => void;
39
+ focusDiory: (dioryObject: IDioryObject) => IDiory;
40
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/jest.config.js ADDED
@@ -0,0 +1,6 @@
1
+ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2
+ module.exports = {
3
+ preset: 'ts-jest',
4
+ testEnvironment: 'node',
5
+ testPathIgnorePatterns: ['dist', 'node_modules'],
6
+ }
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@diory/client-js",
3
+ "version": "0.1.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "author": "Olli-Pekka Pohjola <op@diory.me>, Jouni Alanen <jouni@diory.me>",
7
+ "license": "MIT",
8
+ "dependencies": {
9
+ "@diograph/diograph": "^0.1.2",
10
+ "@diory/diosphere-js": "^0.2.5",
11
+ "path": "^0.12.7",
12
+ "path-browserify": "^1.0.1",
13
+ "uuid": "8.3.2"
14
+ },
15
+ "devDependencies": {
16
+ "@types/jest": "^27.4.0",
17
+ "@types/path-browserify": "^1.0.2",
18
+ "@types/uuid": "8.3.2",
19
+ "jest": "^27.5.0",
20
+ "prettier": "^2.5.1",
21
+ "ts-jest": "^27.1.3",
22
+ "typescript": "^4.5.5"
23
+ },
24
+ "scripts": {
25
+ "build": "tsc",
26
+ "build-watch": "yarn build --watch",
27
+ "prettier": "prettier --write .",
28
+ "test": "jest . --verbose",
29
+ "test-watch": "yarn test --watch",
30
+ "prepare": "yarn prettier && yarn test && yarn build",
31
+ "release-candidate": "yarn prepare && yarn version --no-git-tag-version && npm publish",
32
+ "release": "yarn prepare && yarn version && npm publish"
33
+ },
34
+ "prettier": {
35
+ "tabWidth": 2,
36
+ "semi": false,
37
+ "singleQuote": true,
38
+ "printWidth": 100,
39
+ "trailingComma": "all"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/DioryMe/diosphere-js.git"
44
+ },
45
+ "keywords": [
46
+ "diory",
47
+ "diosphere"
48
+ ],
49
+ "bugs": {
50
+ "url": "https://github.com/DioryMe/diosphere-js/issues"
51
+ },
52
+ "homepage": "https://github.com/DioryMe/diosphere-js#readme"
53
+ }
@@ -0,0 +1,46 @@
1
+ import { join } from 'path-browserify'
2
+
3
+ import { IDiographObject } from '@diograph/diograph'
4
+ import { IConnectionObject, IDiosphereObject } from '@diory/diosphere-js'
5
+ import { IConnectionClient, IDataClient } from './types'
6
+
7
+ const DIOSPHERE_JSON = 'diosphere.json'
8
+ const DIOGRAPH_JSON = 'diograph.json'
9
+
10
+ class ConnectionClient implements IConnectionClient {
11
+ type: string
12
+ client: IDataClient
13
+ connection: IConnectionObject
14
+
15
+ constructor(dataClient: IDataClient, connection: IConnectionObject) {
16
+ this.type = dataClient.type
17
+ this.client = dataClient
18
+ this.connection = connection
19
+ }
20
+
21
+ getDiosphere = async () => {
22
+ const diosphereString = await this.client.readTextItem(
23
+ join(this.connection.address, DIOSPHERE_JSON),
24
+ )
25
+ return JSON.parse(diosphereString)
26
+ }
27
+
28
+ saveDiosphere = async (diosphereObject: IDiosphereObject) => {
29
+ const diosphereString = JSON.stringify(diosphereObject)
30
+ return this.client.writeItem(join(this.connection.address, DIOSPHERE_JSON), diosphereString)
31
+ }
32
+
33
+ getDiograph = async () => {
34
+ const diographString = await this.client.readTextItem(
35
+ join(this.connection.address, DIOGRAPH_JSON),
36
+ )
37
+ return JSON.parse(diographString)
38
+ }
39
+
40
+ saveDiograph = async (diographObject: IDiographObject) => {
41
+ const diosphereString = JSON.stringify(diographObject)
42
+ return this.client.writeItem(join(this.connection.address, DIOGRAPH_JSON), diosphereString)
43
+ }
44
+ }
45
+
46
+ export { ConnectionClient }
@@ -0,0 +1,7 @@
1
+ describe('dioryClient', () => {
2
+ describe('initialise()', () => {
3
+ it('should initialise with connections', () => {
4
+ expect(true).toEqual(true)
5
+ })
6
+ })
7
+ })
@@ -0,0 +1,133 @@
1
+ import { Diosphere, IConnectionObject, IDiosphere, IRoom, IRoomObject } from '@diory/diosphere-js'
2
+ import { Diograph, IDiograph, IDiory, IDioryObject } from '@diograph/diograph'
3
+
4
+ import { IConnectionClient, IDataClient, IDioryClient } from './types'
5
+ import { ConnectionClient } from './connectionClient'
6
+
7
+ function getDataClient(
8
+ dataClients: IDataClient[],
9
+ { client }: IConnectionObject,
10
+ ): IDataClient | undefined {
11
+ return dataClients.find(({ type }) => type === client)
12
+ }
13
+
14
+ function getConnectionClients(
15
+ dataClients: IDataClient[],
16
+ connections: IConnectionObject[],
17
+ ): IConnectionClient[] {
18
+ return connections
19
+ .filter(({ client }) => dataClients.some(({ type }) => type === client))
20
+ .map((connection) => {
21
+ const dataClient = getDataClient(dataClients, connection)
22
+ return new ConnectionClient(dataClient!, connection)
23
+ }) as IConnectionClient[]
24
+ }
25
+
26
+ class DioryClient implements IDioryClient {
27
+ dataClients: IDataClient[] = []
28
+ connections: IConnectionObject[] = []
29
+ diosphere: IDiosphere
30
+ room?: IRoom
31
+ diograph: IDiograph
32
+ diory?: IDiory
33
+
34
+ constructor(dataClients: IDataClient[]) {
35
+ this.dataClients = dataClients
36
+
37
+ this.diosphere = new Diosphere()
38
+ this.diograph = new Diograph()
39
+
40
+ this.diosphere.saveDiosphere = this.saveDiosphere
41
+ this.diograph.saveDiograph = this.saveDiograph
42
+ }
43
+
44
+ initialise = async (connections: IConnectionObject[]): Promise<void> => {
45
+ this.connections = connections
46
+
47
+ await this.getDiosphere()
48
+ await this.enterRoom({ id: '/' })
49
+ await this.focusDiory({ id: '/' })
50
+
51
+ return
52
+ }
53
+
54
+ getDiosphere = async (): Promise<void> => {
55
+ console.info('getDiosphere', this.connections)
56
+ if (this.connections) {
57
+ const connectionClients = getConnectionClients(this.dataClients, this.connections)
58
+
59
+ await Promise.all(
60
+ connectionClients.map(async (connectionClient) => {
61
+ const diosphereObject = await connectionClient.getDiosphere()
62
+ console.info(diosphereObject)
63
+ return this.diosphere.initialise(diosphereObject)
64
+ }),
65
+ )
66
+ }
67
+
68
+ return
69
+ }
70
+
71
+ saveDiosphere = async (): Promise<void> => {
72
+ console.info('saveDiosphere', this.connections)
73
+ if (this.connections) {
74
+ const connectionClients = getConnectionClients(this.dataClients, this.connections)
75
+
76
+ await Promise.all(
77
+ connectionClients.map((connectionClient) => {
78
+ console.info(this.diosphere.toObject())
79
+ return connectionClient.saveDiosphere(this.diosphere.toObject())
80
+ }),
81
+ )
82
+ }
83
+
84
+ return
85
+ }
86
+
87
+ enterRoom = async (roomObject: IRoomObject): Promise<IRoom> => {
88
+ this.room = this.diosphere.getRoom(roomObject)
89
+
90
+ await this.getDiograph()
91
+
92
+ return this.room
93
+ }
94
+
95
+ getDiograph = async (): Promise<void> => {
96
+ console.info('getDiograph', this.room?.connections)
97
+ if (this.room?.connections) {
98
+ const connectionClients = getConnectionClients(this.dataClients, this.room.connections)
99
+
100
+ await Promise.all(
101
+ connectionClients.map(async (connectionClient) => {
102
+ const diographObject = await connectionClient.getDiograph()
103
+ console.info(diographObject)
104
+ return this.diograph.initialise(diographObject)
105
+ }),
106
+ )
107
+ }
108
+
109
+ return
110
+ }
111
+
112
+ saveDiograph = async (): Promise<void> => {
113
+ console.info('saveDiograph', this.room?.connections)
114
+ if (this.room?.connections) {
115
+ const connectionClients = getConnectionClients(this.dataClients, this.room.connections)
116
+
117
+ await Promise.all(
118
+ connectionClients.map((connectionClient) => {
119
+ console.info(this.diograph.toObject())
120
+ return connectionClient.saveDiograph(this.diograph.toObject())
121
+ }),
122
+ )
123
+ }
124
+
125
+ return
126
+ }
127
+
128
+ focusDiory = (dioryObject: IDioryObject): IDiory => {
129
+ return (this.diory = this.diograph.getDiory(dioryObject))
130
+ }
131
+ }
132
+
133
+ export { DioryClient }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { DioryClient } from './dioryClient'
2
+ export { ConnectionClient } from './connectionClient'
3
+ export { IDioryClient, IConnectionClient, IDataClient } from './types'
package/src/types.ts ADDED
@@ -0,0 +1,48 @@
1
+ import {
2
+ IConnectionObject,
3
+ IDiosphere,
4
+ IDiosphereObject,
5
+ IRoom,
6
+ IRoomObject,
7
+ } from '@diory/diosphere-js'
8
+ import { IDiograph, IDiory } from '@diograph/diograph'
9
+ import { IDiographObject, IDioryObject } from '@diograph/diograph'
10
+
11
+ export interface IDataClient {
12
+ type: string
13
+ readTextItem(url: string): Promise<string>
14
+ readItem(url: string): Promise<Buffer>
15
+ readToStream(url: string): any
16
+ exists(url: string): Promise<boolean>
17
+ writeTextItem(url: string, fileContent: string): Promise<boolean>
18
+ writeItem(url: string, fileContent: Buffer | string): Promise<boolean>
19
+ deleteItem(url: string): Promise<boolean>
20
+ deleteFolder(url: string): Promise<void>
21
+ list(url: string): Promise<string[]>
22
+ }
23
+
24
+ export interface IConnectionClient {
25
+ type: string
26
+ client: IDataClient
27
+ connection: IConnectionObject
28
+ getDiosphere: () => Promise<IDiosphereObject>
29
+ saveDiosphere: (diosphereObject: IDiosphereObject) => void
30
+ getDiograph: () => Promise<IDiographObject>
31
+ saveDiograph: (diographObject: IDiographObject) => void
32
+ }
33
+
34
+ export interface IDioryClient {
35
+ dataClients: IDataClient[]
36
+ connections: IConnectionObject[]
37
+ diosphere: IDiosphere
38
+ room?: IRoom
39
+ diograph: IDiograph
40
+ diory?: IDiory
41
+ initialise: (connections: IConnectionObject[]) => Promise<void>
42
+ getDiosphere: () => void
43
+ saveDiosphere: () => void
44
+ enterRoom: (roomObject: IRoomObject) => Promise<IRoom>
45
+ getDiograph: () => void
46
+ saveDiograph: () => void
47
+ focusDiory: (dioryObject: IDioryObject) => IDiory
48
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "dist",
4
+ "declaration": true,
5
+ "target": "es2017",
6
+ "module": "commonjs",
7
+ "strict": true,
8
+ "forceConsistentCasingInFileNames": true
9
+ },
10
+ "exclude": ["node_modules", "dist"]
11
+ }