devcode-canavar-pro 3.4.1 → 3.5.1

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.
Files changed (2) hide show
  1. package/lib/Server.js +31 -10
  2. package/package.json +1 -1
package/lib/Server.js CHANGED
@@ -122,16 +122,7 @@ class Server {
122
122
  const [, dbName, collectionName, action] = parts;
123
123
 
124
124
  try {
125
- const db = this.devcode.use(dbName, namespace);
126
- const col = db.collection(collectionName);
127
-
128
- // İstek gövdesini oku
129
- let body = {};
130
- if (req.method === 'POST') {
131
- body = await this._readBody(req);
132
- }
133
-
134
- let result;
125
+ this._log(namespace, dbName, collectionName, action);
135
126
 
136
127
  switch (action) {
137
128
  case 'insert':
@@ -180,6 +171,36 @@ class Server {
180
171
  }
181
172
  }
182
173
 
174
+ /**
175
+ * Audit log kaydı tutar (Circular buffer).
176
+ */
177
+ _log(ns, db, col, action) {
178
+ if (!this.auditLogs) this.auditLogs = [];
179
+ this.auditLogs.unshift({
180
+ time: new Date().toLocaleTimeString(),
181
+ ns: ns.substring(0, 8),
182
+ db,
183
+ col,
184
+ action: action.toUpperCase()
185
+ });
186
+ if (this.auditLogs.length > 100) this.auditLogs.pop();
187
+ }
188
+
189
+ /**
190
+ * Audit log kaydı tutar (Global Bridge).
191
+ */
192
+ _log(ns, db, col, action) {
193
+ if (!global.devcodeAuditLogs) global.devcodeAuditLogs = [];
194
+ global.devcodeAuditLogs.unshift({
195
+ time: new Date().toLocaleTimeString(),
196
+ ns: ns.substring(0, 8),
197
+ db,
198
+ col,
199
+ action: action.toUpperCase()
200
+ });
201
+ if (global.devcodeAuditLogs.length > 50) global.devcodeAuditLogs.pop();
202
+ }
203
+
183
204
  _readBody(req) {
184
205
  return new Promise((resolve, reject) => {
185
206
  let body = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devcode-canavar-pro",
3
- "version": "3.4.1",
3
+ "version": "3.5.1",
4
4
  "description": "Monster Edition: Ultra-fast, zero-config, embedded document database with Visual Dashboard and Interactive CLI.",
5
5
  "main": "index.js",
6
6
  "bin": {