@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.cjs +5 -2
- package/out/index.cjs.map +1 -1
- package/out/index.d.cts.map +1 -1
- package/out/index.d.mts.map +1 -1
- package/out/index.mjs +5 -2
- package/out/index.mjs.map +1 -1
- package/package.json +1 -1
package/out/index.cjs
CHANGED
|
@@ -208,7 +208,7 @@ function mapNullFieldsToUndefined(obj) {
|
|
|
208
208
|
}
|
|
209
209
|
//#endregion
|
|
210
210
|
//#region package.json
|
|
211
|
-
var version = "0.18.
|
|
211
|
+
var version = "0.18.7";
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region lib/helpers/mergeFilters.ts
|
|
214
214
|
function mergeFilters(filterA, filterB, mode = "AND") {
|
|
@@ -380,11 +380,13 @@ const createAbilityBuilder = ({ db, actions, defaultLimit, otel }) => {
|
|
|
380
380
|
allow: (action) => {
|
|
381
381
|
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.");
|
|
382
382
|
const actions = Array.isArray(action) ? action : [action];
|
|
383
|
+
const setUnrestrictedByThisCall = /* @__PURE__ */ new Set();
|
|
383
384
|
for (const action of actions) {
|
|
384
385
|
let filters = queryFilters.get(action);
|
|
385
386
|
if (!filters) {
|
|
386
387
|
filters = "unrestricted";
|
|
387
388
|
queryFilters.set(action, filters);
|
|
389
|
+
setUnrestrictedByThisCall.add(action);
|
|
388
390
|
}
|
|
389
391
|
}
|
|
390
392
|
return {
|
|
@@ -401,7 +403,8 @@ const createAbilityBuilder = ({ db, actions, defaultLimit, otel }) => {
|
|
|
401
403
|
*/
|
|
402
404
|
when: (queryFilter) => {
|
|
403
405
|
for (const action of actions) {
|
|
404
|
-
if (queryFilters.get(action) === "unrestricted") queryFilters.set(action, []);
|
|
406
|
+
if (queryFilters.get(action) === "unrestricted") if (setUnrestrictedByThisCall.has(action)) queryFilters.set(action, []);
|
|
407
|
+
else continue;
|
|
405
408
|
queryFilters.get(action).push(queryFilter);
|
|
406
409
|
}
|
|
407
410
|
} };
|