@m1212e/rumble 0.18.6 → 0.18.7

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/out/index.mjs CHANGED
@@ -180,7 +180,7 @@ function mapNullFieldsToUndefined(obj) {
180
180
  }
181
181
  //#endregion
182
182
  //#region package.json
183
- var version = "0.18.6";
183
+ var version = "0.18.7";
184
184
  //#endregion
185
185
  //#region lib/helpers/mergeFilters.ts
186
186
  function mergeFilters(filterA, filterB, mode = "AND") {
@@ -352,11 +352,13 @@ const createAbilityBuilder = ({ db, actions, defaultLimit, otel }) => {
352
352
  allow: (action) => {
353
353
  if (hasBeenBuilt) throw new RumbleError("You can't call allow() after the ability builder has been built. Please ensure that you register all abilities before accessing them.");
354
354
  const actions = Array.isArray(action) ? action : [action];
355
+ const setUnrestrictedByThisCall = /* @__PURE__ */ new Set();
355
356
  for (const action of actions) {
356
357
  let filters = queryFilters.get(action);
357
358
  if (!filters) {
358
359
  filters = "unrestricted";
359
360
  queryFilters.set(action, filters);
361
+ setUnrestrictedByThisCall.add(action);
360
362
  }
361
363
  }
362
364
  return {
@@ -373,7 +375,8 @@ const createAbilityBuilder = ({ db, actions, defaultLimit, otel }) => {
373
375
  */
374
376
  when: (queryFilter) => {
375
377
  for (const action of actions) {
376
- if (queryFilters.get(action) === "unrestricted") queryFilters.set(action, []);
378
+ if (queryFilters.get(action) === "unrestricted") if (setUnrestrictedByThisCall.has(action)) queryFilters.set(action, []);
379
+ else continue;
377
380
  queryFilters.get(action).push(queryFilter);
378
381
  }
379
382
  } };