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

rubik-telegram

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rubik-telegram - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

26

.eslintrc.js
module.exports = {
"parser": "babel-eslint",
"env": {
"es6": true,
"node": true
},
"extends": ["eslint:recommended"],
"rules": {
"no-console": ["error", { "allow": ["warn", "error", "info", "dir", "time", "timeEnd"] }],
"no-cond-assign": [0, "except-parens"],
"require-yield": [1]
},
"globals": { window: true, fetch: true }
}
"env": {
"browser": true,
"commonjs": true,
"node": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 12
},
"rules": {
}
};
const { Kubik } = require('rubik-main');
const FormData = require('form-data');
const fetch = require('node-fetch');

@@ -56,16 +57,13 @@ const isObject = require('lodash/isObject');

async request(name, body, token, host) {
if (isObject(body)) {
const headers = {};
if (body instanceof FormData) {
Object.assign(headers, body.getHeaders());
} else if (isObject(body)) {
body = JSON.stringify(body);
headers['Content-Type'] = 'application/json';
}
const url = this.getUrl(name, token, host);
const request = await fetch(url, { method: 'POST', body, headers });
const request = await fetch(url, {
method: 'POST',
body,
headers: {
'Content-Type': 'application/json'
}
});
const result = await request.json();

@@ -72,0 +70,0 @@

module.exports = {
verbose: true,
browser: false,
testEnvironment: 'node',

@@ -5,0 +4,0 @@ transform: {},

{
"name": "rubik-telegram",
"version": "1.0.4",
"version": "1.1.0",
"description": "Telegram Bot Api kubik for the Rubik application system",

@@ -25,4 +25,5 @@ "main": "classes/Telegram.js",

"dependencies": {
"lodash": "^4.17.15",
"node-fetch": "^2.6.0"
"form-data": "^4.0.0",
"lodash": "^4.17.21",
"node-fetch": "^2.6.1"
},

@@ -33,7 +34,6 @@ "peerDependencies": {

"devDependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"jest": "^25.2.7",
"eslint": "^7.23.0",
"jest": "^26.6.3",
"rubik-main": "^2.2.1"
}
}

@@ -1,2 +0,2 @@

# rubik-micro
# rubik-telegram
Telegram's Bot API kubik for the Rubik

@@ -3,0 +3,0 @@

/* global describe test expect */
const path = require('path');
const { Kubiks: { Config } } = require('rubik-main');
const FormData = require('form-data');

@@ -50,2 +51,11 @@ const { createApp, createKubik } = require('rubik-main/tests/helpers/creators');

test('Отправляет запрос с form-data', async () => {
const app = getApp();
const kubik = createKubik(Telegram, app);
await app.up();
const response = await kubik.getMe(new FormData());
expect(response.ok).toBe(true);
await app.down();
});
test('Запрос с невалидным токеном падает', async () => {

@@ -52,0 +62,0 @@ const app = getApp();

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