@ozdao/martyrs 0.2.517 → 0.2.519
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/dist/{abac-Cf_9lCSh.js → abac-CnJsrv8S.js} +3 -3
- package/dist/{abac-6LjoG9u-.cjs → abac-DOyUjhee.cjs} +3 -3
- package/dist/builder.cjs +27 -25
- package/dist/builder.js +27 -25
- package/dist/{crud-sE7GLPbj.js → crud-BIFl1W1i.js} +6 -6
- package/dist/{crud-JN_LFj01.cjs → crud-CC6k6yY5.cjs} +6 -6
- package/dist/{globals.logger-CZMgIMlM.cjs → globals.logger-BuW7JHMY.cjs} +63 -53
- package/dist/{globals.logger-Bf6rRU7j.js → globals.logger-VRHh-WUW.js} +63 -53
- package/dist/{globals.observer-CV2wCzzh.cjs → globals.observer-C_FYclgV.cjs} +36 -1
- package/dist/{globals.observer-CDqUjVU5.js → globals.observer-MZsqaE6F.js} +36 -1
- package/dist/globals.server.cjs +1 -1
- package/dist/globals.server.js +1 -1
- package/dist/inventory.server.cjs +276 -376
- package/dist/inventory.server.js +276 -376
- package/dist/{main-wmEhGVvD.js → main-DgGUrhjT.js} +4 -4
- package/dist/{main-CSzPfQYR.cjs → main-Wr1_4rwl.cjs} +2 -2
- package/dist/martyrs/src/components/Button/Button.vue.cjs +1 -1
- package/dist/martyrs/src/components/Button/Button.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Button/Button.vue.js +1 -1
- package/dist/martyrs/src/components/Button/Button.vue.js.map +1 -1
- package/dist/martyrs/src/components/Chips/{Chips.vue.cjs → Chips.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Chips/Chips.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Chips/{Chips.vue.js → Chips.vue2.js} +2 -2
- package/dist/martyrs/src/components/Chips/Chips.vue2.js.map +1 -0
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs → Dropdown.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.js → Dropdown.vue2.js} +2 -2
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs.map → Dropdown.vue2.js.map} +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs +2 -2
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.js +2 -2
- package/dist/martyrs/src/components/Feed/Feed.vue.js.map +1 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.cjs +1 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.cjs.map +1 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.js +1 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.js +1 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.js.map +1 -1
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.cjs +6 -0
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.js +6 -0
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs +2 -2
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +2 -2
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.cjs +7 -7
- package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.js +7 -7
- package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.cjs +16 -3
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.js +17 -4
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.cjs +66 -42
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.js +67 -43
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.cjs +22 -7
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.js +23 -8
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.cjs +47 -32
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.js +48 -33
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.cjs +46 -25
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.js +47 -26
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.cjs +42 -52
- package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.js +43 -53
- package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.cjs +17 -17
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/store/{ inventory.store.cjs → inventory.store.cjs} +46 -2
- package/dist/martyrs/src/modules/inventory/store/inventory.store.cjs.map +1 -0
- package/dist/martyrs/src/modules/inventory/store/{ inventory.store.js → inventory.store.js} +46 -2
- package/dist/martyrs/src/modules/inventory/store/inventory.store.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.js +1 -1
- package/dist/martyrs/src/modules/music/router/music.cjs +1 -1
- package/dist/martyrs/src/modules/music/router/music.js +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/orders.client.cjs +2 -2
- package/dist/martyrs/src/modules/orders/orders.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/orders.client.js +2 -2
- package/dist/martyrs/src/modules/orders/orders.client.js.map +1 -1
- package/dist/martyrs/src/modules/orders/router/customers.router.cjs +1 -1
- package/dist/martyrs/src/modules/orders/router/customers.router.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/router/customers.router.js +1 -1
- package/dist/martyrs/src/modules/orders/router/customers.router.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Gant/GanttToolbar.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Gant/GanttToolbar.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.cjs +2 -2
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.js +2 -2
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/music.server.cjs +9 -9
- package/dist/music.server.js +9 -9
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.cjs +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.cjs +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js +1 -1
- package/dist/orders.server.cjs +2 -2
- package/dist/orders.server.js +2 -2
- package/dist/organizations.server.cjs +4 -4
- package/dist/organizations.server.js +4 -4
- package/dist/products.server.cjs +5 -5
- package/dist/products.server.js +5 -5
- package/dist/rents.server.cjs +3 -3
- package/dist/rents.server.js +3 -3
- package/dist/style.css +7 -8
- package/dist/wallet.server.cjs +2 -2
- package/dist/wallet.server.js +2 -2
- package/dist/{web-B5wZTKbK.cjs → web-42I-Howt.cjs} +1 -1
- package/dist/{web-520xCgXy.js → web-ByhZ_fIu.js} +1 -1
- package/package.json +1 -1
- package/src/CLAUDE.MD +15 -0
- package/src/builder/modes/ssr.rspack.dev.js +20 -12
- package/src/builder/rspack/rspack.config.base.js +16 -15
- package/src/components/Button/Button.vue +1 -1
- package/src/components/Feed/Feed.vue +1 -1
- package/src/components/Loader/Loader.vue +1 -1
- package/src/modules/auth/FIXES.md +85 -0
- package/src/modules/auth/PROMT.md +33 -0
- package/src/modules/auth/auth.server.js +1 -0
- package/src/modules/auth/views/store/auth.js +1 -1
- package/src/modules/auth//320/220/320/240/320/245/320/230/320/242/320/225/320/232/320/242/320/243/320/240/320/220.md +445 -0
- package/src/modules/backoffice/components/partials/Sidebar.vue +6 -0
- package/src/modules/globals/controllers/classes/globals.cache.js +64 -55
- package/src/modules/globals/controllers/classes/globals.logger.js +40 -4
- package/src/modules/globals/controllers/classes/globals.observer.js +54 -4
- package/src/modules/globals/views/components/partials/Header.vue +1 -1
- package/src/modules/globals/views/components/partials/NavigationBar.vue +7 -7
- package/src/modules/globals/views/components/partials/Sidebar.vue +17 -13
- package/src/modules/inventory/CLAUDE.md +330 -0
- package/src/modules/inventory/PROMT.md +25 -0
- package/src/modules/inventory/components/forms/AdjustmentForm.vue +53 -36
- package/src/modules/inventory/components/forms/ColumnSettingsMenu.vue +11 -6
- package/src/modules/inventory/components/forms/HistoryView.vue +21 -9
- package/src/modules/inventory/components/forms/StockAlertsForm.vue +33 -22
- package/src/modules/inventory/components/pages/Inventory.vue +40 -40
- package/src/modules/inventory/components/pages/InventoryEdit.vue +1 -1
- package/src/modules/inventory/docs/01-intro.md +126 -0
- package/src/modules/inventory/docs/02-architecture.md +266 -0
- package/src/modules/inventory/docs/03-components-and-relationships.md +338 -0
- package/src/modules/inventory/docs/04-business-logic-and-algorithms.md +376 -0
- package/src/modules/inventory/docs/05-api-specification.md +356 -0
- package/src/modules/inventory/docs/06-access-control.md +320 -0
- package/src/modules/inventory/inventory.server.js +6 -2
- package/src/modules/inventory/{services → middlewares}/inventory.verifier.js +5 -16
- package/src/modules/inventory/models/stock.availability.model.js +20 -7
- package/src/modules/inventory/routes/inventory.routes.js +14 -17
- package/src/modules/inventory/services/adjustment.service.js +137 -0
- package/src/modules/inventory/services/audit.service.js +160 -0
- package/src/modules/inventory/services/availability.service.js +323 -0
- package/src/modules/inventory/services/inventory.helpers.old.js +217 -0
- package/src/modules/inventory/store/{ inventory.store.js → inventory.store.js} +0 -14
- package/src/modules/inventory/workers/inventory.availability.worker.js +29 -30
- package/src/modules/orders/orders.client.js +2 -2
- package/src/modules/orders/router/customers.router.js +1 -1
- package/src/modules/organizations/routes/organizations.routes.js +1 -1
- package/src/styles/responsive.scss +1 -31
- package/dist/martyrs/src/components/Chips/Chips.vue.cjs.map +0 -1
- package/dist/martyrs/src/components/Chips/Chips.vue.js.map +0 -1
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue.js.map +0 -1
- package/dist/martyrs/src/modules/inventory/store/ inventory.store.cjs.map +0 -1
- package/dist/martyrs/src/modules/inventory/store/ inventory.store.js.map +0 -1
- package/src/modules/inventory/docs/README.md +0 -291
- package/src/modules/inventory/models/stock.balance.model.js +0 -43
- package/src/modules/inventory/services/inventory.crud.js +0 -710
- package/src/modules/inventory/tests/inventory.test.js +0 -281
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as CacheNamespaced, L as LoggerNamespaced } from "./globals.logger-VRHh-WUW.js";
|
|
2
2
|
class ABACCore {
|
|
3
3
|
constructor(abac) {
|
|
4
4
|
this.abac = abac;
|
|
@@ -966,8 +966,8 @@ class GlobalABAC {
|
|
|
966
966
|
concurrencyLimit: 10,
|
|
967
967
|
...options
|
|
968
968
|
};
|
|
969
|
-
this.cache = new
|
|
970
|
-
this.logger = options.auditLogger || new
|
|
969
|
+
this.cache = new CacheNamespaced({ ttlSeconds: this.options.cacheTTL });
|
|
970
|
+
this.logger = options.auditLogger || new LoggerNamespaced(db);
|
|
971
971
|
this.core = new ABACCore(this);
|
|
972
972
|
this.policies = new ABACPolicies(this);
|
|
973
973
|
this.fields = new ABACFields(this);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const globals_logger = require("./globals.logger-
|
|
2
|
+
const globals_logger = require("./globals.logger-BuW7JHMY.cjs");
|
|
3
3
|
class ABACCore {
|
|
4
4
|
constructor(abac) {
|
|
5
5
|
this.abac = abac;
|
|
@@ -967,8 +967,8 @@ class GlobalABAC {
|
|
|
967
967
|
concurrencyLimit: 10,
|
|
968
968
|
...options
|
|
969
969
|
};
|
|
970
|
-
this.cache = new globals_logger.
|
|
971
|
-
this.logger = options.auditLogger || new globals_logger.
|
|
970
|
+
this.cache = new globals_logger.CacheNamespaced({ ttlSeconds: this.options.cacheTTL });
|
|
971
|
+
this.logger = options.auditLogger || new globals_logger.LoggerNamespaced(db);
|
|
972
972
|
this.core = new ABACCore(this);
|
|
973
973
|
this.policies = new ABACPolicies(this);
|
|
974
974
|
this.fields = new ABACFields(this);
|
package/dist/builder.cjs
CHANGED
|
@@ -595,19 +595,18 @@ function createSsrDevServer(projectRoot, { clientConfig: clientConfig2, apiConfi
|
|
|
595
595
|
}
|
|
596
596
|
const jsonStats = stats.toJson();
|
|
597
597
|
if (stats.hasErrors()) {
|
|
598
|
-
console.error(chalk.red("
|
|
599
|
-
jsonStats.errors.forEach((err) => {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
} else {
|
|
609
|
-
console.error(chalk.red(err.slice()));
|
|
598
|
+
console.error(chalk.red("❌ Ошибка компиляции"));
|
|
599
|
+
jsonStats.errors.forEach((err, index) => {
|
|
600
|
+
console.error(chalk.red(`
|
|
601
|
+
=== ОШИБКА ${index + 1} ===`));
|
|
602
|
+
if (err.message) {
|
|
603
|
+
let message = err.message.replace(/\u001b\[[0-9;]*m/g, "");
|
|
604
|
+
console.error(chalk.red(message));
|
|
605
|
+
}
|
|
606
|
+
if (err.moduleName) {
|
|
607
|
+
console.error(chalk.yellow(`📄 ФАЙЛ: ${err.moduleName}`));
|
|
610
608
|
}
|
|
609
|
+
console.error("");
|
|
611
610
|
});
|
|
612
611
|
return;
|
|
613
612
|
}
|
|
@@ -667,6 +666,8 @@ function createSsrDevServer(projectRoot, { clientConfig: clientConfig2, apiConfi
|
|
|
667
666
|
const clientDevMiddleware = devMiddleware(clientCompiler, {
|
|
668
667
|
publicPath: clientConfig2.output.publicPath,
|
|
669
668
|
serverSideRender: true,
|
|
669
|
+
stats: "minimal",
|
|
670
|
+
// или 'errors-only'
|
|
670
671
|
stats: {
|
|
671
672
|
children: true
|
|
672
673
|
}
|
|
@@ -1019,21 +1020,22 @@ const baseConfig$2 = (projectRoot) => {
|
|
|
1019
1020
|
level: "verbose"
|
|
1020
1021
|
},
|
|
1021
1022
|
stats: {
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1023
|
+
// Минимальный вывод
|
|
1024
|
+
preset: "minimal",
|
|
1025
|
+
// Или более детальная настройка:
|
|
1026
|
+
modules: false,
|
|
1027
|
+
chunks: false,
|
|
1028
|
+
chunkModules: false,
|
|
1029
|
+
chunkOrigins: false,
|
|
1030
|
+
entrypoints: false,
|
|
1031
|
+
assets: false,
|
|
1032
|
+
moduleTrace: false,
|
|
1033
|
+
errorDetails: false,
|
|
1034
|
+
// Показывать только ошибки и предупреждения
|
|
1032
1035
|
errors: true,
|
|
1033
|
-
errorDetails: true,
|
|
1034
|
-
errorStack: true,
|
|
1035
1036
|
warnings: true,
|
|
1036
|
-
|
|
1037
|
+
// Цвета в терминале
|
|
1038
|
+
colors: true
|
|
1037
1039
|
}
|
|
1038
1040
|
};
|
|
1039
1041
|
};
|
package/dist/builder.js
CHANGED
|
@@ -554,19 +554,18 @@ function createSsrDevServer(projectRoot, { clientConfig: clientConfig2, apiConfi
|
|
|
554
554
|
}
|
|
555
555
|
const jsonStats = stats.toJson();
|
|
556
556
|
if (stats.hasErrors()) {
|
|
557
|
-
console.error(chalk.red("
|
|
558
|
-
jsonStats.errors.forEach((err) => {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
}
|
|
567
|
-
} else {
|
|
568
|
-
console.error(chalk.red(err.slice()));
|
|
557
|
+
console.error(chalk.red("❌ Ошибка компиляции"));
|
|
558
|
+
jsonStats.errors.forEach((err, index) => {
|
|
559
|
+
console.error(chalk.red(`
|
|
560
|
+
=== ОШИБКА ${index + 1} ===`));
|
|
561
|
+
if (err.message) {
|
|
562
|
+
let message = err.message.replace(/\u001b\[[0-9;]*m/g, "");
|
|
563
|
+
console.error(chalk.red(message));
|
|
564
|
+
}
|
|
565
|
+
if (err.moduleName) {
|
|
566
|
+
console.error(chalk.yellow(`📄 ФАЙЛ: ${err.moduleName}`));
|
|
569
567
|
}
|
|
568
|
+
console.error("");
|
|
570
569
|
});
|
|
571
570
|
return;
|
|
572
571
|
}
|
|
@@ -626,6 +625,8 @@ function createSsrDevServer(projectRoot, { clientConfig: clientConfig2, apiConfi
|
|
|
626
625
|
const clientDevMiddleware = devMiddleware(clientCompiler, {
|
|
627
626
|
publicPath: clientConfig2.output.publicPath,
|
|
628
627
|
serverSideRender: true,
|
|
628
|
+
stats: "minimal",
|
|
629
|
+
// или 'errors-only'
|
|
629
630
|
stats: {
|
|
630
631
|
children: true
|
|
631
632
|
}
|
|
@@ -978,21 +979,22 @@ const baseConfig$2 = (projectRoot) => {
|
|
|
978
979
|
level: "verbose"
|
|
979
980
|
},
|
|
980
981
|
stats: {
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
982
|
+
// Минимальный вывод
|
|
983
|
+
preset: "minimal",
|
|
984
|
+
// Или более детальная настройка:
|
|
985
|
+
modules: false,
|
|
986
|
+
chunks: false,
|
|
987
|
+
chunkModules: false,
|
|
988
|
+
chunkOrigins: false,
|
|
989
|
+
entrypoints: false,
|
|
990
|
+
assets: false,
|
|
991
|
+
moduleTrace: false,
|
|
992
|
+
errorDetails: false,
|
|
993
|
+
// Показывать только ошибки и предупреждения
|
|
991
994
|
errors: true,
|
|
992
|
-
errorDetails: true,
|
|
993
|
-
errorStack: true,
|
|
994
995
|
warnings: true,
|
|
995
|
-
|
|
996
|
+
// Цвета в терминале
|
|
997
|
+
colors: true
|
|
996
998
|
}
|
|
997
999
|
};
|
|
998
1000
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as middlewareFactory } from "./authJwt-J1csaMWA.js";
|
|
2
2
|
import { q as queryProcessorGlobals } from "./queryProcessor-CVcLPEnv.js";
|
|
3
|
-
import { O as
|
|
4
|
-
import { L as
|
|
3
|
+
import { O as ObserverNamespaced } from "./globals.observer-MZsqaE6F.js";
|
|
4
|
+
import { L as LoggerNamespaced, C as CacheNamespaced } from "./globals.logger-VRHh-WUW.js";
|
|
5
5
|
class CRUDCore {
|
|
6
6
|
constructor(crud) {
|
|
7
7
|
this.crud = crud;
|
|
@@ -833,8 +833,8 @@ class CRUDEvents {
|
|
|
833
833
|
this.enabled = options.enabled !== false;
|
|
834
834
|
this.options = options;
|
|
835
835
|
if (this.enabled) {
|
|
836
|
-
this.observer = options.observer || new
|
|
837
|
-
this.logger = options.logger || new
|
|
836
|
+
this.observer = options.observer || new ObserverNamespaced();
|
|
837
|
+
this.logger = options.logger || new LoggerNamespaced(this.crud.db);
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
840
|
// Отправка события
|
|
@@ -1004,8 +1004,8 @@ class CRUD {
|
|
|
1004
1004
|
this.model = model;
|
|
1005
1005
|
this.basePath = basePath;
|
|
1006
1006
|
this.modelName = modelName;
|
|
1007
|
-
this.cache = cache !== false ? cache instanceof
|
|
1008
|
-
this.logger = logger || new
|
|
1007
|
+
this.cache = cache !== false ? cache instanceof CacheNamespaced ? cache : new CacheNamespaced() : null;
|
|
1008
|
+
this.logger = logger || new LoggerNamespaced(db);
|
|
1009
1009
|
this.initModules(otherOptions);
|
|
1010
1010
|
this.core.init(otherOptions);
|
|
1011
1011
|
if (!otherOptions.disableDefaultRoutes) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const authJwt = require("./authJwt-BIZ2GIfT.cjs");
|
|
3
3
|
const queryProcessor = require("./queryProcessor-B_X680wC.cjs");
|
|
4
|
-
const globals_observer = require("./globals.observer-
|
|
5
|
-
const globals_logger = require("./globals.logger-
|
|
4
|
+
const globals_observer = require("./globals.observer-C_FYclgV.cjs");
|
|
5
|
+
const globals_logger = require("./globals.logger-BuW7JHMY.cjs");
|
|
6
6
|
class CRUDCore {
|
|
7
7
|
constructor(crud) {
|
|
8
8
|
this.crud = crud;
|
|
@@ -834,8 +834,8 @@ class CRUDEvents {
|
|
|
834
834
|
this.enabled = options.enabled !== false;
|
|
835
835
|
this.options = options;
|
|
836
836
|
if (this.enabled) {
|
|
837
|
-
this.observer = options.observer || new globals_observer.
|
|
838
|
-
this.logger = options.logger || new globals_logger.
|
|
837
|
+
this.observer = options.observer || new globals_observer.ObserverNamespaced();
|
|
838
|
+
this.logger = options.logger || new globals_logger.LoggerNamespaced(this.crud.db);
|
|
839
839
|
}
|
|
840
840
|
}
|
|
841
841
|
// Отправка события
|
|
@@ -1005,8 +1005,8 @@ class CRUD {
|
|
|
1005
1005
|
this.model = model;
|
|
1006
1006
|
this.basePath = basePath;
|
|
1007
1007
|
this.modelName = modelName;
|
|
1008
|
-
this.cache = cache !== false ? cache instanceof globals_logger.
|
|
1009
|
-
this.logger = logger || new globals_logger.
|
|
1008
|
+
this.cache = cache !== false ? cache instanceof globals_logger.CacheNamespaced ? cache : new globals_logger.CacheNamespaced() : null;
|
|
1009
|
+
this.logger = logger || new globals_logger.LoggerNamespaced(db);
|
|
1010
1010
|
this.initModules(otherOptions);
|
|
1011
1011
|
this.core.init(otherOptions);
|
|
1012
1012
|
if (!otherOptions.disableDefaultRoutes) {
|
|
@@ -6,30 +6,12 @@ class Cache {
|
|
|
6
6
|
this.cache = new NodeCache({ stdTTL: ttlSeconds });
|
|
7
7
|
this.tagStore = /* @__PURE__ */ new Map();
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
* Получение значения по ключу
|
|
11
|
-
* @param {string} key - Ключ
|
|
12
|
-
* @returns {Promise<any>} Значение из кэша
|
|
13
|
-
*/
|
|
14
9
|
async get(key) {
|
|
15
10
|
return this.cache.get(key);
|
|
16
11
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Установка значения по ключу
|
|
19
|
-
* @param {string} key - Ключ
|
|
20
|
-
* @param {any} value - Значение
|
|
21
|
-
* @returns {Promise<boolean>} Успешность операции
|
|
22
|
-
*/
|
|
23
12
|
async set(key, value) {
|
|
24
13
|
return this.cache.set(key, value);
|
|
25
14
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Установка значения с тегами
|
|
28
|
-
* @param {string} key - Ключ
|
|
29
|
-
* @param {any} value - Значение
|
|
30
|
-
* @param {string[]} tags - Массив тегов
|
|
31
|
-
* @returns {Promise<boolean>} Успешность операции
|
|
32
|
-
*/
|
|
33
15
|
async setWithTags(key, value, tags = []) {
|
|
34
16
|
const success = this.cache.set(key, value);
|
|
35
17
|
if (success && tags.length > 0) {
|
|
@@ -42,11 +24,6 @@ class Cache {
|
|
|
42
24
|
}
|
|
43
25
|
return success;
|
|
44
26
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Удаление по ключу или ключам
|
|
47
|
-
* @param {string|string[]} keys - Ключ или массив ключей
|
|
48
|
-
* @returns {Promise<number>} Количество удаленных элементов
|
|
49
|
-
*/
|
|
50
27
|
async del(keys) {
|
|
51
28
|
const keyArray = Array.isArray(keys) ? keys : [keys];
|
|
52
29
|
const deletedCount = this.cache.del(keyArray);
|
|
@@ -62,11 +39,6 @@ class Cache {
|
|
|
62
39
|
}
|
|
63
40
|
return deletedCount;
|
|
64
41
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Удаление всех ключей, связанных с тегом
|
|
67
|
-
* @param {string} tag - Тег
|
|
68
|
-
* @returns {Promise<number>} Количество удаленных элементов
|
|
69
|
-
*/
|
|
70
42
|
async delByTag(tag) {
|
|
71
43
|
if (!this.tagStore.has(tag)) return 0;
|
|
72
44
|
const keys = Array.from(this.tagStore.get(tag));
|
|
@@ -74,11 +46,6 @@ class Cache {
|
|
|
74
46
|
this.tagStore.delete(tag);
|
|
75
47
|
return deletedCount;
|
|
76
48
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Удаление всех ключей, связанных с массивом тегов
|
|
79
|
-
* @param {string[]} tags - Массив тегов
|
|
80
|
-
* @returns {Promise<number>} Количество удаленных элементов
|
|
81
|
-
*/
|
|
82
49
|
async delByTags(tags) {
|
|
83
50
|
let totalDeleted = 0;
|
|
84
51
|
for (const tag of tags) {
|
|
@@ -86,26 +53,13 @@ class Cache {
|
|
|
86
53
|
}
|
|
87
54
|
return totalDeleted;
|
|
88
55
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Полная очистка кэша
|
|
91
|
-
* @returns {Promise<void>}
|
|
92
|
-
*/
|
|
93
56
|
async flush() {
|
|
94
57
|
this.cache.flushAll();
|
|
95
58
|
this.tagStore.clear();
|
|
96
59
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Получение всех ключей в кэше
|
|
99
|
-
* @returns {Promise<string[]>} Массив ключей
|
|
100
|
-
*/
|
|
101
60
|
async keys() {
|
|
102
61
|
return this.cache.keys();
|
|
103
62
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Получение тегов для ключа
|
|
106
|
-
* @param {string} key - Ключ
|
|
107
|
-
* @returns {Promise<string[]>} Массив тегов
|
|
108
|
-
*/
|
|
109
63
|
async getTagsForKey(key) {
|
|
110
64
|
const tags = [];
|
|
111
65
|
for (const [tag, keySet] of this.tagStore.entries()) {
|
|
@@ -115,10 +69,6 @@ class Cache {
|
|
|
115
69
|
}
|
|
116
70
|
return tags;
|
|
117
71
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Получение статистики кэша
|
|
120
|
-
* @returns {Promise<object>} Статистика
|
|
121
|
-
*/
|
|
122
72
|
async stats() {
|
|
123
73
|
return {
|
|
124
74
|
keys: this.cache.keys().length,
|
|
@@ -127,6 +77,42 @@ class Cache {
|
|
|
127
77
|
};
|
|
128
78
|
}
|
|
129
79
|
}
|
|
80
|
+
const instances$1 = /* @__PURE__ */ new Map();
|
|
81
|
+
class CacheNamespaced {
|
|
82
|
+
constructor(namespaceOrOptions, options) {
|
|
83
|
+
let namespace = "global";
|
|
84
|
+
let cacheOptions = {};
|
|
85
|
+
if (typeof namespaceOrOptions === "string") {
|
|
86
|
+
namespace = namespaceOrOptions;
|
|
87
|
+
cacheOptions = options || {};
|
|
88
|
+
} else if (typeof namespaceOrOptions === "object") {
|
|
89
|
+
cacheOptions = namespaceOrOptions || {};
|
|
90
|
+
}
|
|
91
|
+
if (instances$1.has(namespace)) {
|
|
92
|
+
return instances$1.get(namespace);
|
|
93
|
+
}
|
|
94
|
+
const instance = new Cache(cacheOptions);
|
|
95
|
+
instances$1.set(namespace, instance);
|
|
96
|
+
return instance;
|
|
97
|
+
}
|
|
98
|
+
// Статический метод для получения всех namespace'ов
|
|
99
|
+
static getNamespaces() {
|
|
100
|
+
return Array.from(instances$1.keys());
|
|
101
|
+
}
|
|
102
|
+
// Статический метод для очистки конкретного namespace
|
|
103
|
+
static async flushNamespace(namespace) {
|
|
104
|
+
if (instances$1.has(namespace)) {
|
|
105
|
+
await instances$1.get(namespace).flush();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Статический метод для удаления namespace (полностью)
|
|
109
|
+
static removeNamespace(namespace) {
|
|
110
|
+
if (instances$1.has(namespace)) {
|
|
111
|
+
instances$1.get(namespace).flush();
|
|
112
|
+
instances$1.delete(namespace);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
130
116
|
class Logger {
|
|
131
117
|
constructor(db) {
|
|
132
118
|
this.LogModel = db.log;
|
|
@@ -143,7 +129,6 @@ class Logger {
|
|
|
143
129
|
console.error("Logging error:", err);
|
|
144
130
|
}
|
|
145
131
|
}
|
|
146
|
-
// Удобные методы для различных уровней логирования
|
|
147
132
|
async info(message) {
|
|
148
133
|
await this.log("info", message);
|
|
149
134
|
}
|
|
@@ -151,5 +136,30 @@ class Logger {
|
|
|
151
136
|
await this.log("error", message);
|
|
152
137
|
}
|
|
153
138
|
}
|
|
154
|
-
|
|
155
|
-
|
|
139
|
+
const instances = /* @__PURE__ */ new Map();
|
|
140
|
+
class LoggerNamespaced {
|
|
141
|
+
constructor(namespaceOrDb, db) {
|
|
142
|
+
if (!db && namespaceOrDb && typeof namespaceOrDb === "object") {
|
|
143
|
+
const namespace2 = "global";
|
|
144
|
+
if (instances.has(namespace2)) {
|
|
145
|
+
return instances.get(namespace2);
|
|
146
|
+
}
|
|
147
|
+
const instance2 = new Logger(namespaceOrDb);
|
|
148
|
+
instances.set(namespace2, instance2);
|
|
149
|
+
return instance2;
|
|
150
|
+
}
|
|
151
|
+
const namespace = namespaceOrDb;
|
|
152
|
+
if (instances.has(namespace)) {
|
|
153
|
+
return instances.get(namespace);
|
|
154
|
+
}
|
|
155
|
+
const instance = new Logger(db);
|
|
156
|
+
instances.set(namespace, instance);
|
|
157
|
+
return instance;
|
|
158
|
+
}
|
|
159
|
+
// Статический метод для получения всех namespace'ов
|
|
160
|
+
static getNamespaces() {
|
|
161
|
+
return Array.from(instances.keys());
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.CacheNamespaced = CacheNamespaced;
|
|
165
|
+
exports.LoggerNamespaced = LoggerNamespaced;
|
|
@@ -5,30 +5,12 @@ class Cache {
|
|
|
5
5
|
this.cache = new NodeCache({ stdTTL: ttlSeconds });
|
|
6
6
|
this.tagStore = /* @__PURE__ */ new Map();
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
9
|
-
* Получение значения по ключу
|
|
10
|
-
* @param {string} key - Ключ
|
|
11
|
-
* @returns {Promise<any>} Значение из кэша
|
|
12
|
-
*/
|
|
13
8
|
async get(key) {
|
|
14
9
|
return this.cache.get(key);
|
|
15
10
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Установка значения по ключу
|
|
18
|
-
* @param {string} key - Ключ
|
|
19
|
-
* @param {any} value - Значение
|
|
20
|
-
* @returns {Promise<boolean>} Успешность операции
|
|
21
|
-
*/
|
|
22
11
|
async set(key, value) {
|
|
23
12
|
return this.cache.set(key, value);
|
|
24
13
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Установка значения с тегами
|
|
27
|
-
* @param {string} key - Ключ
|
|
28
|
-
* @param {any} value - Значение
|
|
29
|
-
* @param {string[]} tags - Массив тегов
|
|
30
|
-
* @returns {Promise<boolean>} Успешность операции
|
|
31
|
-
*/
|
|
32
14
|
async setWithTags(key, value, tags = []) {
|
|
33
15
|
const success = this.cache.set(key, value);
|
|
34
16
|
if (success && tags.length > 0) {
|
|
@@ -41,11 +23,6 @@ class Cache {
|
|
|
41
23
|
}
|
|
42
24
|
return success;
|
|
43
25
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Удаление по ключу или ключам
|
|
46
|
-
* @param {string|string[]} keys - Ключ или массив ключей
|
|
47
|
-
* @returns {Promise<number>} Количество удаленных элементов
|
|
48
|
-
*/
|
|
49
26
|
async del(keys) {
|
|
50
27
|
const keyArray = Array.isArray(keys) ? keys : [keys];
|
|
51
28
|
const deletedCount = this.cache.del(keyArray);
|
|
@@ -61,11 +38,6 @@ class Cache {
|
|
|
61
38
|
}
|
|
62
39
|
return deletedCount;
|
|
63
40
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Удаление всех ключей, связанных с тегом
|
|
66
|
-
* @param {string} tag - Тег
|
|
67
|
-
* @returns {Promise<number>} Количество удаленных элементов
|
|
68
|
-
*/
|
|
69
41
|
async delByTag(tag) {
|
|
70
42
|
if (!this.tagStore.has(tag)) return 0;
|
|
71
43
|
const keys = Array.from(this.tagStore.get(tag));
|
|
@@ -73,11 +45,6 @@ class Cache {
|
|
|
73
45
|
this.tagStore.delete(tag);
|
|
74
46
|
return deletedCount;
|
|
75
47
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Удаление всех ключей, связанных с массивом тегов
|
|
78
|
-
* @param {string[]} tags - Массив тегов
|
|
79
|
-
* @returns {Promise<number>} Количество удаленных элементов
|
|
80
|
-
*/
|
|
81
48
|
async delByTags(tags) {
|
|
82
49
|
let totalDeleted = 0;
|
|
83
50
|
for (const tag of tags) {
|
|
@@ -85,26 +52,13 @@ class Cache {
|
|
|
85
52
|
}
|
|
86
53
|
return totalDeleted;
|
|
87
54
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Полная очистка кэша
|
|
90
|
-
* @returns {Promise<void>}
|
|
91
|
-
*/
|
|
92
55
|
async flush() {
|
|
93
56
|
this.cache.flushAll();
|
|
94
57
|
this.tagStore.clear();
|
|
95
58
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Получение всех ключей в кэше
|
|
98
|
-
* @returns {Promise<string[]>} Массив ключей
|
|
99
|
-
*/
|
|
100
59
|
async keys() {
|
|
101
60
|
return this.cache.keys();
|
|
102
61
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Получение тегов для ключа
|
|
105
|
-
* @param {string} key - Ключ
|
|
106
|
-
* @returns {Promise<string[]>} Массив тегов
|
|
107
|
-
*/
|
|
108
62
|
async getTagsForKey(key) {
|
|
109
63
|
const tags = [];
|
|
110
64
|
for (const [tag, keySet] of this.tagStore.entries()) {
|
|
@@ -114,10 +68,6 @@ class Cache {
|
|
|
114
68
|
}
|
|
115
69
|
return tags;
|
|
116
70
|
}
|
|
117
|
-
/**
|
|
118
|
-
* Получение статистики кэша
|
|
119
|
-
* @returns {Promise<object>} Статистика
|
|
120
|
-
*/
|
|
121
71
|
async stats() {
|
|
122
72
|
return {
|
|
123
73
|
keys: this.cache.keys().length,
|
|
@@ -126,6 +76,42 @@ class Cache {
|
|
|
126
76
|
};
|
|
127
77
|
}
|
|
128
78
|
}
|
|
79
|
+
const instances$1 = /* @__PURE__ */ new Map();
|
|
80
|
+
class CacheNamespaced {
|
|
81
|
+
constructor(namespaceOrOptions, options) {
|
|
82
|
+
let namespace = "global";
|
|
83
|
+
let cacheOptions = {};
|
|
84
|
+
if (typeof namespaceOrOptions === "string") {
|
|
85
|
+
namespace = namespaceOrOptions;
|
|
86
|
+
cacheOptions = options || {};
|
|
87
|
+
} else if (typeof namespaceOrOptions === "object") {
|
|
88
|
+
cacheOptions = namespaceOrOptions || {};
|
|
89
|
+
}
|
|
90
|
+
if (instances$1.has(namespace)) {
|
|
91
|
+
return instances$1.get(namespace);
|
|
92
|
+
}
|
|
93
|
+
const instance = new Cache(cacheOptions);
|
|
94
|
+
instances$1.set(namespace, instance);
|
|
95
|
+
return instance;
|
|
96
|
+
}
|
|
97
|
+
// Статический метод для получения всех namespace'ов
|
|
98
|
+
static getNamespaces() {
|
|
99
|
+
return Array.from(instances$1.keys());
|
|
100
|
+
}
|
|
101
|
+
// Статический метод для очистки конкретного namespace
|
|
102
|
+
static async flushNamespace(namespace) {
|
|
103
|
+
if (instances$1.has(namespace)) {
|
|
104
|
+
await instances$1.get(namespace).flush();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Статический метод для удаления namespace (полностью)
|
|
108
|
+
static removeNamespace(namespace) {
|
|
109
|
+
if (instances$1.has(namespace)) {
|
|
110
|
+
instances$1.get(namespace).flush();
|
|
111
|
+
instances$1.delete(namespace);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
129
115
|
class Logger {
|
|
130
116
|
constructor(db) {
|
|
131
117
|
this.LogModel = db.log;
|
|
@@ -142,7 +128,6 @@ class Logger {
|
|
|
142
128
|
console.error("Logging error:", err);
|
|
143
129
|
}
|
|
144
130
|
}
|
|
145
|
-
// Удобные методы для различных уровней логирования
|
|
146
131
|
async info(message) {
|
|
147
132
|
await this.log("info", message);
|
|
148
133
|
}
|
|
@@ -150,7 +135,32 @@ class Logger {
|
|
|
150
135
|
await this.log("error", message);
|
|
151
136
|
}
|
|
152
137
|
}
|
|
138
|
+
const instances = /* @__PURE__ */ new Map();
|
|
139
|
+
class LoggerNamespaced {
|
|
140
|
+
constructor(namespaceOrDb, db) {
|
|
141
|
+
if (!db && namespaceOrDb && typeof namespaceOrDb === "object") {
|
|
142
|
+
const namespace2 = "global";
|
|
143
|
+
if (instances.has(namespace2)) {
|
|
144
|
+
return instances.get(namespace2);
|
|
145
|
+
}
|
|
146
|
+
const instance2 = new Logger(namespaceOrDb);
|
|
147
|
+
instances.set(namespace2, instance2);
|
|
148
|
+
return instance2;
|
|
149
|
+
}
|
|
150
|
+
const namespace = namespaceOrDb;
|
|
151
|
+
if (instances.has(namespace)) {
|
|
152
|
+
return instances.get(namespace);
|
|
153
|
+
}
|
|
154
|
+
const instance = new Logger(db);
|
|
155
|
+
instances.set(namespace, instance);
|
|
156
|
+
return instance;
|
|
157
|
+
}
|
|
158
|
+
// Статический метод для получения всех namespace'ов
|
|
159
|
+
static getNamespaces() {
|
|
160
|
+
return Array.from(instances.keys());
|
|
161
|
+
}
|
|
162
|
+
}
|
|
153
163
|
export {
|
|
154
|
-
|
|
155
|
-
|
|
164
|
+
CacheNamespaced as C,
|
|
165
|
+
LoggerNamespaced as L
|
|
156
166
|
};
|
|
@@ -39,5 +39,40 @@ class Observer {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
removeAll(eventType) {
|
|
43
|
+
if (eventType) {
|
|
44
|
+
delete this.listeners[eventType];
|
|
45
|
+
} else {
|
|
46
|
+
this.listeners = {};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const instances = /* @__PURE__ */ new Map();
|
|
51
|
+
class ObserverNamespaced {
|
|
52
|
+
constructor(namespace = "global") {
|
|
53
|
+
if (instances.has(namespace)) {
|
|
54
|
+
return instances.get(namespace);
|
|
55
|
+
}
|
|
56
|
+
const instance = new Observer();
|
|
57
|
+
instances.set(namespace, instance);
|
|
58
|
+
return instance;
|
|
59
|
+
}
|
|
60
|
+
// Статический метод для получения всех namespace'ов
|
|
61
|
+
static getNamespaces() {
|
|
62
|
+
return Array.from(instances.keys());
|
|
63
|
+
}
|
|
64
|
+
// Статический метод для очистки подписок в namespace
|
|
65
|
+
static clearNamespace(namespace) {
|
|
66
|
+
if (instances.has(namespace)) {
|
|
67
|
+
instances.get(namespace).removeAll();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Статический метод для удаления namespace (полностью)
|
|
71
|
+
static removeNamespace(namespace) {
|
|
72
|
+
if (instances.has(namespace)) {
|
|
73
|
+
instances.get(namespace).removeAll();
|
|
74
|
+
instances.delete(namespace);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
42
77
|
}
|
|
43
|
-
exports.
|
|
78
|
+
exports.ObserverNamespaced = ObserverNamespaced;
|