Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@chijs/client

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chijs/client - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

58

lib/index.d.ts

@@ -1,12 +0,54 @@

import { ManagerOptions, Socket, SocketOptions } from 'socket.io-client';
import { RpcHub, RpcWrapped } from '@chijs/core';
import type { IClientRpcFns, IServerClientRpcFns } from '@chijs/core';
import type { Socket } from 'socket.io-client';
import { RpcEndpoint } from '@chijs/core';
import type { ClientDescriptor, ServerDescriptor } from '@chijs/core';
export declare class ChiClient {
socket: Socket;
hub: RpcHub<IServerClientRpcFns, IClientRpcFns>;
service: RpcWrapped<IServerClientRpcFns, 'app:service:'>;
plugin: RpcWrapped<IServerClientRpcFns, 'app:plugin:'>;
misc: RpcWrapped<IServerClientRpcFns, 'app:misc:'>;
constructor(uri: string | Partial<ManagerOptions & SocketOptions>, opts?: Partial<ManagerOptions & SocketOptions>);
private internalEndpoint;
server: import("@chijs/core").RpcHandle<ServerDescriptor>;
service: import("@chijs/core").MapAsync<import("@chijs/core").Unprefix<{
"$s:misc:versions"(): Record<string, string>;
"$s:misc:startTime"(): number;
"$s:plugin:load"(mod: 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:remove"(id: string): void;
"$s:service:start"(id: string): void;
"$s:service:stop"(id: string): void;
"$s:service:list"(): import("@chijs/core").IServiceInfo[];
"$s:service:get"(id: string): import("@chijs/core").IServiceInfo;
}, "$s:service:">>;
plugin: import("@chijs/core").MapAsync<import("@chijs/core").Unprefix<{
"$s:misc:versions"(): Record<string, string>;
"$s:misc:startTime"(): number;
"$s:plugin:load"(mod: 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:remove"(id: string): void;
"$s:service:start"(id: string): void;
"$s:service:stop"(id: string): void;
"$s:service:list"(): import("@chijs/core").IServiceInfo[];
"$s:service:get"(id: string): import("@chijs/core").IServiceInfo;
}, "$s:plugin:">>;
misc: import("@chijs/core").MapAsync<import("@chijs/core").Unprefix<{
"$s:misc:versions"(): Record<string, string>;
"$s:misc:startTime"(): number;
"$s:plugin:load"(mod: 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:remove"(id: string): void;
"$s:service:start"(id: string): void;
"$s:service:stop"(id: string): void;
"$s:service:list"(): import("@chijs/core").IServiceInfo[];
"$s:service:get"(id: string): import("@chijs/core").IServiceInfo;
}, "$s:misc:">>;
constructor(socket: Socket);
get endpoint(): RpcEndpoint<ClientDescriptor>;
}
export * from '@chijs/core';
export * from 'socket.io-client';

25

lib/index.js

@@ -1,19 +0,24 @@

import { io } from 'socket.io-client';
import { RpcHub, createRpcWrapper } from '@chijs/core';
import { RpcEndpoint, createRpcWrapper, RpcId } from '@chijs/core';
export class ChiClient {
socket;
hub;
internalEndpoint;
server;
service;
plugin;
misc;
constructor(uri, opts) {
this.socket = io(uri, opts);
this.hub = new RpcHub((msg) => void this.socket.emit('rpc', msg));
this.socket.on('rpc', (msg) => this.hub.handle(msg));
this.service = createRpcWrapper(this.hub.client, 'app:service:');
this.plugin = createRpcWrapper(this.hub.client, 'app:plugin:');
this.misc = createRpcWrapper(this.hub.client, 'app:misc:');
constructor(socket) {
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.service = createRpcWrapper(this.server, '$s:service:');
this.plugin = createRpcWrapper(this.server, '$s:plugin:');
this.misc = createRpcWrapper(this.server, '$s:misc:');
}
get endpoint() {
return this.internalEndpoint;
}
}
export * from '@chijs/core';
export * from 'socket.io-client';
//# sourceMappingURL=index.js.map
{
"name": "@chijs/client",
"version": "0.0.5",
"version": "0.0.6",
"main": "lib/index.js",

@@ -19,3 +19,3 @@ "license": "AGPL-3.0",

"dependencies": {
"@chijs/core": "^0.0.5",
"@chijs/core": "^0.0.6",
"socket.io-client": "^4.5.1"

@@ -22,0 +22,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc