@web-ts-toolkit/access-router 0.31.1 → 0.31.3

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 (3) hide show
  1. package/index.js +8 -2
  2. package/index.mjs +8 -2
  3. package/package.json +3 -3
package/index.js CHANGED
@@ -3034,8 +3034,14 @@ var Core = class {
3034
3034
  path: p.path,
3035
3035
  select: normalizeSelect(p.select)
3036
3036
  };
3037
- const allowedParentPaths = await this.genSelect(modelName, populateAccess, [ret.path], false);
3038
- if (!allowedParentPaths.includes(ret.path)) return null;
3037
+ const parentPath = ret.path.includes(".") ? ret.path.split(".")[0] : ret.path;
3038
+ const allowedParentPaths = await this.genSelect(
3039
+ modelName,
3040
+ populateAccess,
3041
+ [parentPath],
3042
+ false
3043
+ );
3044
+ if (!allowedParentPaths.includes(parentPath)) return null;
3039
3045
  const refModelName = getModelRef(modelName, ret.path);
3040
3046
  if (!refModelName) return null;
3041
3047
  ret.select = await this.genSelect(refModelName, populateAccess, ret.select, false);
package/index.mjs CHANGED
@@ -3018,8 +3018,14 @@ var Core = class {
3018
3018
  path: p.path,
3019
3019
  select: normalizeSelect(p.select)
3020
3020
  };
3021
- const allowedParentPaths = await this.genSelect(modelName, populateAccess, [ret.path], false);
3022
- if (!allowedParentPaths.includes(ret.path)) return null;
3021
+ const parentPath = ret.path.includes(".") ? ret.path.split(".")[0] : ret.path;
3022
+ const allowedParentPaths = await this.genSelect(
3023
+ modelName,
3024
+ populateAccess,
3025
+ [parentPath],
3026
+ false
3027
+ );
3028
+ if (!allowedParentPaths.includes(parentPath)) return null;
3023
3029
  const refModelName = getModelRef(modelName, ret.path);
3024
3030
  if (!refModelName) return null;
3025
3031
  ret.select = await this.genSelect(refModelName, populateAccess, ret.select, false);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@web-ts-toolkit/access-router",
3
3
  "description": "ACL-aware Express routers and in-memory data services for Mongoose-backed APIs",
4
4
  "homepage": "https://web-ts-toolkit.pages.dev/docs/packages/access-router",
5
- "version": "0.31.1",
5
+ "version": "0.31.3",
6
6
  "sideEffects": false,
7
7
  "keywords": [
8
8
  "express",
@@ -40,8 +40,8 @@
40
40
  "node": ">=20"
41
41
  },
42
42
  "dependencies": {
43
- "@web-ts-toolkit/express-json-router": "0.31.1",
44
- "@web-ts-toolkit/utils": "0.31.1",
43
+ "@web-ts-toolkit/express-json-router": "0.31.3",
44
+ "@web-ts-toolkit/utils": "0.31.3",
45
45
  "just-diff": "^6.0.2",
46
46
  "mongoose-schema-jsonschema": "^4.0.1",
47
47
  "sift": "^17.1.3",