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

@push-rpc/core

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@push-rpc/core - npm Package Compare versions

Comparing version 1.1.5 to 1.1.8

4

dist/local.d.ts

@@ -15,3 +15,5 @@ import { DataConsumer, DataSupplier, Topic, TopicImpl } from "./rpc";

constructor(supplier: DataSupplier<D, F>, opts?: Partial<LocalTopicImplOpts<D, F, TD>>);
name: string;
private name;
getTopicName(): string;
setTopicName(s: string): void;
trigger(filter?: Partial<F>, suppliedData?: TD): void;

@@ -18,0 +20,0 @@ getData(filter: F, ctx: any): Promise<D>;

@@ -95,2 +95,8 @@ "use strict";

}
LocalTopicImpl.prototype.getTopicName = function () {
return this.name;
};
LocalTopicImpl.prototype.setTopicName = function (s) {
this.name = s;
};
LocalTopicImpl.prototype.trigger = function (filter, suppliedData) {

@@ -150,3 +156,3 @@ if (filter === void 0) { filter = {}; }

data = _a;
session.send(rpc_1.MessageType.Data, utils_1.createMessageId(), localTopic.name, filter, data);
session.send(rpc_1.MessageType.Data, utils_1.createMessageId(), localTopic.getTopicName(), filter, data);
return [2 /*return*/];

@@ -165,3 +171,3 @@ }

data = _a.sent();
session.send(rpc_1.MessageType.Data, utils_1.createMessageId(), this.name, filter, data);
session.send(rpc_1.MessageType.Data, utils_1.createMessageId(), this.getTopicName(), filter, data);
return [2 /*return*/];

@@ -226,4 +232,4 @@ }

var name = prefix + key;
if (item instanceof LocalTopicImpl) {
item.name = name;
if ("setTopicName" in item) {
item.setTopicName(name);
return;

@@ -230,0 +236,0 @@ }

@@ -11,3 +11,3 @@ "use strict";

if (typeof item == "object") {
if (item instanceof TopicImpl)
if ("getTopicName" in item)
return { item: item, object: services };

@@ -14,0 +14,0 @@ if (!item) {

@@ -203,3 +203,3 @@ "use strict";

}
this.get(id, localTopic, other[0]);
this.get(id, name, localTopic, other[0]);
break;

@@ -344,3 +344,3 @@ case rpc_1.MessageType.Call:

};
RpcSession.prototype.get = function (id, topic, params) {
RpcSession.prototype.get = function (id, name, topic, params) {
return __awaiter(this, void 0, void 0, function () {

@@ -352,3 +352,3 @@ var d, e_3;

_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, topic.getData(params, this.createContext(id, topic.name))];
return [4 /*yield*/, topic.getData(params, this.createContext(id, topic.getTopicName()))];
case 1:

@@ -360,2 +360,3 @@ d = _a.sent();

e_3 = _a.sent();
logger_1.log.error("Unable to get data from topic " + name, e_3);
this.sendError(id, e_3);

@@ -362,0 +363,0 @@ return [3 /*break*/, 3];

{
"name": "@push-rpc/core",
"version": "1.1.5",
"version": "1.1.8",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"prepublishOnly": "yarn build",
"prepublishOnly": "yarn build && yarn test",
"build": "tsc",

@@ -20,3 +20,3 @@ "test": "mocha -r ts-node/register tests/**/*.ts"

},
"gitHead": "f6d61eaba29157055081e1d323c3a5297092e74c"
"gitHead": "8878449ed1a1c0e2ea4a5fbe1d5063958f31b20f"
}

@@ -35,4 +35,12 @@ import {DataConsumer, DataSupplier, MessageType, Topic, TopicImpl} from "./rpc"

public name: string
private name: string
getTopicName(): string {
return this.name
}
setTopicName(s: string) {
this.name = s
}
trigger(filter: Partial<F> = {}, suppliedData?: TD): void {

@@ -72,3 +80,3 @@ for (const subscription of Object.values(this.subscriptions)) {

session.send(MessageType.Data, createMessageId(), localTopic.name, filter, data)
session.send(MessageType.Data, createMessageId(), localTopic.getTopicName(), filter, data)
})

@@ -85,3 +93,3 @@ }),

const data = await this.supplier(filter, session.createContext())
session.send(MessageType.Data, createMessageId(), this.name, filter, data)
session.send(MessageType.Data, createMessageId(), this.getTopicName(), filter, data)
}

@@ -157,4 +165,4 @@

if (item instanceof LocalTopicImpl) {
item.name = name
if ("setTopicName" in item) {
item.setTopicName(name)
return

@@ -161,0 +169,0 @@ }

@@ -28,3 +28,3 @@ /**

if (typeof item == "object") {
if (item instanceof TopicImpl) return {item: item as any, object: services}
if ("getTopicName" in item) return {item: item as any, object: services}

@@ -31,0 +31,0 @@ if (!item) {

@@ -183,3 +183,3 @@ import {log} from "./logger"

this.get(id, localTopic, other[0])
this.get(id, name, localTopic, other[0])
break

@@ -331,7 +331,8 @@

private async get(id, topic: LocalTopicImpl<any, any>, params) {
private async get(id, name: string, topic: LocalTopicImpl<any, any>, params) {
try {
const d = await topic.getData(params, this.createContext(id, topic.name))
const d = await topic.getData(params, this.createContext(id, topic.getTopicName()))
this.send(MessageType.Result, id, d)
} catch (e) {
log.error(`Unable to get data from topic ${name}`, e)
this.sendError(id, e)

@@ -338,0 +339,0 @@ }

@@ -27,3 +27,3 @@ import {assert} from "chai"

// wait for timeout
await new Promise(r => setTimeout(r, keepAliveTimeout * 2))
await new Promise(r => setTimeout(r, keepAliveTimeout * 2.5))

@@ -30,0 +30,0 @@ // should be closed

@@ -35,5 +35,10 @@ import {assert} from "chai"

const {remote: client, disconnect} = await createRpcClient(
let socket
const {remote: client} = await createRpcClient(
1,
() => createNodeWebsocket(`ws://localhost:${TEST_PORT}`),
() => {
socket = createNodeWebsocket(`ws://localhost:${TEST_PORT}`)
return socket
},
{reconnect: true}

@@ -58,4 +63,4 @@ )

// resubscribe
disconnect()
// disconnect & resubscribe
socket.disconnect()
await new Promise(resolve => setTimeout(resolve, 50))

@@ -62,0 +67,0 @@

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