@xyo-network/node 0.3.1 → 2.26.1
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/LICENSE +165 -0
- package/README.md +68 -8
- package/dist/cjs/Abstract.d.ts +20 -0
- package/dist/cjs/Abstract.d.ts.map +1 -0
- package/dist/cjs/Abstract.js +19 -0
- package/dist/cjs/Abstract.js.map +1 -0
- package/dist/cjs/Node.d.ts +11 -0
- package/dist/cjs/Node.d.ts.map +1 -0
- package/dist/cjs/Node.js +3 -0
- package/dist/cjs/Node.js.map +1 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/docs.json +1035 -0
- package/dist/esm/Abstract.d.ts +20 -0
- package/dist/esm/Abstract.d.ts.map +1 -0
- package/dist/esm/Abstract.js +15 -0
- package/dist/esm/Abstract.js.map +1 -0
- package/dist/esm/Node.d.ts +11 -0
- package/dist/esm/Node.d.ts.map +1 -0
- package/dist/esm/Node.js +2 -0
- package/dist/esm/Node.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/package.json +50 -17
- package/src/Abstract.ts +22 -0
- package/src/Node.ts +11 -0
- package/src/index.ts +2 -12
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -15
- package/dist/index.js.map +0 -1
- package/dist/xyo-node.d.ts +0 -30
- package/dist/xyo-node.d.ts.map +0 -1
- package/dist/xyo-node.js +0 -71
- package/dist/xyo-node.js.map +0 -1
- package/src/xyo-node.ts +0 -68
- package/tsconfig.json +0 -28
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { XyoBoundWitness } from '@xyo-network/boundwitness';
|
|
2
|
+
import { XyoModule } from '@xyo-network/module';
|
|
3
|
+
import { XyoPayload, XyoQueryPayload } from '@xyo-network/payload';
|
|
4
|
+
import { Promisable } from '@xyo-network/promisable';
|
|
5
|
+
import { XyoNode } from './Node';
|
|
6
|
+
export declare abstract class XyoAbstractNode implements XyoNode {
|
|
7
|
+
attach(module: XyoModule<XyoQueryPayload<XyoPayload<{
|
|
8
|
+
schema: string;
|
|
9
|
+
}>>>): void;
|
|
10
|
+
remove(address: string): void;
|
|
11
|
+
get<T extends XyoModule<XyoQueryPayload<XyoPayload<{
|
|
12
|
+
schema: string;
|
|
13
|
+
}>>>>(address: string): T | undefined;
|
|
14
|
+
query(query: XyoQueryPayload<XyoPayload<{
|
|
15
|
+
schema: string;
|
|
16
|
+
}>>): Promisable<[XyoBoundWitness, XyoPayload<{
|
|
17
|
+
schema: string;
|
|
18
|
+
}>[]]>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=Abstract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Abstract.d.ts","sourceRoot":"","sources":["../../src/Abstract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,8BAAsB,eAAgB,YAAW,OAAO;IACtD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC,GAAG,IAAI;IAGhF,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAG7B,GAAG,CAAC,CAAC,SAAS,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAGzG,KAAK,CAAC,KAAK,EAAE,eAAe,CAAC,UAAU,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,eAAe,EAAE,UAAU,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC,CAAC;CAG/H"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class XyoAbstractNode {
|
|
2
|
+
attach(module) {
|
|
3
|
+
throw new Error('Method not implemented.');
|
|
4
|
+
}
|
|
5
|
+
remove(address) {
|
|
6
|
+
throw new Error('Method not implemented.');
|
|
7
|
+
}
|
|
8
|
+
get(address) {
|
|
9
|
+
throw new Error('Method not implemented.');
|
|
10
|
+
}
|
|
11
|
+
query(query) {
|
|
12
|
+
throw new Error('Method not implemented.');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=Abstract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Abstract.js","sourceRoot":"","sources":["../../src/Abstract.ts"],"names":[],"mappings":"AAQA,MAAM,OAAgB,eAAe;IACnC,MAAM,CAAC,MAAkE;QACvE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;IACD,MAAM,CAAC,OAAe;QACpB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;IACD,GAAG,CAAuE,OAAe;QACvF,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;IACD,KAAK,CAAC,KAAsD;QAC1D,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { XyoBoundWitness } from '@xyo-network/boundwitness';
|
|
2
|
+
import { XyoModule } from '@xyo-network/module';
|
|
3
|
+
import { XyoPayload, XyoQueryPayload } from '@xyo-network/payload';
|
|
4
|
+
import { Promisable } from '@xyo-network/promisable';
|
|
5
|
+
export interface XyoNode {
|
|
6
|
+
attach(module: XyoModule): void;
|
|
7
|
+
remove(address: string): void;
|
|
8
|
+
get<T extends XyoModule>(address: string): T | undefined;
|
|
9
|
+
query(query: XyoQueryPayload): Promisable<[XyoBoundWitness, XyoPayload[]]>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=Node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Node.d.ts","sourceRoot":"","sources":["../../src/Node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEpD,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAA;IAC/B,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,GAAG,CAAC,CAAC,SAAS,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAA;IACxD,KAAK,CAAC,KAAK,EAAE,eAAe,GAAG,UAAU,CAAC,CAAC,eAAe,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA;CAC3E"}
|
package/dist/esm/Node.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Node.js","sourceRoot":"","sources":["../../src/Node.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/node",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
3
|
+
"author": {
|
|
4
|
+
"email": "support@xyo.network",
|
|
5
|
+
"name": "XYO Development Team",
|
|
6
|
+
"url": "https://xyo.network"
|
|
7
|
+
},
|
|
8
|
+
"bugs": {
|
|
9
|
+
"email": "support@xyo.network",
|
|
10
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
|
|
11
|
+
},
|
|
9
12
|
"dependencies": {
|
|
10
|
-
"@xyo-network/
|
|
11
|
-
"@xyo-network/
|
|
13
|
+
"@xyo-network/boundwitness": "^2.26.1",
|
|
14
|
+
"@xyo-network/module": "^2.26.1",
|
|
15
|
+
"@xyo-network/payload": "^2.26.1",
|
|
16
|
+
"@xyo-network/promisable": "^2.26.1",
|
|
17
|
+
"tslib": "^2.4.0"
|
|
12
18
|
},
|
|
19
|
+
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
13
20
|
"devDependencies": {
|
|
14
|
-
"@
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
+
"@xylabs/tsconfig": "^2.5.118"
|
|
22
|
+
},
|
|
23
|
+
"browser": "dist/esm/index.js",
|
|
24
|
+
"docs": "dist/docs.json",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"node": {
|
|
28
|
+
"import": "./dist/esm/index.js",
|
|
29
|
+
"require": "./dist/cjs/index.js"
|
|
30
|
+
},
|
|
31
|
+
"browser": {
|
|
32
|
+
"import": "./dist/esm/index.js",
|
|
33
|
+
"require": "./dist/cjs/index.js"
|
|
34
|
+
},
|
|
35
|
+
"default": "./dist/esm/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./dist/docs.json": {
|
|
38
|
+
"default": "./dist/docs.json"
|
|
39
|
+
},
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"main": "dist/cjs/index.js",
|
|
43
|
+
"module": "dist/esm/index.js",
|
|
44
|
+
"homepage": "https://xyo.network",
|
|
45
|
+
"license": "LGPL-3.0-only",
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
21
52
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
53
|
+
"sideEffects": false,
|
|
54
|
+
"types": "dist/esm/index.d.ts",
|
|
55
|
+
"version": "2.26.1"
|
|
56
|
+
}
|
package/src/Abstract.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import { XyoBoundWitness } from '@xyo-network/boundwitness'
|
|
3
|
+
import { XyoModule } from '@xyo-network/module'
|
|
4
|
+
import { XyoPayload, XyoQueryPayload } from '@xyo-network/payload'
|
|
5
|
+
import { Promisable } from '@xyo-network/promisable'
|
|
6
|
+
|
|
7
|
+
import { XyoNode } from './Node'
|
|
8
|
+
|
|
9
|
+
export abstract class XyoAbstractNode implements XyoNode {
|
|
10
|
+
attach(module: XyoModule<XyoQueryPayload<XyoPayload<{ schema: string }>>>): void {
|
|
11
|
+
throw new Error('Method not implemented.')
|
|
12
|
+
}
|
|
13
|
+
remove(address: string): void {
|
|
14
|
+
throw new Error('Method not implemented.')
|
|
15
|
+
}
|
|
16
|
+
get<T extends XyoModule<XyoQueryPayload<XyoPayload<{ schema: string }>>>>(address: string): T | undefined {
|
|
17
|
+
throw new Error('Method not implemented.')
|
|
18
|
+
}
|
|
19
|
+
query(query: XyoQueryPayload<XyoPayload<{ schema: string }>>): Promisable<[XyoBoundWitness, XyoPayload<{ schema: string }>[]]> {
|
|
20
|
+
throw new Error('Method not implemented.')
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/Node.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { XyoBoundWitness } from '@xyo-network/boundwitness'
|
|
2
|
+
import { XyoModule } from '@xyo-network/module'
|
|
3
|
+
import { XyoPayload, XyoQueryPayload } from '@xyo-network/payload'
|
|
4
|
+
import { Promisable } from '@xyo-network/promisable'
|
|
5
|
+
|
|
6
|
+
export interface XyoNode {
|
|
7
|
+
attach(module: XyoModule): void
|
|
8
|
+
remove(address: string): void
|
|
9
|
+
get<T extends XyoModule>(address: string): T | undefined
|
|
10
|
+
query(query: XyoQueryPayload): Promisable<[XyoBoundWitness, XyoPayload[]]>
|
|
11
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* @Date: Tuesday, 20th November 2018 10:42:26 am
|
|
4
|
-
* @Email: developer@xyfindables.com
|
|
5
|
-
* @Filename: index.ts
|
|
6
|
-
* @Last modified by: ryanxyo
|
|
7
|
-
* @Last modified time: Tuesday, 11th December 2018 9:48:30 am
|
|
8
|
-
* @License: All Rights Reserved
|
|
9
|
-
* @Copyright: Copyright XY | The Findables Company
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
export { XyoNode } from './xyo-node'
|
|
1
|
+
export * from './Abstract'
|
|
2
|
+
export * from './Node'
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @Author: XY | The Findables Company <ryanxyo>
|
|
4
|
-
* @Date: Tuesday, 20th November 2018 10:42:26 am
|
|
5
|
-
* @Email: developer@xyfindables.com
|
|
6
|
-
* @Filename: index.ts
|
|
7
|
-
* @Last modified by: ryanxyo
|
|
8
|
-
* @Last modified time: Tuesday, 11th December 2018 9:48:30 am
|
|
9
|
-
* @License: All Rights Reserved
|
|
10
|
-
* @Copyright: Copyright XY | The Findables Company
|
|
11
|
-
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
var xyo_node_1 = require("./xyo-node");
|
|
14
|
-
exports.XyoNode = xyo_node_1.XyoNode;
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAEH,uCAAoC;AAA3B,6BAAA,OAAO,CAAA"}
|
package/dist/xyo-node.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { IXyoPeerConnectionDelegate } from '@xyo-network/peer-connections';
|
|
2
|
-
import { XyoBase } from '@xyo-network/base';
|
|
3
|
-
/**
|
|
4
|
-
* An XyoNode represents a node in the xyo-network system.
|
|
5
|
-
* A node can communicate with other nodes, in general, through
|
|
6
|
-
* bound-witness interactions. What differentiates a sentinel
|
|
7
|
-
* from a bridge from an archivist is their role in the system
|
|
8
|
-
* and what their prerogative is at any given time.
|
|
9
|
-
*/
|
|
10
|
-
export declare class XyoNode extends XyoBase {
|
|
11
|
-
private readonly peerConnectionDelegate;
|
|
12
|
-
/** Some instance variables for managing the xyo-node loop */
|
|
13
|
-
private isLooping;
|
|
14
|
-
private shouldStopLooping;
|
|
15
|
-
constructor(peerConnectionDelegate: IXyoPeerConnectionDelegate);
|
|
16
|
-
/**
|
|
17
|
-
* Calling start will place the xyo-node in loop mode
|
|
18
|
-
*/
|
|
19
|
-
start(): void;
|
|
20
|
-
/**
|
|
21
|
-
* Calling stop will remove the xyo-node from loop mode
|
|
22
|
-
*/
|
|
23
|
-
stop(): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Defines an xyo-node's in loop. Once an iteration of the loop is completed it will
|
|
26
|
-
* scheduled immediately for another iteration of the loop unless `stop` is called.
|
|
27
|
-
*/
|
|
28
|
-
private loop;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=xyo-node.d.ts.map
|
package/dist/xyo-node.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xyo-node.d.ts","sourceRoot":"","sources":["../src/xyo-node.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE3C;;;;;;GAMG;AAEH,qBAAa,OAAQ,SAAQ,OAAO;IAMtB,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IAJnD,6DAA6D;IAC7D,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,iBAAiB,CAAQ;gBAEJ,sBAAsB,EAAE,0BAA0B;IAI/E;;OAEG;IACI,KAAK;IAIZ;;OAEG;IAEI,IAAI;IAKX;;;OAGG;YAEW,IAAI;CAcnB"}
|
package/dist/xyo-node.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @Author: XY | The Findables Company <ryanxyo>
|
|
4
|
-
* @Date: Tuesday, 20th November 2018 10:44:20 am
|
|
5
|
-
* @Email: developer@xyfindables.com
|
|
6
|
-
* @Filename: xyo-node.ts
|
|
7
|
-
* @Last modified by: ryanxyo
|
|
8
|
-
* @Last modified time: Friday, 7th December 2018 11:45:18 am
|
|
9
|
-
* @License: All Rights Reserved
|
|
10
|
-
* @Copyright: Copyright XY | The Findables Company
|
|
11
|
-
*/
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
-
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
17
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
const base_1 = require("@xyo-network/base");
|
|
22
|
-
/**
|
|
23
|
-
* An XyoNode represents a node in the xyo-network system.
|
|
24
|
-
* A node can communicate with other nodes, in general, through
|
|
25
|
-
* bound-witness interactions. What differentiates a sentinel
|
|
26
|
-
* from a bridge from an archivist is their role in the system
|
|
27
|
-
* and what their prerogative is at any given time.
|
|
28
|
-
*/
|
|
29
|
-
class XyoNode extends base_1.XyoBase {
|
|
30
|
-
constructor(peerConnectionDelegate) {
|
|
31
|
-
super();
|
|
32
|
-
this.peerConnectionDelegate = peerConnectionDelegate;
|
|
33
|
-
/** Some instance variables for managing the xyo-node loop */
|
|
34
|
-
this.isLooping = false;
|
|
35
|
-
this.shouldStopLooping = false;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Calling start will place the xyo-node in loop mode
|
|
39
|
-
*/
|
|
40
|
-
start() {
|
|
41
|
-
this.loop();
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Calling stop will remove the xyo-node from loop mode
|
|
45
|
-
*/
|
|
46
|
-
stop() {
|
|
47
|
-
this.shouldStopLooping = true;
|
|
48
|
-
return this.peerConnectionDelegate.stopProvidingConnections();
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Defines an xyo-node's in loop. Once an iteration of the loop is completed it will
|
|
52
|
-
* scheduled immediately for another iteration of the loop unless `stop` is called.
|
|
53
|
-
*/
|
|
54
|
-
loop() {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
if (this.isLooping && this.shouldStopLooping) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
const networkPipe = yield this.peerConnectionDelegate.provideConnection();
|
|
61
|
-
yield this.peerConnectionDelegate.handlePeerConnection(networkPipe);
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
this.logError(`There was an uncaught error in the xyo-node loop`, err);
|
|
65
|
-
}
|
|
66
|
-
setImmediate(this.loop.bind(this));
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.XyoNode = XyoNode;
|
|
71
|
-
//# sourceMappingURL=xyo-node.js.map
|
package/dist/xyo-node.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xyo-node.js","sourceRoot":"","sources":["../src/xyo-node.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;AAGH,4CAA2C;AAE3C;;;;;;GAMG;AAEH,MAAa,OAAQ,SAAQ,cAAO;IAMlC,YAA6B,sBAAkD;QAC7E,KAAK,EAAE,CAAA;QADoB,2BAAsB,GAAtB,sBAAsB,CAA4B;QAJ/E,6DAA6D;QACrD,cAAS,GAAG,KAAK,CAAA;QACjB,sBAAiB,GAAG,KAAK,CAAA;IAIjC,CAAC;IAED;;OAEG;IACI,KAAK;QACV,IAAI,CAAC,IAAI,EAAE,CAAA;IACb,CAAC;IAED;;OAEG;IAEI,IAAI;QACT,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAA;QAC7B,OAAO,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,EAAE,CAAA;IAC/D,CAAC;IAED;;;OAGG;IAEW,IAAI;;YAChB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,iBAAiB,EAAE;gBAC5C,OAAM;aACP;YAED,IAAI;gBACF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,EAAE,CAAA;gBACzE,MAAM,IAAI,CAAC,sBAAsB,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAA;aACpE;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,CAAC,QAAQ,CAAC,kDAAkD,EAAE,GAAG,CAAC,CAAA;aACvE;YAED,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA7CD,0BA6CC"}
|
package/src/xyo-node.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: XY | The Findables Company <ryanxyo>
|
|
3
|
-
* @Date: Tuesday, 20th November 2018 10:44:20 am
|
|
4
|
-
* @Email: developer@xyfindables.com
|
|
5
|
-
* @Filename: xyo-node.ts
|
|
6
|
-
* @Last modified by: ryanxyo
|
|
7
|
-
* @Last modified time: Friday, 7th December 2018 11:45:18 am
|
|
8
|
-
* @License: All Rights Reserved
|
|
9
|
-
* @Copyright: Copyright XY | The Findables Company
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { IXyoPeerConnectionDelegate } from '@xyo-network/peer-connections'
|
|
13
|
-
import { XyoBase } from '@xyo-network/base'
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* An XyoNode represents a node in the xyo-network system.
|
|
17
|
-
* A node can communicate with other nodes, in general, through
|
|
18
|
-
* bound-witness interactions. What differentiates a sentinel
|
|
19
|
-
* from a bridge from an archivist is their role in the system
|
|
20
|
-
* and what their prerogative is at any given time.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
export class XyoNode extends XyoBase {
|
|
24
|
-
|
|
25
|
-
/** Some instance variables for managing the xyo-node loop */
|
|
26
|
-
private isLooping = false
|
|
27
|
-
private shouldStopLooping = false
|
|
28
|
-
|
|
29
|
-
constructor(private readonly peerConnectionDelegate: IXyoPeerConnectionDelegate) {
|
|
30
|
-
super()
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Calling start will place the xyo-node in loop mode
|
|
35
|
-
*/
|
|
36
|
-
public start() {
|
|
37
|
-
this.loop()
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Calling stop will remove the xyo-node from loop mode
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
public stop() {
|
|
45
|
-
this.shouldStopLooping = true
|
|
46
|
-
return this.peerConnectionDelegate.stopProvidingConnections()
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Defines an xyo-node's in loop. Once an iteration of the loop is completed it will
|
|
51
|
-
* scheduled immediately for another iteration of the loop unless `stop` is called.
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
private async loop() {
|
|
55
|
-
if (this.isLooping && this.shouldStopLooping) {
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
try {
|
|
60
|
-
const networkPipe = await this.peerConnectionDelegate.provideConnection()
|
|
61
|
-
await this.peerConnectionDelegate.handlePeerConnection(networkPipe)
|
|
62
|
-
} catch (err) {
|
|
63
|
-
this.logError(`There was an uncaught error in the xyo-node loop`, err)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
setImmediate(this.loop.bind(this))
|
|
67
|
-
}
|
|
68
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es6",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"lib": ["esnext"],
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"sourceMap": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"composite": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"noImplicitAny": true,
|
|
13
|
-
"moduleResolution": "node",
|
|
14
|
-
"outDir": "dist",
|
|
15
|
-
"rootDir": "src"
|
|
16
|
-
},
|
|
17
|
-
"exclude": [
|
|
18
|
-
"node_modules",
|
|
19
|
-
"src/**/test/*",
|
|
20
|
-
"src/**/spec",
|
|
21
|
-
"src/**/*.spec.ts"
|
|
22
|
-
],
|
|
23
|
-
"include": ["src/**/*"],
|
|
24
|
-
"references": [
|
|
25
|
-
{"path": "../base"},
|
|
26
|
-
{"path": "../peer-connections"}
|
|
27
|
-
]
|
|
28
|
-
}
|