@flowerforce/flowerbase 1.1.2-beta.4 → 1.1.2-beta.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/mongodb-atlas/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAyC,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAspBrF,QAAA,MAAM,YAAY,EAAE,oBAmBlB,CAAA;AAEF,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/mongodb-atlas/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAyC,oBAAoB,EAAE,MAAM,SAAS,CAAA;AA+pBrF,QAAA,MAAM,YAAY,EAAE,oBAmBlB,CAAA;AAEF,eAAe,YAAY,CAAA"}
@@ -292,6 +292,7 @@ const getOperators = (collection, { rules = {}, collName, user, run_as_system })
292
292
  const { filters, roles } = rules[collName] || {};
293
293
  // Apply access filters to initial change stream pipeline
294
294
  const formattedQuery = (0, utils_2.getFormattedQuery)(filters, {}, user);
295
+ console.log("🚀 ~ getOperators ~ formattedQuery:", formattedQuery);
295
296
  const firstStep = formattedQuery.length ? {
296
297
  $match: {
297
298
  $and: formattedQuery
@@ -301,8 +302,11 @@ const getOperators = (collection, { rules = {}, collName, user, run_as_system })
301
302
  firstStep,
302
303
  ...pipeline
303
304
  ].filter(Boolean);
305
+ console.log("🚀 ~ getOperators ~ formattedPipeline:", formattedPipeline);
304
306
  const result = collection.watch(formattedPipeline, options);
307
+ console.log("🚀 ~ getOperators ~ result:", result);
305
308
  const originalOn = result.on.bind(result);
309
+ console.log("🚀 ~ getOperators ~ originalOn:", originalOn);
306
310
  /**
307
311
  * Validates a change event against the user's roles.
308
312
  *
@@ -331,14 +335,18 @@ const getOperators = (collection, { rules = {}, collName, user, run_as_system })
331
335
  });
332
336
  // Override the .on() method to apply validation before emitting events
333
337
  result.on = (eventType, listener) => {
338
+ console.log("🚀 ~ getOperators ~ eventType:", eventType);
334
339
  return originalOn(eventType, (change) => __awaiter(void 0, void 0, void 0, function* () {
340
+ console.log("🚀 ~ getOperators ~ change:", change);
335
341
  const { status, document, updatedFieldsStatus, updatedFields } = yield isValidChange(change);
336
342
  if (!status)
337
343
  return;
338
344
  const filteredChange = Object.assign(Object.assign({}, change), { fullDocument: document, updateDescription: Object.assign(Object.assign({}, change.updateDescription), { updatedFields: updatedFieldsStatus ? updatedFields : {} }) });
345
+ console.log("🚀 ~ getOperators ~ filteredChange:", filteredChange);
339
346
  listener(filteredChange);
340
347
  }));
341
348
  };
349
+ console.log("result", result, options);
342
350
  return result;
343
351
  }
344
352
  // System mode: no filtering applied
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowerforce/flowerbase",
3
- "version": "1.1.2-beta.4",
3
+ "version": "1.1.2-beta.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -342,6 +342,7 @@ const getOperators: GetOperatorsFunction = (
342
342
 
343
343
  // Apply access filters to initial change stream pipeline
344
344
  const formattedQuery = getFormattedQuery(filters, {}, user)
345
+ console.log("🚀 ~ getOperators ~ formattedQuery:", formattedQuery)
345
346
 
346
347
  const firstStep = formattedQuery.length ? {
347
348
  $match: {
@@ -353,9 +354,12 @@ const getOperators: GetOperatorsFunction = (
353
354
  firstStep,
354
355
  ...pipeline
355
356
  ].filter(Boolean) as Document[]
357
+ console.log("🚀 ~ getOperators ~ formattedPipeline:", formattedPipeline)
356
358
 
357
359
  const result = collection.watch(formattedPipeline, options)
360
+ console.log("🚀 ~ getOperators ~ result:", result)
358
361
  const originalOn = result.on.bind(result)
362
+ console.log("🚀 ~ getOperators ~ originalOn:", originalOn)
359
363
 
360
364
  /**
361
365
  * Validates a change event against the user's roles.
@@ -400,7 +404,9 @@ const getOperators: GetOperatorsFunction = (
400
404
  eventType: EventKey,
401
405
  listener: EventsDescription[EventKey]
402
406
  ) => {
407
+ console.log("🚀 ~ getOperators ~ eventType:", eventType)
403
408
  return originalOn(eventType, async (change: Document) => {
409
+ console.log("🚀 ~ getOperators ~ change:", change)
404
410
  const { status, document, updatedFieldsStatus, updatedFields } =
405
411
  await isValidChange(change)
406
412
  if (!status) return
@@ -413,11 +419,14 @@ const getOperators: GetOperatorsFunction = (
413
419
  updatedFields: updatedFieldsStatus ? updatedFields : {}
414
420
  }
415
421
  }
422
+ console.log("🚀 ~ getOperators ~ filteredChange:", filteredChange)
416
423
 
417
424
  listener(filteredChange)
418
425
  })
419
426
  }
420
427
 
428
+ console.log("result", result, options)
429
+
421
430
  return result
422
431
  }
423
432