@ozdao/prometheus-framework 0.2.253 → 0.2.254
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/chats.server.js +110 -0
- package/dist/chats.server.mjs +111 -0
- package/dist/files.server.js +12 -3
- package/dist/files.server.mjs +12 -3
- package/dist/prometheus-framework/src/modules/chats/chats.client.cjs +31 -0
- package/dist/prometheus-framework/src/modules/chats/chats.client.cjs.map +1 -0
- package/dist/prometheus-framework/src/modules/chats/chats.client.js +31 -0
- package/dist/prometheus-framework/src/modules/chats/chats.client.js.map +1 -0
- package/dist/prometheus-framework/src/modules/pages/pages.client.cjs +330 -330
- package/dist/prometheus-framework/src/modules/pages/pages.client.js +330 -330
- package/dist/prometheus-framework/src/modules/products/components/layouts/Marketplace.vue.cjs +3 -2
- package/dist/prometheus-framework/src/modules/products/components/layouts/Marketplace.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/layouts/Marketplace.vue.js +4 -3
- package/dist/prometheus-framework/src/modules/products/components/layouts/Marketplace.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Catalog.vue.cjs +7 -5
- package/dist/prometheus-framework/src/modules/products/components/pages/Catalog.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Catalog.vue.js +7 -5
- package/dist/prometheus-framework/src/modules/products/components/pages/Catalog.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/reports/reports.client.cjs +21 -2
- package/dist/prometheus-framework/src/modules/reports/reports.client.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/reports/reports.client.js +20 -1
- package/dist/prometheus-framework/src/modules/reports/reports.client.js.map +1 -1
- package/dist/reports.server.js +21 -8
- package/dist/reports.server.mjs +21 -8
- package/package.json +9 -1
- package/src/modules/chats/chats.client.js +48 -0
- package/src/modules/chats/chats.server.js +32 -0
- package/src/modules/files/files.server.js +17 -7
- package/src/modules/products/components/layouts/Marketplace.vue +1 -0
- package/src/modules/products/components/pages/Catalog.vue +5 -3
- package/src/modules/reports/models/report.model.js +4 -4
- package/src/modules/reports/reports.client.js +35 -14
- package/src/modules/reports/reports.server.js +27 -8
@@ -0,0 +1,110 @@
|
|
1
|
+
"use strict";
|
2
|
+
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
3
|
+
require("./mailing-BQKyTI-q.js");
|
4
|
+
const index = require("./index-CsS7qx1d.js");
|
5
|
+
const controllerFactory$1 = (db) => {
|
6
|
+
const ChatMessage = db.ChatMessage;
|
7
|
+
const saveMessage = async (msg) => {
|
8
|
+
try {
|
9
|
+
const message = new ChatMessage(msg);
|
10
|
+
await message.save();
|
11
|
+
return message;
|
12
|
+
} catch (error) {
|
13
|
+
console.error("Error saving message to database:", error);
|
14
|
+
}
|
15
|
+
};
|
16
|
+
const getMessages = async (chatId) => {
|
17
|
+
try {
|
18
|
+
const messages = await ChatMessage.find({ chatId }).sort({ createdAt: 1 });
|
19
|
+
return messages;
|
20
|
+
} catch (error) {
|
21
|
+
console.error("Error retrieving messages from database:", error);
|
22
|
+
}
|
23
|
+
};
|
24
|
+
return {
|
25
|
+
saveMessage,
|
26
|
+
getMessages
|
27
|
+
};
|
28
|
+
};
|
29
|
+
var chats_controller = controllerFactory$1;
|
30
|
+
const controllerFactory = chats_controller;
|
31
|
+
const middlewareFactory = index.middlewares;
|
32
|
+
var chats_routes = function(app, db, wss) {
|
33
|
+
const controller = controllerFactory(db);
|
34
|
+
middlewareFactory(db);
|
35
|
+
wss.on("connection", (ws) => {
|
36
|
+
console.log("ws connecting...");
|
37
|
+
ws.on("message", async (message) => {
|
38
|
+
const msg = JSON.parse(message);
|
39
|
+
if (msg.type === "joinChat") {
|
40
|
+
ws.chatId = msg.chatId;
|
41
|
+
console.log(`Client joined chat: ${msg.chatId}`);
|
42
|
+
} else {
|
43
|
+
const savedMessage = await controller.saveMessage(msg);
|
44
|
+
wss.clients.forEach((client) => {
|
45
|
+
if (client.chatId && client.chatId.toString() === msg.chatId) {
|
46
|
+
client.send(JSON.stringify(savedMessage));
|
47
|
+
}
|
48
|
+
});
|
49
|
+
}
|
50
|
+
});
|
51
|
+
});
|
52
|
+
app.use(function(req, res, next) {
|
53
|
+
res.header(
|
54
|
+
"Access-Control-Allow-Headers",
|
55
|
+
"Access-Control-Allow-Origin: *",
|
56
|
+
"x-access-token, Origin, Content-Type, Accept"
|
57
|
+
);
|
58
|
+
next();
|
59
|
+
});
|
60
|
+
app.get("/messages/:chatId", async (req, res) => {
|
61
|
+
const { chatId } = req.params;
|
62
|
+
const messages = await controller.getMessages(chatId);
|
63
|
+
res.json(messages);
|
64
|
+
});
|
65
|
+
};
|
66
|
+
var chat_model = (db) => {
|
67
|
+
const ChatMessageSchema = new db.mongoose.Schema({
|
68
|
+
username: {
|
69
|
+
type: String,
|
70
|
+
required: true
|
71
|
+
},
|
72
|
+
chatId: {
|
73
|
+
type: String,
|
74
|
+
required: true
|
75
|
+
},
|
76
|
+
text: {
|
77
|
+
type: String,
|
78
|
+
required: true
|
79
|
+
},
|
80
|
+
createdAt: {
|
81
|
+
type: Date,
|
82
|
+
default: Date.now
|
83
|
+
}
|
84
|
+
});
|
85
|
+
const ChatMessage = db.mongoose.model("ChatMessage", ChatMessageSchema);
|
86
|
+
return ChatMessage;
|
87
|
+
};
|
88
|
+
const ChatsController = chats_controller;
|
89
|
+
const chatsRoutes = chats_routes;
|
90
|
+
const ChatModel = chat_model;
|
91
|
+
function initializeChats(app, db, wss, origins, publicPath) {
|
92
|
+
db.chat = ChatModel(db);
|
93
|
+
if (app) {
|
94
|
+
chatsRoutes(app, db, wss);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
var chats_server = {
|
98
|
+
initialize: initializeChats,
|
99
|
+
models: {
|
100
|
+
ChatModel
|
101
|
+
},
|
102
|
+
routes: {
|
103
|
+
chatsRoutes
|
104
|
+
},
|
105
|
+
controllers: {
|
106
|
+
ChatsController
|
107
|
+
}
|
108
|
+
};
|
109
|
+
const chats_server$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(chats_server);
|
110
|
+
module.exports = chats_server$1;
|
@@ -0,0 +1,111 @@
|
|
1
|
+
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
2
|
+
import "./mailing-C3VD4l0h.mjs";
|
3
|
+
import { m as middlewares } from "./index-UIHE6Rk3.mjs";
|
4
|
+
const controllerFactory$1 = (db) => {
|
5
|
+
const ChatMessage = db.ChatMessage;
|
6
|
+
const saveMessage = async (msg) => {
|
7
|
+
try {
|
8
|
+
const message = new ChatMessage(msg);
|
9
|
+
await message.save();
|
10
|
+
return message;
|
11
|
+
} catch (error) {
|
12
|
+
console.error("Error saving message to database:", error);
|
13
|
+
}
|
14
|
+
};
|
15
|
+
const getMessages = async (chatId) => {
|
16
|
+
try {
|
17
|
+
const messages = await ChatMessage.find({ chatId }).sort({ createdAt: 1 });
|
18
|
+
return messages;
|
19
|
+
} catch (error) {
|
20
|
+
console.error("Error retrieving messages from database:", error);
|
21
|
+
}
|
22
|
+
};
|
23
|
+
return {
|
24
|
+
saveMessage,
|
25
|
+
getMessages
|
26
|
+
};
|
27
|
+
};
|
28
|
+
var chats_controller = controllerFactory$1;
|
29
|
+
const controllerFactory = chats_controller;
|
30
|
+
const middlewareFactory = middlewares;
|
31
|
+
var chats_routes = function(app, db, wss) {
|
32
|
+
const controller = controllerFactory(db);
|
33
|
+
middlewareFactory(db);
|
34
|
+
wss.on("connection", (ws) => {
|
35
|
+
console.log("ws connecting...");
|
36
|
+
ws.on("message", async (message) => {
|
37
|
+
const msg = JSON.parse(message);
|
38
|
+
if (msg.type === "joinChat") {
|
39
|
+
ws.chatId = msg.chatId;
|
40
|
+
console.log(`Client joined chat: ${msg.chatId}`);
|
41
|
+
} else {
|
42
|
+
const savedMessage = await controller.saveMessage(msg);
|
43
|
+
wss.clients.forEach((client) => {
|
44
|
+
if (client.chatId && client.chatId.toString() === msg.chatId) {
|
45
|
+
client.send(JSON.stringify(savedMessage));
|
46
|
+
}
|
47
|
+
});
|
48
|
+
}
|
49
|
+
});
|
50
|
+
});
|
51
|
+
app.use(function(req, res, next) {
|
52
|
+
res.header(
|
53
|
+
"Access-Control-Allow-Headers",
|
54
|
+
"Access-Control-Allow-Origin: *",
|
55
|
+
"x-access-token, Origin, Content-Type, Accept"
|
56
|
+
);
|
57
|
+
next();
|
58
|
+
});
|
59
|
+
app.get("/messages/:chatId", async (req, res) => {
|
60
|
+
const { chatId } = req.params;
|
61
|
+
const messages = await controller.getMessages(chatId);
|
62
|
+
res.json(messages);
|
63
|
+
});
|
64
|
+
};
|
65
|
+
var chat_model = (db) => {
|
66
|
+
const ChatMessageSchema = new db.mongoose.Schema({
|
67
|
+
username: {
|
68
|
+
type: String,
|
69
|
+
required: true
|
70
|
+
},
|
71
|
+
chatId: {
|
72
|
+
type: String,
|
73
|
+
required: true
|
74
|
+
},
|
75
|
+
text: {
|
76
|
+
type: String,
|
77
|
+
required: true
|
78
|
+
},
|
79
|
+
createdAt: {
|
80
|
+
type: Date,
|
81
|
+
default: Date.now
|
82
|
+
}
|
83
|
+
});
|
84
|
+
const ChatMessage = db.mongoose.model("ChatMessage", ChatMessageSchema);
|
85
|
+
return ChatMessage;
|
86
|
+
};
|
87
|
+
const ChatsController = chats_controller;
|
88
|
+
const chatsRoutes = chats_routes;
|
89
|
+
const ChatModel = chat_model;
|
90
|
+
function initializeChats(app, db, wss, origins, publicPath) {
|
91
|
+
db.chat = ChatModel(db);
|
92
|
+
if (app) {
|
93
|
+
chatsRoutes(app, db, wss);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
var chats_server = {
|
97
|
+
initialize: initializeChats,
|
98
|
+
models: {
|
99
|
+
ChatModel
|
100
|
+
},
|
101
|
+
routes: {
|
102
|
+
chatsRoutes
|
103
|
+
},
|
104
|
+
controllers: {
|
105
|
+
ChatsController
|
106
|
+
}
|
107
|
+
};
|
108
|
+
const chats_server$1 = /* @__PURE__ */ getDefaultExportFromCjs(chats_server);
|
109
|
+
export {
|
110
|
+
chats_server$1 as default
|
111
|
+
};
|
package/dist/files.server.js
CHANGED
@@ -291,10 +291,19 @@ var files_routes = function(app, db, origins, publicPath) {
|
|
291
291
|
};
|
292
292
|
const filesController = files_controller;
|
293
293
|
const filesRoutes = files_routes;
|
294
|
+
function initializeFiles(app, db, origins, publicPath) {
|
295
|
+
if (app) {
|
296
|
+
filesRoutes(app, db, origins, publicPath);
|
297
|
+
}
|
298
|
+
}
|
294
299
|
var files_server = {
|
295
|
-
|
296
|
-
|
297
|
-
|
300
|
+
initialize: initializeFiles,
|
301
|
+
routes: {
|
302
|
+
filesRoutes
|
303
|
+
},
|
304
|
+
controllers: {
|
305
|
+
filesController
|
306
|
+
}
|
298
307
|
};
|
299
308
|
const files_server$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(files_server);
|
300
309
|
module.exports = files_server$1;
|
package/dist/files.server.mjs
CHANGED
@@ -290,10 +290,19 @@ var files_routes = function(app, db, origins, publicPath) {
|
|
290
290
|
};
|
291
291
|
const filesController = files_controller;
|
292
292
|
const filesRoutes = files_routes;
|
293
|
+
function initializeFiles(app, db, origins, publicPath) {
|
294
|
+
if (app) {
|
295
|
+
filesRoutes(app, db, origins, publicPath);
|
296
|
+
}
|
297
|
+
}
|
293
298
|
var files_server = {
|
294
|
-
|
295
|
-
|
296
|
-
|
299
|
+
initialize: initializeFiles,
|
300
|
+
routes: {
|
301
|
+
filesRoutes
|
302
|
+
},
|
303
|
+
controllers: {
|
304
|
+
filesController
|
305
|
+
}
|
297
306
|
};
|
298
307
|
const files_server$1 = /* @__PURE__ */ getDefaultExportFromCjs(files_server);
|
299
308
|
export {
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
3
|
+
const chat_store = require("./store/chat.store.cjs");
|
4
|
+
const ChatPage = require("./components/pages/ChatPage.vue.cjs");
|
5
|
+
const ChatWindow = require("./components/sections/ChatWindow.vue.cjs");
|
6
|
+
const ChatMessage = require("./components/blocks/ChatMessage.vue.cjs");
|
7
|
+
function initializeChats(app, store, router, options = {}) {
|
8
|
+
options.route || "Home";
|
9
|
+
store.addStore("chat", chat_store);
|
10
|
+
}
|
11
|
+
const ModuleChats = {
|
12
|
+
initialize: initializeChats,
|
13
|
+
views: {
|
14
|
+
store: {
|
15
|
+
storeChatModule: chat_store
|
16
|
+
},
|
17
|
+
router: {
|
18
|
+
// createChatRoutes
|
19
|
+
},
|
20
|
+
components: {
|
21
|
+
// Pages
|
22
|
+
ChatPage: ChatPage.default,
|
23
|
+
// Sections
|
24
|
+
ChatWindow: ChatWindow.default,
|
25
|
+
// Blocks
|
26
|
+
ChatMessage: ChatMessage.default
|
27
|
+
}
|
28
|
+
}
|
29
|
+
};
|
30
|
+
exports.default = ModuleChats;
|
31
|
+
//# sourceMappingURL=chats.client.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"chats.client.cjs","sources":["../../../../../src/modules/chats/chats.client.js"],"sourcesContent":["// Store\nimport * as storeChatModule from './store/chat.store.js';\n\n// Router\n// import { createChatRoutes } from './router/chat.router';\n\n// Views\n// Pages\nimport ChatPage from './components/pages/ChatPage.vue';\n\n// Sections\nimport ChatWindow from './components/sections/ChatWindow.vue';\n\n// Blocks\nimport ChatMessage from './components/blocks/ChatMessage.vue';\n\n// Пример функции инициализации для модуля чатов\nfunction initializeChats(app, store, router, options = {}) {\n const route = options.route || 'Home';\n\n // const routesChat = createChatRoutes();\n \n // router.addRoute(route, routesChat);\n \n store.addStore('chat', storeChatModule);\n}\n\nconst ModuleChats = {\n initialize: initializeChats,\n views: {\n store: {\n storeChatModule\n },\n router: {\n // createChatRoutes\n },\n components: {\n // Pages\n ChatPage,\n // Sections\n ChatWindow,\n // Blocks\n ChatMessage\n }\n }\n}\n\nexport default ModuleChats;"],"names":["storeChatModule","ChatPage","ChatWindow","ChatMessage"],"mappings":";;;;;;AAiBA,SAAS,gBAAgB,KAAK,OAAO,QAAQ,UAAU,CAAA,GAAI;AAC3C,UAAQ,SAAS;AAM/B,QAAM,SAAS,QAAQA,UAAe;AACxC;AAEK,MAAC,cAAc;AAAA,EAClB,YAAY;AAAA,EACZ,OAAO;AAAA,IACL,OAAO;AAAA,MACX,iBAAMA;AAAAA,IACD;AAAA,IACD,QAAQ;AAAA;AAAA,IAEP;AAAA,IACD,YAAY;AAAA;AAAA,MAEhB,UAAMC,SAAQ;AAAA;AAAA,MAEd,YAAMC,WAAU;AAAA;AAAA,MAEhB,aAAMC,YAAW;AAAA,IACZ;AAAA,EACF;AACH;;"}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import * as chat_store from "./store/chat.store.js";
|
2
|
+
import _sfc_main from "./components/pages/ChatPage.vue.js";
|
3
|
+
import _sfc_main$1 from "./components/sections/ChatWindow.vue.js";
|
4
|
+
import ChatMessage from "./components/blocks/ChatMessage.vue.js";
|
5
|
+
function initializeChats(app, store, router, options = {}) {
|
6
|
+
options.route || "Home";
|
7
|
+
store.addStore("chat", chat_store);
|
8
|
+
}
|
9
|
+
const ModuleChats = {
|
10
|
+
initialize: initializeChats,
|
11
|
+
views: {
|
12
|
+
store: {
|
13
|
+
storeChatModule: chat_store
|
14
|
+
},
|
15
|
+
router: {
|
16
|
+
// createChatRoutes
|
17
|
+
},
|
18
|
+
components: {
|
19
|
+
// Pages
|
20
|
+
ChatPage: _sfc_main,
|
21
|
+
// Sections
|
22
|
+
ChatWindow: _sfc_main$1,
|
23
|
+
// Blocks
|
24
|
+
ChatMessage
|
25
|
+
}
|
26
|
+
}
|
27
|
+
};
|
28
|
+
export {
|
29
|
+
ModuleChats as default
|
30
|
+
};
|
31
|
+
//# sourceMappingURL=chats.client.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"chats.client.js","sources":["../../../../../src/modules/chats/chats.client.js"],"sourcesContent":["// Store\nimport * as storeChatModule from './store/chat.store.js';\n\n// Router\n// import { createChatRoutes } from './router/chat.router';\n\n// Views\n// Pages\nimport ChatPage from './components/pages/ChatPage.vue';\n\n// Sections\nimport ChatWindow from './components/sections/ChatWindow.vue';\n\n// Blocks\nimport ChatMessage from './components/blocks/ChatMessage.vue';\n\n// Пример функции инициализации для модуля чатов\nfunction initializeChats(app, store, router, options = {}) {\n const route = options.route || 'Home';\n\n // const routesChat = createChatRoutes();\n \n // router.addRoute(route, routesChat);\n \n store.addStore('chat', storeChatModule);\n}\n\nconst ModuleChats = {\n initialize: initializeChats,\n views: {\n store: {\n storeChatModule\n },\n router: {\n // createChatRoutes\n },\n components: {\n // Pages\n ChatPage,\n // Sections\n ChatWindow,\n // Blocks\n ChatMessage\n }\n }\n}\n\nexport default ModuleChats;"],"names":["storeChatModule","ChatPage","ChatWindow"],"mappings":";;;;AAiBA,SAAS,gBAAgB,KAAK,OAAO,QAAQ,UAAU,CAAA,GAAI;AAC3C,UAAQ,SAAS;AAM/B,QAAM,SAAS,QAAQA,UAAe;AACxC;AAEK,MAAC,cAAc;AAAA,EAClB,YAAY;AAAA,EACZ,OAAO;AAAA,IACL,OAAO;AAAA,MACX,iBAAMA;AAAAA,IACD;AAAA,IACD,QAAQ;AAAA;AAAA,IAEP;AAAA,IACD,YAAY;AAAA;AAAA,MAEhB,UAAMC;AAAAA;AAAAA,MAEN,YAAMC;AAAAA;AAAAA,MAEA;AAAA,IACD;AAAA,EACF;AACH;"}
|