@mikezimm/fps-core-v7 1.0.104 → 1.0.105

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,5 +1,5 @@
1
1
  export const PackageNameFpsCv7 = 'fps-core-v7';
2
- export const PackageVersionFpsCv7 = '1.0.104';
3
- export const PackageVersionLabelFpsCv7 = 'fps-core-v7@1.0.104';
4
- export const PackageVersionTimeFpsCv7 = '1/30/2025, 5:55:47 PM EST';
2
+ export const PackageVersionFpsCv7 = '1.0.105';
3
+ export const PackageVersionLabelFpsCv7 = 'fps-core-v7@1.0.105';
4
+ export const PackageVersionTimeFpsCv7 = '2/9/2025, 12:42:36 AM EST';
5
5
  //# sourceMappingURL=PackageVersion.js.map
@@ -0,0 +1,17 @@
1
+ import { ISourceProps } from '../../../components/molecules/source-props/ISourceProps';
2
+ import { IFpsNavLinksReturn } from '../../../types/fps-returns/sites/nav/INavigationLink';
3
+ import { IJSFetchMethodNoPUT } from '../../../components/molecules/SpHttp/interfaces/IJSFetchReturn';
4
+ import { IPnpNavType } from '../../../types/fps-returns/sites/nav/IPnpNavType';
5
+ /**
6
+ * Can be used instead of getOrAddWebNavAPI to get all levels of the nav heirarchy for non-hub nav like TopLinks and QuickLaunch
7
+ *
8
+ * @param sourceProps
9
+ * @param method
10
+ * @param location
11
+ * @param alertMe
12
+ * @param consoleLog
13
+ * @param maxDepth
14
+ * @returns
15
+ */
16
+ export declare function getFullNavHierarchy(sourceProps: ISourceProps, method: IJSFetchMethodNoPUT, location: IPnpNavType, alertMe: boolean | undefined, consoleLog: boolean | undefined, maxDepth?: number): Promise<IFpsNavLinksReturn>;
17
+ //# sourceMappingURL=getFullNavHierarchy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFullNavHierarchy.d.ts","sourceRoot":"","sources":["../../../../src/restAPIs/sites/nav/getFullNavHierarchy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yDAAyD,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAkB,MAAM,sDAAsD,CAAC;AAE1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,gEAAgE,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAK/E;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,YAAY,EACzB,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,UAAU,EAAE,OAAO,GAAG,SAAS,EAC/B,QAAQ,GAAE,MAAU,GACnB,OAAO,CAAC,kBAAkB,CAAC,CA4D7B"}
@@ -0,0 +1,64 @@
1
+ import { getOrAddWebNavAPI } from './getOrAddWebNavAPI';
2
+ import { startPerformOpV2, updatePerformanceEndV2 } from '../../../components/molecules/Performance/functions';
3
+ /**
4
+ * Can be used instead of getOrAddWebNavAPI to get all levels of the nav heirarchy for non-hub nav like TopLinks and QuickLaunch
5
+ *
6
+ * @param sourceProps
7
+ * @param method
8
+ * @param location
9
+ * @param alertMe
10
+ * @param consoleLog
11
+ * @param maxDepth
12
+ * @returns
13
+ */
14
+ export async function getFullNavHierarchy(sourceProps, method, location, alertMe, consoleLog, maxDepth = 3) {
15
+ /**
16
+ * Flattens a two-dimensional array into a one-dimensional array.
17
+ * @param arr - The nested array to flatten.
18
+ * @returns A flattened array containing all elements.
19
+ */
20
+ function flattenArray(arr) {
21
+ return arr.reduce((acc, val) => acc.concat(val), []);
22
+ }
23
+ /**
24
+ * Recursively fetches navigation items up to the specified depth.
25
+ * @param parentNodeId - The ID of the parent node whose children should be fetched.
26
+ * @param depth - The current depth level in the hierarchy.
27
+ * @returns A promise resolving to an array of navigation links.
28
+ */
29
+ async function fetchNavLevel(parentNodeId, depth) {
30
+ if (depth > maxDepth)
31
+ return [];
32
+ const result = await getOrAddWebNavAPI(sourceProps, method, location, alertMe, consoleLog, null, parentNodeId);
33
+ const navItems = result.navItem;
34
+ // If there are no children or the max depth is reached, return the fetched items
35
+ if (navItems.length === 0 || depth === maxDepth) {
36
+ return navItems;
37
+ }
38
+ // Recursively fetch children for each navigation item
39
+ const childFetches = navItems.map(async (item) => {
40
+ const children = await fetchNavLevel(item.Id, depth + 1);
41
+ return [item, ...children];
42
+ });
43
+ // Resolve all child fetches concurrently
44
+ const resolvedChildren = await Promise.all(childFetches);
45
+ return flattenArray(resolvedChildren);
46
+ }
47
+ const performanceSettings = { label: 'FetchCheck', includeMsStr: true, updateMiliseconds: true, op: 'fetch' };
48
+ const fetchOp = startPerformOpV2(performanceSettings);
49
+ // Fetch the initial set of top-level navigation items (parentNodeId is null)
50
+ const initialResult = await getOrAddWebNavAPI(sourceProps, method, location, alertMe, consoleLog, null);
51
+ // Fetch the first level of children concurrently
52
+ const childFetches = initialResult.navItem.map(async (item) => {
53
+ const children = await fetchNavLevel(item.Id, 2);
54
+ return [item, ...children];
55
+ });
56
+ // Resolve all child fetches and merge them into a single array
57
+ const resolvedChildren = await Promise.all(childFetches);
58
+ const mergedNavItems = flattenArray(resolvedChildren);
59
+ initialResult.unifiedPerformanceOps.fetch = updatePerformanceEndV2({ op: fetchOp, updateMiliseconds: performanceSettings.updateMiliseconds, count: mergedNavItems.length });
60
+ initialResult.fetchOp = initialResult.unifiedPerformanceOps.fetch;
61
+ // Return the original response structure, but with the fully resolved navigation items
62
+ return { ...initialResult, navItem: mergedNavItems, items: mergedNavItems };
63
+ }
64
+ //# sourceMappingURL=getFullNavHierarchy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFullNavHierarchy.js","sourceRoot":"","sources":["../../../../src/restAPIs/sites/nav/getFullNavHierarchy.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAE/G;;;;;;;;;;GAUG;AACH,MAAM,CAAC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AE,iBAAiB,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;IACpI,MAAM,OAAO,GAAG,gBAAgB,CAAE,mBAAmB,CAAE,CAAC;IAExD,6EAA6E;IAC7E,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAG,CAAC;IAE1G,iDAAiD;IACjD,MAAM,YAAY,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC5D,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACjD,OAAO,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,+DAA+D;IAC/D,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACzD,MAAM,cAAc,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAEtD,aAAa,CAAC,qBAAqB,CAAC,KAAK,GAAG,sBAAsB,CAAE,EAAE,EAAE,EAAE,OAAyB,EAAE,iBAAiB,EAAE,mBAAmB,CAAC,iBAAiB,EAAE,KAAK,EAAE,cAAc,CAAC,MAAM,EAAE,CAAmB,CAAC;IACjN,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,qBAAqB,CAAC,KAAK,CAAC;IAElE,uFAAuF;IACvF,OAAO,EAAE,GAAG,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;AAC9E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikezimm/fps-core-v7",
3
- "version": "1.0.104",
3
+ "version": "1.0.105",
4
4
  "description": "Library of reusable core interfaces, types and constants migrated from fps-library-v2",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",