@chijs/client
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -6,3 +6,3 @@ import type { Socket } from 'socket.io-client'; | ||
socket: Socket; | ||
private internalEndpoint; | ||
endpoint: RpcEndpoint<ClientDescriptor>; | ||
server: import("@chijs/core").RpcHandle<ServerDescriptor>; | ||
@@ -12,7 +12,8 @@ service: import("@chijs/core").MapAsync<import("@chijs/core").Unprefix<{ | ||
"$s:misc:startTime"(): number; | ||
"$s:plugin:load"(mod: string): void; | ||
"$s:plugin:load"(id: string): [ok: boolean, reason?: string | undefined]; | ||
"$s:plugin:unload"(id: string): void; | ||
"$s:plugin:list"(): import("@chijs/core").IPluginInfo[]; | ||
"$s:plugin:get"(id: string): import("@chijs/core").IPluginInfo; | ||
"$s:service:add"(plugin: string, id: string, params: Record<string, unknown>): void; | ||
"$s:service:update"(id: string, params: Record<string, unknown>): void; | ||
"$s:service:add"(defn: import("@chijs/core").IServiceDefn): void; | ||
"$s:service:update"(id: string, attr: Partial<import("@chijs/core").IServiceAttr>): void; | ||
"$s:service:remove"(id: string): void; | ||
@@ -27,7 +28,8 @@ "$s:service:start"(id: string): void; | ||
"$s:misc:startTime"(): number; | ||
"$s:plugin:load"(mod: string): void; | ||
"$s:plugin:load"(id: string): [ok: boolean, reason?: string | undefined]; | ||
"$s:plugin:unload"(id: string): void; | ||
"$s:plugin:list"(): import("@chijs/core").IPluginInfo[]; | ||
"$s:plugin:get"(id: string): import("@chijs/core").IPluginInfo; | ||
"$s:service:add"(plugin: string, id: string, params: Record<string, unknown>): void; | ||
"$s:service:update"(id: string, params: Record<string, unknown>): void; | ||
"$s:service:add"(defn: import("@chijs/core").IServiceDefn): void; | ||
"$s:service:update"(id: string, attr: Partial<import("@chijs/core").IServiceAttr>): void; | ||
"$s:service:remove"(id: string): void; | ||
@@ -42,7 +44,8 @@ "$s:service:start"(id: string): void; | ||
"$s:misc:startTime"(): number; | ||
"$s:plugin:load"(mod: string): void; | ||
"$s:plugin:load"(id: string): [ok: boolean, reason?: string | undefined]; | ||
"$s:plugin:unload"(id: string): void; | ||
"$s:plugin:list"(): import("@chijs/core").IPluginInfo[]; | ||
"$s:plugin:get"(id: string): import("@chijs/core").IPluginInfo; | ||
"$s:service:add"(plugin: string, id: string, params: Record<string, unknown>): void; | ||
"$s:service:update"(id: string, params: Record<string, unknown>): void; | ||
"$s:service:add"(defn: import("@chijs/core").IServiceDefn): void; | ||
"$s:service:update"(id: string, attr: Partial<import("@chijs/core").IServiceAttr>): void; | ||
"$s:service:remove"(id: string): void; | ||
@@ -55,5 +58,4 @@ "$s:service:start"(id: string): void; | ||
constructor(socket: Socket); | ||
get endpoint(): RpcEndpoint<ClientDescriptor>; | ||
} | ||
export * from '@chijs/core'; | ||
export * from 'socket.io-client'; |
import { RpcEndpoint, createRpcWrapper, RpcId } from '@chijs/core'; | ||
export class ChiClient { | ||
socket; | ||
internalEndpoint; | ||
endpoint; | ||
server; | ||
@@ -11,5 +11,5 @@ service; | ||
this.socket = socket; | ||
this.internalEndpoint = new RpcEndpoint(RpcId.client(socket.id), (msg) => socket.emit('rpc', msg)); | ||
this.socket.on('rpc', (msg) => this.internalEndpoint.recv(msg)); | ||
this.server = this.internalEndpoint.getHandle(RpcId.server()); | ||
this.endpoint = new RpcEndpoint(RpcId.client(socket.id), (msg) => socket.emit('rpc', msg)); | ||
this.socket.on('rpc', (msg) => this.endpoint.recv(msg)); | ||
this.server = this.endpoint.getHandle(RpcId.server()); | ||
this.service = createRpcWrapper(this.server, '$s:service:'); | ||
@@ -19,5 +19,2 @@ this.plugin = createRpcWrapper(this.server, '$s:plugin:'); | ||
} | ||
get endpoint() { | ||
return this.internalEndpoint; | ||
} | ||
} | ||
@@ -24,0 +21,0 @@ export * from '@chijs/core'; |
{ | ||
"name": "@chijs/client", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"main": "lib/index.js", | ||
@@ -19,3 +19,3 @@ "license": "AGPL-3.0", | ||
"dependencies": { | ||
"@chijs/core": "^0.0.6", | ||
"@chijs/core": "^0.0.7", | ||
"socket.io-client": "^4.5.1" | ||
@@ -22,0 +22,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5699
76
Updated@chijs/core@^0.0.7