@mu-cabin/opms-permission 0.8.28 → 0.8.29

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/dist/index.cjs CHANGED
@@ -207,11 +207,13 @@ function findFirstEnableNode(data) {
207
207
  function handleOrgTreeByPermission(data) {
208
208
  const orgNoAuthMap = {};
209
209
  function processNode(node) {
210
+ const processedChildren = node.children?.map((child) => processNode(child)).filter((child) => child !== null);
210
211
  if (node.disabled) {
211
212
  orgNoAuthMap[node.orgId] = node;
212
- return null;
213
+ if (!processedChildren?.length) {
214
+ return null;
215
+ }
213
216
  }
214
- const processedChildren = node.children?.map((child) => processNode(child)).filter((child) => child !== null);
215
217
  return {
216
218
  ...node,
217
219
  children: processedChildren || []
package/dist/index.d.mts CHANGED
@@ -168,7 +168,7 @@ declare class Permission {
168
168
  * Query and process organization tree
169
169
  */
170
170
  queryUserOrgs(): Promise<{
171
- orgTree: any[];
171
+ orgTree: OrgTreeItem[];
172
172
  orgNoAuthMap: Record<number, OrgTreeItem>;
173
173
  authOrgTree: OrgTreeItem[];
174
174
  } | null>;
package/dist/index.d.ts CHANGED
@@ -168,7 +168,7 @@ declare class Permission {
168
168
  * Query and process organization tree
169
169
  */
170
170
  queryUserOrgs(): Promise<{
171
- orgTree: any[];
171
+ orgTree: OrgTreeItem[];
172
172
  orgNoAuthMap: Record<number, OrgTreeItem>;
173
173
  authOrgTree: OrgTreeItem[];
174
174
  } | null>;
package/dist/index.mjs CHANGED
@@ -168,11 +168,13 @@ function findFirstEnableNode(data) {
168
168
  function handleOrgTreeByPermission(data) {
169
169
  const orgNoAuthMap = {};
170
170
  function processNode(node) {
171
+ const processedChildren = node.children?.map((child) => processNode(child)).filter((child) => child !== null);
171
172
  if (node.disabled) {
172
173
  orgNoAuthMap[node.orgId] = node;
173
- return null;
174
+ if (!processedChildren?.length) {
175
+ return null;
176
+ }
174
177
  }
175
- const processedChildren = node.children?.map((child) => processNode(child)).filter((child) => child !== null);
176
178
  return {
177
179
  ...node,
178
180
  children: processedChildren || []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mu-cabin/opms-permission",
3
- "version": "0.8.28",
3
+ "version": "0.8.29",
4
4
  "description": "Frontend SDK for OPMS permission and auth management.",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",