rubigram 0.1.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.
- package/README.md +193 -0
- package/dist/bot.d.ts +24 -0
- package/dist/bot.d.ts.map +1 -0
- package/dist/bot.js +95 -0
- package/dist/bot.js.map +1 -0
- package/dist/client/api-client.d.ts +15 -0
- package/dist/client/api-client.d.ts.map +1 -0
- package/dist/client/api-client.js +127 -0
- package/dist/client/api-client.js.map +1 -0
- package/dist/client/api-error.d.ts +22 -0
- package/dist/client/api-error.d.ts.map +1 -0
- package/dist/client/api-error.js +36 -0
- package/dist/client/api-error.js.map +1 -0
- package/dist/client/types.d.ts +40 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +7 -0
- package/dist/client/types.js.map +1 -0
- package/dist/context/context.d.ts +31 -0
- package/dist/context/context.d.ts.map +1 -0
- package/dist/context/context.js +144 -0
- package/dist/context/context.js.map +1 -0
- package/dist/filters/combinators.d.ts +5 -0
- package/dist/filters/combinators.d.ts.map +1 -0
- package/dist/filters/combinators.js +27 -0
- package/dist/filters/combinators.js.map +1 -0
- package/dist/filters/command.d.ts +7 -0
- package/dist/filters/command.d.ts.map +1 -0
- package/dist/filters/command.js +24 -0
- package/dist/filters/command.js.map +1 -0
- package/dist/filters/predicates.d.ts +10 -0
- package/dist/filters/predicates.d.ts.map +1 -0
- package/dist/filters/predicates.js +39 -0
- package/dist/filters/predicates.js.map +1 -0
- package/dist/filters/rate-limit.d.ts +9 -0
- package/dist/filters/rate-limit.d.ts.map +1 -0
- package/dist/filters/rate-limit.js +18 -0
- package/dist/filters/rate-limit.js.map +1 -0
- package/dist/filters/types.d.ts +5 -0
- package/dist/filters/types.d.ts.map +1 -0
- package/dist/filters/types.js +2 -0
- package/dist/filters/types.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/group/indentity.d.ts +42 -0
- package/dist/plugins/group/indentity.d.ts.map +1 -0
- package/dist/plugins/group/indentity.js +88 -0
- package/dist/plugins/group/indentity.js.map +1 -0
- package/dist/plugins/group/index.d.ts +4 -0
- package/dist/plugins/group/index.d.ts.map +1 -0
- package/dist/plugins/group/index.js +4 -0
- package/dist/plugins/group/index.js.map +1 -0
- package/dist/plugins/group/manager.d.ts +32 -0
- package/dist/plugins/group/manager.d.ts.map +1 -0
- package/dist/plugins/group/manager.js +128 -0
- package/dist/plugins/group/manager.js.map +1 -0
- package/dist/plugins/group/message-lookup.d.ts +45 -0
- package/dist/plugins/group/message-lookup.d.ts.map +1 -0
- package/dist/plugins/group/message-lookup.js +74 -0
- package/dist/plugins/group/message-lookup.js.map +1 -0
- package/dist/plugins/group/types.d.ts +36 -0
- package/dist/plugins/group/types.d.ts.map +1 -0
- package/dist/plugins/group/types.js +2 -0
- package/dist/plugins/group/types.js.map +1 -0
- package/dist/plugins/session/index.d.ts +3 -0
- package/dist/plugins/session/index.d.ts.map +1 -0
- package/dist/plugins/session/index.js +3 -0
- package/dist/plugins/session/index.js.map +1 -0
- package/dist/plugins/session/session.d.ts +5 -0
- package/dist/plugins/session/session.d.ts.map +1 -0
- package/dist/plugins/session/session.js +49 -0
- package/dist/plugins/session/session.js.map +1 -0
- package/dist/plugins/session/types.d.ts +8 -0
- package/dist/plugins/session/types.d.ts.map +1 -0
- package/dist/plugins/session/types.js +2 -0
- package/dist/plugins/session/types.js.map +1 -0
- package/dist/polling/poller.d.ts +2 -0
- package/dist/polling/poller.d.ts.map +1 -0
- package/dist/polling/poller.js +2 -0
- package/dist/polling/poller.js.map +1 -0
- package/dist/polling/types.d.ts +2 -0
- package/dist/polling/types.d.ts.map +1 -0
- package/dist/polling/types.js +2 -0
- package/dist/polling/types.js.map +1 -0
- package/dist/routing/composer.d.ts +15 -0
- package/dist/routing/composer.d.ts.map +1 -0
- package/dist/routing/composer.js +97 -0
- package/dist/routing/composer.js.map +1 -0
- package/dist/routing/types.d.ts +2 -0
- package/dist/routing/types.d.ts.map +1 -0
- package/dist/routing/types.js +2 -0
- package/dist/routing/types.js.map +1 -0
- package/dist/storage/adapter.d.ts +7 -0
- package/dist/storage/adapter.d.ts.map +1 -0
- package/dist/storage/adapter.js +2 -0
- package/dist/storage/adapter.js.map +1 -0
- package/dist/storage/memory-storage.d.ts +11 -0
- package/dist/storage/memory-storage.d.ts.map +1 -0
- package/dist/storage/memory-storage.js +45 -0
- package/dist/storage/memory-storage.js.map +1 -0
- package/dist/storage/sqlite-storage.d.ts +13 -0
- package/dist/storage/sqlite-storage.d.ts.map +1 -0
- package/dist/storage/sqlite-storage.js +74 -0
- package/dist/storage/sqlite-storage.js.map +1 -0
- package/dist/types/models.d.ts +91 -0
- package/dist/types/models.d.ts.map +1 -0
- package/dist/types/models.js +2 -0
- package/dist/types/models.js.map +1 -0
- package/dist/types/types.d.ts +4 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +2 -0
- package/dist/types/types.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export class MemoryStorage {
|
|
2
|
+
storage = new Map();
|
|
3
|
+
get(key) {
|
|
4
|
+
const entry = this.storage.get(key);
|
|
5
|
+
if (!entry)
|
|
6
|
+
return undefined;
|
|
7
|
+
if (entry.expiresAt !== null && entry.expiresAt <= Date.now()) {
|
|
8
|
+
this.storage.delete(key);
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return entry.value;
|
|
12
|
+
}
|
|
13
|
+
set(key, value, ttlMs) {
|
|
14
|
+
const expiresAt = ttlMs !== undefined ? Date.now() + Math.max(0, ttlMs) : null;
|
|
15
|
+
this.storage.set(key, { value, expiresAt });
|
|
16
|
+
}
|
|
17
|
+
delete(key) {
|
|
18
|
+
return this.storage.delete(key);
|
|
19
|
+
}
|
|
20
|
+
has(key) {
|
|
21
|
+
const entry = this.storage.get(key);
|
|
22
|
+
if (!entry)
|
|
23
|
+
return false;
|
|
24
|
+
if (entry.expiresAt !== null && entry.expiresAt <= Date.now()) {
|
|
25
|
+
this.storage.delete(key);
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
clear() {
|
|
31
|
+
this.storage.clear();
|
|
32
|
+
}
|
|
33
|
+
cleanupExpired() {
|
|
34
|
+
const now = Date.now();
|
|
35
|
+
let count = 0;
|
|
36
|
+
for (const [key, entry] of this.storage.entries()) {
|
|
37
|
+
if (entry.expiresAt !== null && entry.expiresAt <= now) {
|
|
38
|
+
this.storage.delete(key);
|
|
39
|
+
count++;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return count;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=memory-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-storage.js","sourceRoot":"","sources":["../../src/storage/memory-storage.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,aAAa;IACP,OAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;IAE7D,GAAG,CAAC,GAAW;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK;YAAE,OAAO,SAAS,CAAC;QAE7B,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YAC9D,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACzB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,KAAQ,EAAE,KAAc;QACvC,MAAM,SAAS,GACb,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAA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.js";
|
|
2
|
+
export declare class SqliteStorage<T = unknown> implements StorageAdapter<T> {
|
|
3
|
+
private readonly db;
|
|
4
|
+
constructor(filePath?: string);
|
|
5
|
+
private init;
|
|
6
|
+
get(key: string): T | undefined;
|
|
7
|
+
set(key: string, value: T, ttlMs?: number): void;
|
|
8
|
+
delete(key: string): boolean;
|
|
9
|
+
has(key: string): boolean;
|
|
10
|
+
cleanupExpired(): number;
|
|
11
|
+
close(): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=sqlite-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-storage.d.ts","sourceRoot":"","sources":["../../src/storage/sqlite-storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,qBAAa,aAAa,CAAC,CAAC,GAAG,OAAO,CAAE,YAAW,cAAc,CAAC,CAAC,CAAC;IAClE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;IAEvC,YAAY,QAAQ,GAAE,MAA0B,EAG/C;IAED,OAAO,CAAC,IAAI;IAWZ,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAiB9B;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAY/C;IAED,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAK3B;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAaxB;IAED,cAAc,IAAI,MAAM,CAOvB;IAED,KAAK,IAAI,IAAI,CAIZ;CACF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import Database from "better-sqlite3";
|
|
2
|
+
export class SqliteStorage {
|
|
3
|
+
db;
|
|
4
|
+
constructor(filePath = "rubigram.sqlite") {
|
|
5
|
+
this.db = new Database(filePath);
|
|
6
|
+
this.init();
|
|
7
|
+
}
|
|
8
|
+
init() {
|
|
9
|
+
this.db.exec(`
|
|
10
|
+
CREATE TABLE IF NOT EXISTS bot_storage (
|
|
11
|
+
key TEXT PRIMARY KEY,
|
|
12
|
+
value TEXT NOT NULL,
|
|
13
|
+
expires_at INTEGER
|
|
14
|
+
);
|
|
15
|
+
CREATE INDEX IF NOT EXISTS idx_expires_at ON bot_storage (expires_at);
|
|
16
|
+
`);
|
|
17
|
+
}
|
|
18
|
+
get(key) {
|
|
19
|
+
const row = this.db
|
|
20
|
+
.prepare("SELECT value, expires_at FROM bot_storage WHERE key = ?")
|
|
21
|
+
.get(key);
|
|
22
|
+
if (!row)
|
|
23
|
+
return undefined;
|
|
24
|
+
if (row.expires_at !== null && row.expires_at <= Date.now()) {
|
|
25
|
+
this.delete(key);
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
return JSON.parse(row.value);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
set(key, value, ttlMs) {
|
|
36
|
+
const expiresAt = ttlMs !== undefined ? Date.now() + Math.max(0, ttlMs) : null;
|
|
37
|
+
const jsonStr = JSON.stringify(value);
|
|
38
|
+
this.db
|
|
39
|
+
.prepare(`INSERT INTO bot_storage (key, value, expires_at)
|
|
40
|
+
VALUES (?, ?, ?)
|
|
41
|
+
ON CONFLICT(key) DO UPDATE SET value = excluded.value, expires_at = excluded.expires_at`)
|
|
42
|
+
.run(key, jsonStr, expiresAt);
|
|
43
|
+
}
|
|
44
|
+
delete(key) {
|
|
45
|
+
const result = this.db
|
|
46
|
+
.prepare("DELETE FROM bot_storage WHERE key = ?")
|
|
47
|
+
.run(key);
|
|
48
|
+
return result.changes > 0;
|
|
49
|
+
}
|
|
50
|
+
has(key) {
|
|
51
|
+
const row = this.db
|
|
52
|
+
.prepare("SELECT expires_at FROM bot_storage WHERE key = ?")
|
|
53
|
+
.get(key);
|
|
54
|
+
if (!row)
|
|
55
|
+
return false;
|
|
56
|
+
if (row.expires_at !== null && row.expires_at <= Date.now()) {
|
|
57
|
+
this.delete(key);
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
cleanupExpired() {
|
|
63
|
+
const result = this.db
|
|
64
|
+
.prepare("DELETE FROM bot_storage WHERE expires_at IS NOT NULL AND expires_at <= ?")
|
|
65
|
+
.run(Date.now());
|
|
66
|
+
return result.changes;
|
|
67
|
+
}
|
|
68
|
+
close() {
|
|
69
|
+
if (this.db.open) {
|
|
70
|
+
this.db.close();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=sqlite-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-storage.js","sourceRoot":"","sources":["../../src/storage/sqlite-storage.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAGtC,MAAM,OAAO,aAAa;IACP,EAAE,CAAoB;IAEvC,YAAY,QAAQ,GAAW,iBAAiB;QAC9C,IAAI,CAAC,EAAE,GAAG,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAEO,IAAI;QACV,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;;;;;;;KAOZ,CAAC,CAAC;IACL,CAAC;IAED,GAAG,CAAC,GAAW;QACb,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE;aAChB,OAAO,CAAC,yDAAyD,CAAC;aAClE,GAAG,CAAC,GAAG,CAA6D,CAAC;QAExE,IAAI,CAAC,GAAG;YAAE,OAAO,SAAS,CAAC;QAE3B,IAAI,GAAG,CAAC,UAAU,KAAK,IAAI,IAAI,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YAC5D,IAAI,CAAC,M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ACd,CAAC;IAED,cAAc;QACZ,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE;aACnB,OAAO,CACN,0EAA0E,CAC3E;aACA,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACnB,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;YACjB,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export type ChatType = "User" | "Group" | "Channel" | "Bot";
|
|
2
|
+
export interface User {
|
|
3
|
+
user_id: string;
|
|
4
|
+
first_name: string;
|
|
5
|
+
last_name?: string;
|
|
6
|
+
username?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Chat {
|
|
9
|
+
chat_id: string;
|
|
10
|
+
chat_type: ChatType;
|
|
11
|
+
user_id?: string;
|
|
12
|
+
firstName?: string;
|
|
13
|
+
username?: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface BotInfo {
|
|
17
|
+
bot_id: string;
|
|
18
|
+
bot_title: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
username: string;
|
|
21
|
+
start_message?: string;
|
|
22
|
+
share_url: string;
|
|
23
|
+
}
|
|
24
|
+
export interface TextMessage {
|
|
25
|
+
message_id: string;
|
|
26
|
+
text: string;
|
|
27
|
+
time?: string;
|
|
28
|
+
reply_to_message_id?: string;
|
|
29
|
+
}
|
|
30
|
+
export type ButtonType = "Text" | "Location" | "Contact" | "Selection";
|
|
31
|
+
export interface KeyboardButton {
|
|
32
|
+
text: string;
|
|
33
|
+
type?: ButtonType;
|
|
34
|
+
button_id?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ReplyKeyboard {
|
|
37
|
+
rows: KeyboardButton[][];
|
|
38
|
+
resize_keyboard?: boolean;
|
|
39
|
+
on_time_keyboard?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface InlineKeyboardButton {
|
|
42
|
+
text: string;
|
|
43
|
+
button_id: string;
|
|
44
|
+
type?: string;
|
|
45
|
+
url?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface InlineKeyboard {
|
|
48
|
+
rows: InlineKeyboardButton[][];
|
|
49
|
+
}
|
|
50
|
+
export type UpdateType = "NewMessage" | "EditedMessage" | "InlineMessage" | "RemovedMessage";
|
|
51
|
+
export interface MessageUpdate {
|
|
52
|
+
message_id: string;
|
|
53
|
+
text?: string;
|
|
54
|
+
chat_id: string;
|
|
55
|
+
sender_id: string;
|
|
56
|
+
sender_type: ChatType;
|
|
57
|
+
reply_to_message_id?: string;
|
|
58
|
+
time?: string;
|
|
59
|
+
author_title?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface InlineMessageUpdate {
|
|
62
|
+
chat_id: string;
|
|
63
|
+
sender_id: string;
|
|
64
|
+
button_id: string;
|
|
65
|
+
message_id?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface Update {
|
|
68
|
+
type: UpdateType;
|
|
69
|
+
chat_id: string;
|
|
70
|
+
new_message?: MessageUpdate;
|
|
71
|
+
updated_message?: MessageUpdate;
|
|
72
|
+
inline_message?: InlineMessageUpdate;
|
|
73
|
+
}
|
|
74
|
+
export interface SendMessagePayload {
|
|
75
|
+
chat_id: string;
|
|
76
|
+
text: string;
|
|
77
|
+
reply_to_message_id?: string;
|
|
78
|
+
inline_keyboard?: InlineKeyboard;
|
|
79
|
+
reply_keyboard?: ReplyKeyboard;
|
|
80
|
+
}
|
|
81
|
+
export interface EditMessagePayload {
|
|
82
|
+
chat_id: string;
|
|
83
|
+
message_id: string;
|
|
84
|
+
text: string;
|
|
85
|
+
inline_keyboard?: InlineKeyboard;
|
|
86
|
+
}
|
|
87
|
+
export interface DeleteMessagePayload {
|
|
88
|
+
chat_id: string;
|
|
89
|
+
message_ids: string[];
|
|
90
|
+
}
|
|
91
|
+
//# sour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c,CAAC;IACjC,cAAc,CAAC,EAAE,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,cAAc,CAAC;CAClC;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/types/models.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAE/C,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CACpD,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,YAAY,KACf,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rubigram",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Modern, Type-Safe, and Modular Bot Framework for Rubika in Node.js & TypeScript",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"prepack": "npm run build",
|
|
20
|
+
"dev": "tsx src/index.ts",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"lint": "eslint ."
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/ManiAlipour/rubigram.git"
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"keywords": [
|
|
33
|
+
"rubika",
|
|
34
|
+
"bot",
|
|
35
|
+
"framework",
|
|
36
|
+
"rubigram",
|
|
37
|
+
"typescript"
|
|
38
|
+
],
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"better-sqlite3": "^13.0.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependenciesMeta": {
|
|
43
|
+
"better-sqlite3": {
|
|
44
|
+
"optional": true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/better-sqlite3": "^9.6.0",
|
|
49
|
+
"@types/node": "^26.4.0",
|
|
50
|
+
"eslint": "^10.9.1",
|
|
51
|
+
"tsx": "^4.23.13",
|
|
52
|
+
"typescript": "^7.0.2",
|
|
53
|
+
"vitest": "^4.1.11"
|
|
54
|
+
}
|
|
55
|
+
}
|