rhine-var 0.4.5 → 0.4.10

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/README.md CHANGED
@@ -3,22 +3,37 @@
3
3
  # RHINE-VAR: Simplest and Powerful CRDT Library
4
4
 
5
5
  Rhine Variable — A self-synchronizing variable for collaboration.
6
- Developing collaborative applications has never been this easy.
7
6
 
8
7
 
9
8
  [English](README.md)   |   [中文](README_zh.md)
10
9
 
11
- <img src='./assets/images/example1.png' style="border-radius: 10px"/>
10
+ <img src='./assets/images/example_counter.png' style="border-radius: 10px"/>
12
11
 
13
12
  </div>
14
13
 
14
+ ```typescript jsx
15
+ const state = rhineProxy({count: 0}, 'room-0') // Create
16
+ function Counter() {
17
+ const snap = useRhine(state) // Hook for React
18
+ return <div>
19
+ <span>{snap.count}</span> // Automatic Update
20
+ <button onClick={() => state.count-- }> -1 </button> // Operate Anyway
21
+ <button onClick={() => state.count++ }> +1 </button>
22
+ </div>
23
+ }
24
+ ```
25
+
26
+ Try: [https://rv.rhineai.com/examples/counter](https://rv.rhineai.com/examples/counter)
27
+
15
28
  <br/>
16
29
 
17
- ### **Document:** [LEARN.md](assets/documents/LEARN.md)
30
+ ## Overview
31
+
32
+ **Document:** [LEARN_zh.md](assets/documents/LEARN_zh.md)
18
33
 
19
- ### **Github:** [https://github.com/RhineAI-Lab/rhine-var](https://github.com/RhineAI-Lab/rhine-var)
34
+ **Github:** [https://github.com/RhineAI-Lab/rhine-var](https://github.com/RhineAI-Lab/rhine-var)
20
35
 
21
- ### **Npm:** [https://www.npmjs.com/package/rhine-var](https://www.npmjs.com/package/rhine-var)
36
+ **Npm:** [https://www.npmjs.com/package/rhine-var](https://www.npmjs.com/package/rhine-var)
22
37
 
23
38
  <br/>
24
39
 
@@ -91,23 +106,26 @@ If you don't have `yarn`, you can install it via `npm i rhine-var`, or install `
91
106
 
92
107
  ```typescript jsx
93
108
  const defaultValue = {value: 0}
94
- const count = rhineProxy(defaultValue, 'localhost:6600/room-0')
109
+ const url = 'ws://localhost:6600/room-0'
110
+
111
+ const state = rhineProxy(defaultValue, url)
95
112
 
96
113
  function Counter() {
97
114
 
98
- const countSnap = useRhine(count)
115
+ const snap = useRhine(state)
99
116
 
100
117
  return <div>
101
- <button onClick={() => count.value-- }> - 1 </button>
102
- <span>{countSnap.value}</span>
103
- <button onClick={() => count.value++ }> + 1 </button>
118
+ <button onClick={() => state.count-- }> -1 </button>
119
+ <span>{snap.count}</span>
120
+ <button onClick={() => state.count++ }> +1 </button>
104
121
  </div>
105
122
  }
106
123
  ```
107
124
 
108
125
  ### Room ID
109
126
 
110
- &lt;room-id&gt; can be any text, with each Room ID corresponding to a RhineVar, and users who join with the same Room ID will experience real-time multi-user collaboration.
127
+ A room number corresponds to a state variable, and users who join the room will participate in collaborative activities.
128
+ It supports using your own server and even other connection protocols.
111
129
 
112
130
  ### Default Value
113
131
 
@@ -123,6 +141,8 @@ Its data structure `can be quite complex`, but `at least`, it is `an object` in
123
141
 
124
142
  A hook for use with React. It creates a snapshot of a `RhineVar Object`, and whenever someone modifies this value, the information will be `updated on everyone's screen` in real-time.
125
143
 
144
+ Note: The returned snapshot is read-only. Please do not perform any operations on it! The snapshot is only for reading data within React's XML. For all other operations (such as assignment or subscription), please operate on the original RhineVar object.
145
+
126
146
  <br/>
127
147
 
128
148
  #### [Click to view the full document: LEARN.md](assets/documents/LEARN.md)
@@ -131,6 +151,13 @@ A hook for use with React. It creates a snapshot of a `RhineVar Object`, and whe
131
151
  <br/>
132
152
 
133
153
  ## Server
154
+
155
+ We provide a public server accessible over the internet for trying out and testing RHINE-VAR. You can connect to it via wss://rwq.rhineai.com/<room-id>.
156
+
157
+ Please note that this server does not guarantee security and performance and may impose certain restrictions on users with large-scale usage.
158
+
159
+ <br/>
160
+
134
161
  We provide a simple server as a reference, located at `/test/server` in this project. The server is fully compatible with all Yjs websocket servers.
135
162
  ```
136
163
  git clone https://github.com/RhineAI-Lab/rhine-var.git
package/README_zh.md CHANGED
@@ -2,21 +2,37 @@
2
2
 
3
3
  # 最简单且强大的多人协同框架 RHINE-VAR
4
4
 
5
- 莱茵变量 —— 会自己与他人协同的变量 &nbsp; 多人协同应用开发从未如此简单
5
+ 莱茵变量 —— 会自己与他人协同的变量 &nbsp; 多人协同应用开发从未如此简单
6
6
 
7
7
  [English](README.md) &nbsp; | &nbsp; [中文](README_zh.md)
8
8
 
9
- <img src='./assets/images/example1.png' style="border-radius: 10px; max-width: 840px"/>
9
+ <img src='./assets/images/example_counter.png' style="border-radius: 10px"/>
10
10
 
11
11
  </div>
12
12
 
13
+ ```typescript jsx
14
+ const state = rhineProxy({count: 0}, 'room-0') // Create
15
+ function Counter() {
16
+ const snap = useRhine(state) // Hook for React
17
+ return <div>
18
+ <span>{snap.count}</span> // Automatic Update
19
+ <button onClick={() => state.count-- }> -1 </button> // Operate Anyway
20
+ <button onClick={() => state.count++ }> +1 </button>
21
+ </div>
22
+ }
23
+ ```
24
+
25
+ Try: [https://rv.rhineai.com/examples/counter](https://rv.rhineai.com/examples/counter)
26
+
13
27
  <br/>
14
28
 
15
- ### **Document:** [LEARN_zh.md](assets/documents/LEARN_zh.md)
29
+ ## 简介
30
+
31
+ **Document:** [LEARN_zh.md](assets/documents/LEARN_zh.md)
16
32
 
17
- ### **Github:** [https://github.com/RhineAI-Lab/rhine-var](https://github.com/RhineAI-Lab/rhine-var)
33
+ **Github:** [https://github.com/RhineAI-Lab/rhine-var](https://github.com/RhineAI-Lab/rhine-var)
18
34
 
19
- ### **Npm:** [https://www.npmjs.com/package/rhine-var](https://www.npmjs.com/package/rhine-var)
35
+ **Npm:** [https://www.npmjs.com/package/rhine-var](https://www.npmjs.com/package/rhine-var)
20
36
 
21
37
  <br/>
22
38
 
@@ -101,24 +117,26 @@ yarn add rhine-var
101
117
  ## Usage
102
118
 
103
119
  ```typescript jsx
104
- const defaultValue = {count: 0}
105
- const state = rhineProxy(defaultValue, 'localhost:6600/room-id')
120
+ const defaultValue = {value: 0}
121
+ const url = 'ws://localhost:6600/room-0'
122
+
123
+ const state = rhineProxy(defaultValue, url)
106
124
 
107
125
  function Counter() {
108
126
 
109
127
  const snap = useRhine(state)
110
128
 
111
129
  return <div>
112
- <button onClick={() => state.count-- }> - 1 </button>
130
+ <button onClick={() => state.count-- }> -1 </button>
113
131
  <span>{snap.count}</span>
114
- <button onClick={() => state.count++ }> + 1 </button>
132
+ <button onClick={() => state.count++ }> +1 </button>
115
133
  </div>
116
134
  }
117
135
  ```
118
136
 
119
137
  ### Room ID
120
138
 
121
- 一个房间号对应一个状态变量, 加入到一个房间中的用户会参与到多人协同中。
139
+ 一个房间号对应一个状态变量, 加入到一个房间中的用户会参与到多人协同中。支持使用自己的服务端,甚至其他链接协议。
122
140
 
123
141
  ### Default Value
124
142
 
@@ -138,6 +156,8 @@ function Counter() {
138
156
 
139
157
  当任何人对值做出修改时,它会把最新的值立刻更新到所有人的屏幕上。
140
158
 
159
+ 注意:返回的快照为只读,请勿对其做出操作!快照仅用于在 React 的 XML 中读取数据。其他所有操作(如赋值或订阅等)请操作原 RhineVar 对象。
160
+
141
161
  <br/>
142
162
 
143
163
  #### [点击查看 完整文档 LEARN_zh.md](assets/documents/LEARN_zh.md)
@@ -146,7 +166,14 @@ function Counter() {
146
166
  <br/>
147
167
 
148
168
  ## Server
149
- 我们提供了一个简单的服务器例子,位于本项目中的 `/test/server` 处。 服务端完全兼容所有的 Yjs 的 Websocket 服务器,将来会支持更多。
169
+
170
+ 我们提供了一个位于公网的公共服务器,可以用于试用和测试 RHINE-VAR。你可以通过 `wss://rwq.rhineai.com/<room-id>` 连接它。
171
+
172
+ 注意,该服务器无法保证安全和性能,并会对大规模使用的用户做出一定限制。
173
+
174
+ <br/>
175
+
176
+ 本仓库中提供了一个简单的服务器例子,位于本项目中的 `/test/server` 处。 服务端完全兼容所有的 Yjs 的 Websocket 服务器,将来会支持更多。
150
177
  ```
151
178
  git clone https://github.com/RhineAI-Lab/rhine-var.git
152
179
  cd test/server
@@ -1,4 +1,4 @@
1
- import { Map as YMap, Doc as YDoc } from "yjs";
1
+ import { Doc as YDoc, Map as YMap } from "yjs";
2
2
  import { WebsocketProvider } from "y-websocket";
3
3
  import { ConnectorStatus } from "./ConnectorStatus";
4
4
  import { Native } from "../native/Native";
@@ -21,6 +21,7 @@ export default class WebsocketRhineConnector {
21
21
  constructor(url?: string);
22
22
  bind(defaultValue: Native, overwrite?: boolean): any;
23
23
  connect(url: string): Promise<void>;
24
+ disconnect(): Promise<void>;
24
25
  }
25
26
  export declare function websocketRhineConnect(url: string): WebsocketRhineConnector;
26
27
  //# sourceMappingURL=WebsocketRhineConnector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebsocketRhineConnector.d.ts","sourceRoot":"","sources":["../../../src/core/connector/WebsocketRhineConnector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,IAAI,IAAI,EAAmB,GAAG,IAAI,IAAI,EAAC,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAC,0BAAyC;AAEjE,OAAO,EAAC,MAAM,EAAC,yBAA6B;AAE5C,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;AAEtD,MAAM,CAAC,OAAO,OAAO,uBAAuB;IAE1C,MAAM,CAAC,SAAS,SAAU;IAE1B,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IACnB,GAAG,EAAE,MAAM,CAAK;IAEhB,QAAQ,SAAK;IACb,MAAM,UAAQ;IAEd,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAO;IACzC,eAAe,EAAE,eAAe,CAA+B;IAG/D,eAAe,EAAE,cAAc,EAAE,CAAK;IACtC,iBAAiB,CAAC,QAAQ,EAAE,cAAc;IAG1C,oBAAoB,CAAC,QAAQ,EAAE,cAAc;IAG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I,OAAO,CAAC,IAAI,CAAC;gBAOf,GAAG,SAAK;IAMpB,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,GAAE,OAAe;IAc/C,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4CnC,UAAU;CAYjB;AAGD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,2BAMhD"}
@@ -92,6 +92,17 @@ class WebsocketRhineConnector {
92
92
  });
93
93
  });
94
94
  }
95
+ async disconnect() {
96
+ throw new Error('Disconnecting and switching connections are not supported at the moment.');
97
+ /*
98
+ if (this.provider) {
99
+ this.provider.disconnect()
100
+ }
101
+ this.provider = null
102
+ this.synced = false
103
+ this.websocketStatus = ConnectorStatus.DISCONNECTED
104
+ */
105
+ }
95
106
  }
96
107
  WebsocketRhineConnector.STATE_KEY = 'state';
97
108
  exports.default = WebsocketRhineConnector;
@@ -4,7 +4,7 @@ import { ProxiedRhineVar, ProxiedRhineVarItem } from "./ProxiedRhineVar";
4
4
  import { Native } from "../native/Native";
5
5
  import RhineVar from "./RhineVar";
6
6
  export declare const PROTOCOL_LIST: string[];
7
- export declare const DEFAULT_PROTOCOL_LIST: string;
8
- export declare function rhineProxy<T extends object>(defaultValue: T | Native, connector: WebsocketRhineConnector | string, overwrite?: boolean | number): ProxiedRhineVar<T>;
7
+ export declare const DEFAULT_PUBLIC_URL = "wss://rpw.rhineai.com/";
8
+ export declare function rhineProxy<T extends object>(defaultValue: T | Native, connector: WebsocketRhineConnector | string | number, overwrite?: boolean | number): ProxiedRhineVar<T>;
9
9
  export declare function rhineProxyItem<T extends object>(data: T | Native, parent?: RhineVar<any> | RhineVarItem<any> | null): ProxiedRhineVarItem<T> | ProxiedRhineVar<T>;
10
10
  //# sourceMappingURL=Proxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Proxy.d.ts","sourceRoot":"","sources":["../../../src/core/proxy/Proxy.ts"],"names":[],"mappings":"AACA,OAAO,uB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AAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,IAAI,EAAE,CAAC,GAAG,MAAM,EAChB,MAAM,GAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,IAAW,GACtD,mBAAmB,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CA2F7C"}
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.DEFAULT_PROTOCOL_LIST = exports.PROTOCOL_LIST = void 0;
29
+ exports.DEFAULT_PUBLIC_URL = exports.PROTOCOL_LIST = void 0;
30
30
  exports.rhineProxy = rhineProxy;
31
31
  exports.rhineProxyItem = rhineProxyItem;
32
32
  const yjs_1 = require("yjs");
@@ -38,15 +38,15 @@ const ConvertProperty_1 = require("../utils/ConvertProperty");
38
38
  const NativeUtils_1 = require("../native/NativeUtils");
39
39
  const RhineVar_1 = __importDefault(require("./RhineVar"));
40
40
  exports.PROTOCOL_LIST = ['ws://', "wss://"];
41
- exports.DEFAULT_PROTOCOL_LIST = exports.PROTOCOL_LIST[0];
41
+ exports.DEFAULT_PUBLIC_URL = 'wss://rpw.rhineai.com/';
42
42
  function rhineProxy(defaultValue, connector, overwrite = false) {
43
43
  let target = (0, DataUtils_1.ensureNative)(defaultValue);
44
44
  if (connector) {
45
- if (typeof connector === 'string') {
46
- if (exports.PROTOCOL_LIST.every(protocol => !connector.startsWith(protocol))) {
47
- connector = exports.DEFAULT_PROTOCOL_LIST + connector;
45
+ if (!(connector instanceof WebsocketRhineConnector_1.default)) {
46
+ if (exports.PROTOCOL_LIST.every(protocol => !(String(connector)).startsWith(protocol))) {
47
+ connector = exports.DEFAULT_PUBLIC_URL + connector;
48
48
  }
49
- connector = (0, WebsocketRhineConnector_1.websocketRhineConnect)(connector);
49
+ connector = (0, WebsocketRhineConnector_1.websocketRhineConnect)(String(connector));
50
50
  }
51
51
  target = connector.bind(target, Boolean(overwrite));
52
52
  }
@@ -8,7 +8,7 @@ function useRhine(proxy) {
8
8
  const [state, setState] = (0, react_1.useState)(getState);
9
9
  (0, react_1.useEffect)(() => {
10
10
  var _a;
11
- proxy.subscribe(() => {
11
+ proxy.subscribeDeep(() => {
12
12
  // TODO: 提高性能
13
13
  setState(getState);
14
14
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhine-var",
3
- "version": "0.4.5",
3
+ "version": "0.4.10",
4
4
  "description": "Variables that support multi-user collaboration and persistence, making collaboration and variable operations as simple as possible, with strict and well-defined type hints.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,18 +8,31 @@
8
8
  "prepare": "ts-patch install -s",
9
9
  "install-next": "npm install --prefix ./test/debug/next-app",
10
10
  "link-next": "npm link && npm link rhine-var --prefix ./test/debug/next-app",
11
-
12
- "watch": "tsc --watch",
13
11
  "server": "npm run start --prefix ./test/server",
12
+ "watch": "tsc --watch",
14
13
  "next": "npm run dev --prefix ./test/debug/next-app",
15
-
16
14
  "test": "echo \"Error: no test specified\" && exit 1",
17
15
  "build": "tsc",
18
16
  "publish": "npm publish"
19
17
  },
20
18
  "author": "RhineAI",
21
19
  "license": "Apache-2.0",
22
- "keywords": ["CRDT", "state", "data-persistence", "offline-first", "shared-editing", "proxy", "collaboration", "websocket", "strongly-typed", "real-time", "concise", "concise", "rigorous", "concurrency"],
20
+ "keywords": [
21
+ "CRDT",
22
+ "state",
23
+ "data-persistence",
24
+ "offline-first",
25
+ "shared-editing",
26
+ "proxy",
27
+ "collaboration",
28
+ "websocket",
29
+ "strongly-typed",
30
+ "real-time",
31
+ "concise",
32
+ "concise",
33
+ "rigorous",
34
+ "concurrency"
35
+ ],
23
36
  "repository": {
24
37
  "type": "git",
25
38
  "url": "https://github.com/RhineAI-Lab/rhine-var.git"
@@ -36,13 +49,12 @@
36
49
  "@types/puppeteer": "^7.0.4",
37
50
  "@types/react": "^18.3.5",
38
51
  "@types/react-dom": "^18.3.0",
39
- "typescript": "^5.5.4",
40
52
  "jest": "^29.7.0",
41
53
  "jest-puppeteer": "^10.1.1",
42
54
  "puppeteer": "^23.3.0",
43
55
  "ts-jest": "^29.2.5",
44
- "ts-node": "^10.9.2",
45
56
  "ts-patch": "^3.2.1",
57
+ "typescript": "5.5.4",
46
58
  "typescript-transform-paths": "^3.5.0"
47
59
  },
48
60
  "dependencies": {
@@ -50,7 +62,7 @@
50
62
  "yjs": "^13.6.18"
51
63
  },
52
64
  "peerDependencies": {
53
- "react": ">=16.8.0",
54
- "react-dom": ">=16.8.0"
65
+ "react": "^18.0.0",
66
+ "react-dom": "^18.0.0"
55
67
  }
56
68
  }
@@ -1,4 +0,0 @@
1
- import RhineVar from "../../proxy/RhineVar";
2
- export default class RhineArray<T> extends Array<T | RhineVar<T[]>> {
3
- }
4
- //# sourceMappingURL=RhineArray.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RhineArray.d.ts","sourceRoot":"","sources":["../../../../src/core/class/array/RhineArray.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,6BAA8B;AAE7C,MAAM,CAAC,OAAO,OAAO,UAAU,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;CAElE"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class RhineArray extends Array {
4
- }
5
- exports.default = RhineArray;
@@ -1,5 +0,0 @@
1
- export declare const DIRECT_KEY_PREVIOUS = "RHINE_VAR_DIRECT_PACKAGE_PREFIX_";
2
- export declare function directKey(key: string | number): string;
3
- export declare function isDirectKey(key: string | any): boolean;
4
- export declare function originKey(key: string | symbol | number): string | symbol | number;
5
- //# sourceMappingURL=DirectKey.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DirectKey.d.ts","sourceRoot":"","sources":["../../../src/core/proxy/DirectKey.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,qCAAqC,CAAA;AAErE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,UAE7C;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,WAE5C;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAajF"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DIRECT_KEY_PREVIOUS = void 0;
4
- exports.directKey = directKey;
5
- exports.isDirectKey = isDirectKey;
6
- exports.originKey = originKey;
7
- exports.DIRECT_KEY_PREVIOUS = 'RHINE_VAR_DIRECT_PACKAGE_PREFIX_';
8
- function directKey(key) {
9
- return exports.DIRECT_KEY_PREVIOUS + key;
10
- }
11
- function isDirectKey(key) {
12
- return typeof key === 'string' && key.startsWith(exports.DIRECT_KEY_PREVIOUS);
13
- }
14
- function originKey(key) {
15
- if (typeof key === 'number')
16
- key = String(key);
17
- if (typeof key !== 'string')
18
- return key;
19
- if (key.startsWith(exports.DIRECT_KEY_PREVIOUS)) {
20
- key = key.split(exports.DIRECT_KEY_PREVIOUS)[1];
21
- let kn = parseInt(key);
22
- if (isNaN(kn)) {
23
- return key;
24
- }
25
- else {
26
- return kn;
27
- }
28
- }
29
- return key;
30
- }
@@ -1,4 +0,0 @@
1
- export declare const DIRECT_KEY_PREVIOUS = "RHINE_VAR_DIRECT_PACKAGE_PREFIX - ";
2
- export declare function directKey(key: string): string;
3
- export declare function isDirectKey(key: string): boolean;
4
- //# sourceMappingURL=DirectPackage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DirectPackage.d.ts","sourceRoot":"","sources":["../../../src/core/proxy/DirectPackage.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,uCAAuC,CAAA;AAEvE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,UAEpC;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,WAEtC"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DIRECT_KEY_PREVIOUS = void 0;
4
- exports.directKey = directKey;
5
- exports.isDirectKey = isDirectKey;
6
- exports.DIRECT_KEY_PREVIOUS = 'RHINE_VAR_DIRECT_PACKAGE_PREFIX - ';
7
- function directKey(key) {
8
- return exports.DIRECT_KEY_PREVIOUS + key;
9
- }
10
- function isDirectKey(key) {
11
- return key.startsWith(exports.DIRECT_KEY_PREVIOUS);
12
- }
@@ -1,8 +0,0 @@
1
- type keyType = string | symbol | number;
2
- export default class KeyWithDirectFlag {
3
- value: keyType;
4
- constructor(value: keyType);
5
- }
6
- export declare function directKey(value: keyType): KeyWithDirectFlag;
7
- export {};
8
- //# sourceMappingURL=KeyWithDirectFlag.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeyWithDirectFlag.d.ts","sourceRoot":"","sources":["../../../src/core/proxy/KeyWithDirectFlag.ts"],"names":[],"mappings":"AACA,KAAK,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AAEvC,MAAM,CAAC,OAAO,OAAO,iBAAiB;IAE3B,KAAK,EAAE,OAAO;gBAAd,KAAK,EAAE,OAAO;CAExB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,qBAEvC"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.directKey = directKey;
4
- class KeyWithDirectFlag {
5
- constructor(value) {
6
- this.value = value;
7
- }
8
- }
9
- exports.default = KeyWithDirectFlag;
10
- function directKey(value) {
11
- return new KeyWithDirectFlag(value);
12
- }
@@ -1,7 +0,0 @@
1
- import RhineVarItem from "./RhineVarItem";
2
- export type RecursiveCrossRhineVar<T> = {
3
- [K in keyof T]: T[K] extends object ? RecursiveCrossRhineVar<T[K]> & RhineVarItem<T[K]> : T[K];
4
- };
5
- export type StoredRhineVar<T> = T & RecursiveCrossRhineVar<T> & RhineVarItem<T>;
6
- export type ProxiedRhineVar<T> = StoredRhineVar<T>;
7
- //# sourceMappingURL=ProxiedRhineVarItem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProxiedRhineVarItem.d.ts","sourceRoot":"","sources":["../../../src/core/proxy/ProxiedRhineVarItem.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,uBAAkC;AAErD,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;KACrC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC/F,CAAA;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;AAE/E,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- import RhineVarItem from "./RhineVarItem";
2
- import WebsocketRhineConnector from "../connector/WebsocketRhineConnector";
3
- export default class RhineVar<T> extends RhineVarItem<T> {
4
- connector: WebsocketRhineConnector | null;
5
- isRoot(): boolean;
6
- root(): RhineVar<any>;
7
- }
8
- //# sourceMappingURL=RhineVarRoot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RhineVarRoot.d.ts","sourceRoot":"","sources":["../../../src/core/proxy/RhineVarRoot.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,uBAAkC;AACrD,OAAO,uBAAuB,6CAAiD;AAE/E,MAAM,CAAC,OAAO,OAAO,QAAQ,CAAC,CAAC,CAAE,SAAQ,YAAY,CAAC,CAAC,CAAC;IAEtD,SAAS,EAAE,uBAAuB,GAAG,IAAI,CAAO;IAEhD,MAAM,IAAI,OAAO;IAIjB,IAAI,IAAI,QAAQ,CAAC,GAAG,CAAC;CAItB"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const RhineVarItem_1 = __importDefault(require("./RhineVarItem"));
7
- class RhineVar extends RhineVarItem_1.default {
8
- constructor() {
9
- super(...arguments);
10
- this.connector = null;
11
- }
12
- isRoot() {
13
- return true;
14
- }
15
- root() {
16
- return this;
17
- }
18
- }
19
- exports.default = RhineVar;