@diory/client-js 0.1.5-rc1 → 0.2.0-rc1

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.
@@ -1,6 +1,6 @@
1
1
  import { IDiographObject } from '@diograph/diograph';
2
2
  import { IConnectionObject, IDiosphereObject } from '@diory/diosphere-js';
3
- import { IConnectionClient, IDataClient } from './types';
3
+ import { IConnectionClient, IDataClient } from '../types';
4
4
  declare class ConnectionClient implements IConnectionClient {
5
5
  type: string;
6
6
  client: IDataClient;
@@ -28,7 +28,7 @@ class ConnectionClient {
28
28
  return this.client.writeItem(path, diographString);
29
29
  };
30
30
  this.generateDiograph = async () => {
31
- const { diograph } = await (0, folder_generator_1.generateDiograph)(this.connection.address); // TODO: Client
31
+ const { diograph } = await (0, folder_generator_1.generateDiograph)(this.connection.address, this.client);
32
32
  return diograph.toObject();
33
33
  };
34
34
  this.type = dataClient.type;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ describe('connectionClient', () => {
3
+ describe('construct()', () => {
4
+ it('should construct with dataClient and connection', () => {
5
+ expect(true).toEqual(true);
6
+ });
7
+ });
8
+ describe('getDiosphere()', () => {
9
+ it('should get diosphere', () => {
10
+ expect(true).toEqual(true);
11
+ });
12
+ });
13
+ describe('saveDiosphere()', () => {
14
+ it('should save diosphere object', () => {
15
+ expect(true).toEqual(true);
16
+ });
17
+ });
18
+ });
@@ -1,6 +1,6 @@
1
1
  import { IConnectionObject, IDiosphere, IRoom, IRoomObject } from '@diory/diosphere-js';
2
2
  import { IDiograph, IDiory, IDioryObject } from '@diograph/diograph';
3
- import { IDataClient, IDioryClient } from './types';
3
+ import { IDioryClient, IDataClient } from '../types';
4
4
  declare class DioryClient implements IDioryClient {
5
5
  dataClients: IDataClient[];
6
6
  connections: IConnectionObject[];
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DioryClient = void 0;
4
4
  const diosphere_js_1 = require("@diory/diosphere-js");
5
5
  const diograph_1 = require("@diograph/diograph");
6
- const getConnectionClients_1 = require("./utils/getConnectionClients");
6
+ const getConnectionClients_1 = require("../utils/getConnectionClients");
7
7
  class DioryClient {
8
8
  constructor(dataClients) {
9
9
  this.dataClients = [];
File without changes
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { DioryClient } from './dioryClient';
2
- export { ConnectionClient } from './connectionClient';
3
- export { IDioryClient, IConnectionClient, IDataClient } from './types';
1
+ export { DioryClient } from './dioryClient/dioryClient';
2
+ export { ConnectionClient } from './connectionClient/connectionClient';
3
+ export { IDioryClient } from './types';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectionClient = exports.DioryClient = void 0;
4
- var dioryClient_1 = require("./dioryClient");
4
+ var dioryClient_1 = require("./dioryClient/dioryClient");
5
5
  Object.defineProperty(exports, "DioryClient", { enumerable: true, get: function () { return dioryClient_1.DioryClient; } });
6
- var connectionClient_1 = require("./connectionClient");
6
+ var connectionClient_1 = require("./connectionClient/connectionClient");
7
7
  Object.defineProperty(exports, "ConnectionClient", { enumerable: true, get: function () { return connectionClient_1.ConnectionClient; } });
package/dist/types.d.ts CHANGED
@@ -1,6 +1,15 @@
1
1
  /// <reference types="node" />
2
2
  import { IConnectionObject, IDiosphere, IDiosphereObject, IRoom, IRoomObject } from '@diory/diosphere-js';
3
- import { IDiographObject, IDiograph, IDiory, IDioryObject } from '@diograph/diograph';
3
+ import { IDiograph, IDiographObject, IDiory, IDioryObject } from '@diograph/diograph';
4
+ export interface IMetadata {
5
+ name: string;
6
+ created?: string;
7
+ modified?: string;
8
+ }
9
+ export interface IFileType {
10
+ ext?: string;
11
+ mime?: string;
12
+ }
4
13
  export interface IDataClient {
5
14
  type: string;
6
15
  readTextItem(url: string): Promise<string>;
@@ -12,6 +21,10 @@ export interface IDataClient {
12
21
  deleteItem(url: string): Promise<boolean>;
13
22
  deleteFolder(url: string): Promise<void>;
14
23
  list(url: string): Promise<string[]>;
24
+ getFileNames(url: string): Promise<string[]>;
25
+ getFolderNames(url: string): Promise<string[]>;
26
+ getMetadata(url: string): IMetadata;
27
+ getFileType(url: string): Promise<IFileType>;
15
28
  }
16
29
  export interface IConnectionClient {
17
30
  type: string;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getConnectionClients = void 0;
4
- const connectionClient_1 = require("../connectionClient");
4
+ const connectionClient_1 = require("../connectionClient/connectionClient");
5
5
  function getDataClient(dataClients, { client }) {
6
6
  return dataClients.find(({ type }) => type === client);
7
7
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@diory/client-js",
3
- "version": "0.1.5-rc1",
3
+ "version": "0.2.0-rc1",
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>",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
9
  "@diograph/diograph": "0.3.0-rc14",
10
- "@diograph/folder-generator": "^0.2.0-rc1",
10
+ "@diograph/folder-generator": "^0.3.0-rc1",
11
11
  "@diory/diosphere-js": "0.2.6-rc2",
12
12
  "path-browserify": "^1.0.1",
13
13
  "uuid": "8.3.2"
@@ -0,0 +1,19 @@
1
+ describe('connectionClient', () => {
2
+ describe('construct()', () => {
3
+ it('should construct with dataClient and connection', () => {
4
+ expect(true).toEqual(true)
5
+ })
6
+ })
7
+
8
+ describe('getDiosphere()', () => {
9
+ it('should get diosphere', () => {
10
+ expect(true).toEqual(true)
11
+ })
12
+ })
13
+
14
+ describe('saveDiosphere()', () => {
15
+ it('should save diosphere object', () => {
16
+ expect(true).toEqual(true)
17
+ })
18
+ })
19
+ })
@@ -3,7 +3,7 @@ import { generateDiograph } from '@diograph/folder-generator'
3
3
 
4
4
  import { IDiographObject } from '@diograph/diograph'
5
5
  import { IConnectionObject, IDiosphereObject } from '@diory/diosphere-js'
6
- import { IConnectionClient, IDataClient } from './types'
6
+ import { IConnectionClient, IDataClient } from '../types'
7
7
 
8
8
  const DIOSPHERE_JSON = 'diosphere.json'
9
9
  const DIOGRAPH_JSON = 'diograph.json'
@@ -44,7 +44,7 @@ class ConnectionClient implements IConnectionClient {
44
44
  }
45
45
 
46
46
  generateDiograph = async (): Promise<IDiographObject> => {
47
- const { diograph } = await generateDiograph(this.connection.address) // TODO: Client
47
+ const { diograph } = await generateDiograph(this.connection.address, this.client)
48
48
  return diograph.toObject()
49
49
  }
50
50
  }
@@ -1,8 +1,8 @@
1
1
  import { Diosphere, IConnectionObject, IDiosphere, IRoom, IRoomObject } from '@diory/diosphere-js'
2
2
  import { Diograph, IDiograph, IDiory, IDioryObject } from '@diograph/diograph'
3
3
 
4
- import { IDataClient, IDioryClient } from './types'
5
- import { getConnectionClients } from './utils/getConnectionClients'
4
+ import { IDioryClient, IDataClient } from '../types'
5
+ import { getConnectionClients } from '../utils/getConnectionClients'
6
6
 
7
7
  class DioryClient implements IDioryClient {
8
8
  dataClients: IDataClient[] = []
package/src/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { DioryClient } from './dioryClient'
2
- export { ConnectionClient } from './connectionClient'
3
- export { IDioryClient, IConnectionClient, IDataClient } from './types'
1
+ export { DioryClient } from './dioryClient/dioryClient'
2
+ export { ConnectionClient } from './connectionClient/connectionClient'
3
+ export { IDioryClient } from './types'
package/src/types.ts CHANGED
@@ -5,7 +5,18 @@ import {
5
5
  IRoom,
6
6
  IRoomObject,
7
7
  } from '@diory/diosphere-js'
8
- import { IDiographObject, IDiograph, IDiory, IDioryObject } from '@diograph/diograph'
8
+ import { IDiograph, IDiographObject, IDiory, IDioryObject } from '@diograph/diograph'
9
+
10
+ export interface IMetadata {
11
+ name: string
12
+ created?: string
13
+ modified?: string
14
+ }
15
+
16
+ export interface IFileType {
17
+ ext?: string
18
+ mime?: string
19
+ }
9
20
 
10
21
  export interface IDataClient {
11
22
  type: string
@@ -18,6 +29,10 @@ export interface IDataClient {
18
29
  deleteItem(url: string): Promise<boolean>
19
30
  deleteFolder(url: string): Promise<void>
20
31
  list(url: string): Promise<string[]>
32
+ getFileNames(url: string): Promise<string[]>
33
+ getFolderNames(url: string): Promise<string[]>
34
+ getMetadata(url: string): IMetadata
35
+ getFileType(url: string): Promise<IFileType>
21
36
  }
22
37
 
23
38
  export interface IConnectionClient {
@@ -1,7 +1,7 @@
1
1
  import { IConnectionObject } from '@diory/diosphere-js'
2
2
 
3
+ import { ConnectionClient } from '../connectionClient/connectionClient'
3
4
  import { IConnectionClient, IDataClient } from '../types'
4
- import { ConnectionClient } from '../connectionClient'
5
5
 
6
6
  function getDataClient(
7
7
  dataClients: IDataClient[],