cloud-ide-model-schema 1.1.39 → 1.1.41
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/lib/config/README.md
CHANGED
|
@@ -11,8 +11,11 @@ This directory contains the compiled JavaScript files and TypeScript declaration
|
|
|
11
11
|
|
|
12
12
|
### database.js / database.d.ts
|
|
13
13
|
|
|
14
|
-
Provides MongoDB database connection functionality:
|
|
14
|
+
Provides MongoDB database connection functionality and utility functions:
|
|
15
15
|
- `connectDB()`: Asynchronous function to establish a connection to MongoDB
|
|
16
|
+
- `customUUID()`: Function that generates custom UUID strings for document IDs
|
|
17
|
+
- Uses environment variable `UUID_PREFIX` combined with MongoDB ObjectId
|
|
18
|
+
- Used by schemas like core_system_logs to create custom document IDs
|
|
16
19
|
- Uses environment variables for connection parameters
|
|
17
20
|
- Implements connection timeout and error handling
|
|
18
21
|
|
package/lib/config/database.js
CHANGED
|
@@ -67,7 +67,7 @@ function connectDB() {
|
|
|
67
67
|
// Event listner for success and error // pending
|
|
68
68
|
var customUUID = function () {
|
|
69
69
|
var _a, _b, _c;
|
|
70
|
-
var key = (_c = "".concat((_b = (_a = (new mongoose.Types.ObjectId())) === null || _a === void 0 ? void 0 : _a.toHexString()) === null || _b === void 0 ? void 0 : _b.slice(
|
|
70
|
+
var key = (_c = "".concat(process.env.UUID_PREFIX).concat((_b = (_a = (new mongoose.Types.ObjectId())) === null || _a === void 0 ? void 0 : _a.toHexString()) === null || _b === void 0 ? void 0 : _b.slice(3, 24))) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
|
71
71
|
console.log('Generated custom UUID:', key);
|
|
72
72
|
return key;
|
|
73
73
|
};
|
package/lib/schema/README.md
CHANGED
|
@@ -21,6 +21,7 @@ Contains compiled schemas for user authentication, profiles, and sessions:
|
|
|
21
21
|
### Core System Schemas (`/core`)
|
|
22
22
|
|
|
23
23
|
Contains compiled schemas for core system functionality:
|
|
24
|
+
- System logging with custom ID generation
|
|
24
25
|
- System pages and themes
|
|
25
26
|
- Menu management
|
|
26
27
|
- Entity management
|
|
@@ -38,3 +39,13 @@ Contains compiled schemas for email management:
|
|
|
38
39
|
## Usage
|
|
39
40
|
|
|
40
41
|
These compiled schema files are the actual Mongoose models used in MongoDB operations. They implement the interfaces defined in the model directory.
|
|
42
|
+
|
|
43
|
+
## Advanced Features
|
|
44
|
+
|
|
45
|
+
### Custom ID Generation
|
|
46
|
+
|
|
47
|
+
Some schemas like `core_system_logs` implement custom ID generation using the `customUUID()` utility from the configuration module. This provides:
|
|
48
|
+
|
|
49
|
+
- Application-specific ID prefixes via the `UUID_PREFIX` environment variable
|
|
50
|
+
- Combination with MongoDB ObjectId for uniqueness
|
|
51
|
+
- Consistent ID format across the application
|
|
@@ -2,13 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CCoreSylog = void 0;
|
|
4
4
|
var mongoose_1 = require("mongoose");
|
|
5
|
-
var database_1 = require("../../config/database");
|
|
6
5
|
/* SCHEMA START */
|
|
7
6
|
var core_system_logs = new mongoose_1.Schema({
|
|
8
|
-
_id: {
|
|
9
|
-
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
10
|
-
default: function () { return (0, database_1.customUUID)(); }
|
|
11
|
-
},
|
|
12
7
|
sylog_id_user: {
|
|
13
8
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
14
9
|
required: false
|
package/package.json
CHANGED