Comparing version 3.0.2 to 4.0.0
@@ -36,5 +36,8 @@ "use strict"; | ||
.then(res => res.json()) | ||
.then(res => res === null || res === void 0 ? void 0 : res.result) | ||
.catch(err => { | ||
throw new cent_exception_1.CentException(err); | ||
.then(res => { | ||
var _a; | ||
if (res === null || res === void 0 ? void 0 : res.error) { | ||
throw new cent_exception_1.CentException(res === null || res === void 0 ? void 0 : res.error); | ||
} | ||
return (_a = res === null || res === void 0 ? void 0 : res.result) !== null && _a !== void 0 ? _a : {}; | ||
}); | ||
@@ -41,0 +44,0 @@ } |
@@ -7,3 +7,3 @@ { | ||
], | ||
"rootDir": "test", | ||
"rootDir": ".", | ||
"testRegex": ".*\\.spec\\.ts$", | ||
@@ -13,3 +13,4 @@ "transform": { | ||
}, | ||
"testEnvironment": "node" | ||
"testEnvironment": "node", | ||
"coverageDirectory": "./coverage" | ||
} |
{ | ||
"name": "cent.js", | ||
"description": "Javascript library to communicate with Centrifugo HTTP API", | ||
"version": "3.0.2", | ||
"version": "4.0.0", | ||
"scripts": { | ||
@@ -27,21 +27,21 @@ "build": "rimraf -rf dist && tsc -p tsconfig.json", | ||
"dependencies": { | ||
"undici": "5.22.1" | ||
"undici": "5.27.0" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "17.6.7", | ||
"@commitlint/config-angular": "17.6.7", | ||
"@types/jest": "29.5.3", | ||
"@types/node": "20.4.2", | ||
"@commitlint/cli": "18.2.0", | ||
"@commitlint/config-angular": "18.1.0", | ||
"@types/jest": "29.5.7", | ||
"@types/node": "20.8.10", | ||
"@typescript-eslint/eslint-plugin": "5.62.0", | ||
"@typescript-eslint/parser": "5.62.0", | ||
"eslint": "8.45.0", | ||
"eslint-config-prettier": "8.8.0", | ||
"eslint-plugin-import": "2.27.5", | ||
"eslint": "8.52.0", | ||
"eslint-config-prettier": "9.0.0", | ||
"eslint-plugin-import": "2.29.0", | ||
"husky": "8.0.3", | ||
"jest": "29.6.1", | ||
"prettier": "3.0.0", | ||
"release-it": "16.1.2", | ||
"rimraf": "5.0.1", | ||
"jest": "29.7.0", | ||
"prettier": "3.0.3", | ||
"release-it": "16.2.1", | ||
"rimraf": "5.0.5", | ||
"ts-jest": "29.1.1", | ||
"typescript": "5.1.6" | ||
"typescript": "5.2.2" | ||
}, | ||
@@ -48,0 +48,0 @@ "repository": { |
@@ -18,3 +18,3 @@ # cent.js | ||
```javascript | ||
const { CentClient } = require('cent.js'); | ||
const {CentClient} = require('cent.js'); | ||
@@ -25,18 +25,20 @@ // Initialize client instance. | ||
token: 'XXX' | ||
}) | ||
}); | ||
// Publish data into channel | ||
client.publish({ | ||
const publishRes = await client.publish({ | ||
channel: 'public:chat', | ||
data: { input: "test" } | ||
}) | ||
data: {input: "test"} | ||
}).catch(err => handleError()); // We throw error in case of unsuccessful | ||
// response from Centrifugo or some other | ||
// internal errors. | ||
// Other available methods | ||
client.unsubscribe({ user: 'user_id', channel: 'channel' }); | ||
client.disconnect({ user: 'user_id' }) | ||
client.getHistory({ channel: 'channel' }) | ||
client.getPresence({ channel: 'channel' }) | ||
client.getChannels() | ||
client.getInfo() | ||
client.removeHistory({ channel: 'channel' }) | ||
await client.unsubscribe({user: 'user_id', channel: 'channel'}); | ||
await client.disconnect({user: 'user_id'}) | ||
await client.getHistory({channel: 'channel'}) | ||
await client.getPresence({channel: 'channel'}) | ||
await client.getChannels() | ||
await client.getInfo() | ||
await client.removeHistory({channel: 'channel'}) | ||
``` | ||
@@ -43,0 +45,0 @@ |
55423
43
930
52
+ Added@fastify/busboy@2.1.1(transitive)
+ Addedundici@5.27.0(transitive)
- Removedbusboy@1.6.0(transitive)
- Removedstreamsearch@1.1.0(transitive)
- Removedundici@5.22.1(transitive)
Updatedundici@5.27.0