@acorex-platform/module-platform-management-client 0.0.21

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 (45) hide show
  1. package/fesm2022/acorex-platform-module-platform-management-client-acorex-platform-module-platform-management-client-V_ao4WVM.mjs +4599 -0
  2. package/fesm2022/acorex-platform-module-platform-management-client-acorex-platform-module-platform-management-client-V_ao4WVM.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-platform-management-client-contracts.mjs +179 -0
  4. package/fesm2022/acorex-platform-module-platform-management-client-contracts.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-platform-management-client-create-user-query.command-2Qu7aoCp.mjs +1542 -0
  6. package/fesm2022/acorex-platform-module-platform-management-client-create-user-query.command-2Qu7aoCp.mjs.map +1 -0
  7. package/fesm2022/acorex-platform-module-platform-management-client-create-user-query.types-DdygAori.mjs +71 -0
  8. package/fesm2022/acorex-platform-module-platform-management-client-create-user-query.types-DdygAori.mjs.map +1 -0
  9. package/fesm2022/acorex-platform-module-platform-management-client-customize-menu.command-2319iHsD.mjs +231 -0
  10. package/fesm2022/acorex-platform-module-platform-management-client-customize-menu.command-2319iHsD.mjs.map +1 -0
  11. package/fesm2022/acorex-platform-module-platform-management-client-data-list-pick-entity-item.command-CJVpqPmY.mjs +52 -0
  12. package/fesm2022/acorex-platform-module-platform-management-client-data-list-pick-entity-item.command-CJVpqPmY.mjs.map +1 -0
  13. package/fesm2022/acorex-platform-module-platform-management-client-entity-master-actions-for-ai.util-DmGyoy9o.mjs +55 -0
  14. package/fesm2022/acorex-platform-module-platform-management-client-entity-master-actions-for-ai.util-DmGyoy9o.mjs.map +1 -0
  15. package/fesm2022/acorex-platform-module-platform-management-client-execute-token.command-DNuHR-0y.mjs +152 -0
  16. package/fesm2022/acorex-platform-module-platform-management-client-execute-token.command-DNuHR-0y.mjs.map +1 -0
  17. package/fesm2022/acorex-platform-module-platform-management-client-list-catalog-scopes.query-ByhDTWE6.mjs +71 -0
  18. package/fesm2022/acorex-platform-module-platform-management-client-list-catalog-scopes.query-ByhDTWE6.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-module-platform-management-client-list-editor-widgets.query-DITPMmbw.mjs +68 -0
  20. package/fesm2022/acorex-platform-module-platform-management-client-list-editor-widgets.query-DITPMmbw.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-module-platform-management-client-list-platform-navigation-for-ai.query-2oHMITw-.mjs +194 -0
  22. package/fesm2022/acorex-platform-module-platform-management-client-list-platform-navigation-for-ai.query-2oHMITw-.mjs.map +1 -0
  23. package/fesm2022/acorex-platform-module-platform-management-client-list-registered-entities.query-DjStd3a8.mjs +136 -0
  24. package/fesm2022/acorex-platform-module-platform-management-client-list-registered-entities.query-DjStd3a8.mjs.map +1 -0
  25. package/fesm2022/acorex-platform-module-platform-management-client-list-registered-queries.query-C-IfkTel.mjs +122 -0
  26. package/fesm2022/acorex-platform-module-platform-management-client-list-registered-queries.query-C-IfkTel.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-module-platform-management-client-menu-list.component-C5HH5-Dw.mjs +524 -0
  28. package/fesm2022/acorex-platform-module-platform-management-client-menu-list.component-C5HH5-Dw.mjs.map +1 -0
  29. package/fesm2022/acorex-platform-module-platform-management-client-platform-console-charts.queries-CQ34R13-.mjs +216 -0
  30. package/fesm2022/acorex-platform-module-platform-management-client-platform-console-charts.queries-CQ34R13-.mjs.map +1 -0
  31. package/fesm2022/acorex-platform-module-platform-management-client-platform-console-data.util-BIkULtKk.mjs +81 -0
  32. package/fesm2022/acorex-platform-module-platform-management-client-platform-console-data.util-BIkULtKk.mjs.map +1 -0
  33. package/fesm2022/acorex-platform-module-platform-management-client-platform-console-kpi.queries-BkPdhVq_.mjs +137 -0
  34. package/fesm2022/acorex-platform-module-platform-management-client-platform-console-kpi.queries-BkPdhVq_.mjs.map +1 -0
  35. package/fesm2022/acorex-platform-module-platform-management-client-rest-api-generator-widget-column.component-CYb2zOSj.mjs +45 -0
  36. package/fesm2022/acorex-platform-module-platform-management-client-rest-api-generator-widget-column.component-CYb2zOSj.mjs.map +1 -0
  37. package/fesm2022/acorex-platform-module-platform-management-client-rest-api-generator-widget-edit.component-BBwrzcXa.mjs +178 -0
  38. package/fesm2022/acorex-platform-module-platform-management-client-rest-api-generator-widget-edit.component-BBwrzcXa.mjs.map +1 -0
  39. package/fesm2022/acorex-platform-module-platform-management-client-rest-api-generator-widget-view.component-DBlZVz6u.mjs +45 -0
  40. package/fesm2022/acorex-platform-module-platform-management-client-rest-api-generator-widget-view.component-DBlZVz6u.mjs.map +1 -0
  41. package/fesm2022/acorex-platform-module-platform-management-client.mjs +2 -0
  42. package/fesm2022/acorex-platform-module-platform-management-client.mjs.map +1 -0
  43. package/package.json +28 -0
  44. package/types/acorex-platform-module-platform-management-client-contracts.d.ts +258 -0
  45. package/types/acorex-platform-module-platform-management-client.d.ts +548 -0
@@ -0,0 +1,194 @@
1
+ import { AXTranslationService } from '@acorex/core/translation';
2
+ import { AXPMenuProviderService } from '@acorex-platform/framework-client/common';
3
+ import { runtimeQuerySuccessObject, runtimeQueryFailure } from '@acorex-platform/framework-shared/core';
4
+ import { AXPEntityResolver } from '@acorex-platform/framework-client/layout/entity';
5
+ import * as i0 from '@angular/core';
6
+ import { inject, Injectable } from '@angular/core';
7
+ import { a as axmSummarizeMasterUiActionsForAi } from './acorex-platform-module-platform-management-client-entity-master-actions-for-ai.util-DmGyoy9o.mjs';
8
+
9
+ //#endregion
10
+ //#region ---- Helpers ----
11
+ const DEFAULT_ROW_LIMIT = 300;
12
+ const MIN_ROW_LIMIT = 40;
13
+ const MAX_ROW_LIMIT = 500;
14
+ function normalizeLimit(raw) {
15
+ if (typeof raw === 'number' && Number.isFinite(raw)) {
16
+ const n = Math.floor(raw);
17
+ return Math.min(MAX_ROW_LIMIT, Math.max(MIN_ROW_LIMIT, n));
18
+ }
19
+ if (typeof raw === 'string') {
20
+ const parsed = Number.parseInt(raw.trim(), 10);
21
+ if (Number.isFinite(parsed)) {
22
+ return Math.min(MAX_ROW_LIMIT, Math.max(MIN_ROW_LIMIT, parsed));
23
+ }
24
+ }
25
+ return DEFAULT_ROW_LIMIT;
26
+ }
27
+ function matchesFold(haystack, needle) {
28
+ return haystack.toLocaleUpperCase().includes(needle.toLocaleUpperCase());
29
+ }
30
+ /** Expects **`Module.Entity`** (`SecurityManagement.User`). */
31
+ function parseRegisteredEntityFullName(fullName) {
32
+ const trimmed = fullName.trim();
33
+ const dot = trimmed.indexOf('.');
34
+ if (dot <= 0 || dot >= trimmed.length - 1) {
35
+ return null;
36
+ }
37
+ return { module: trimmed.slice(0, dot), name: trimmed.slice(dot + 1) };
38
+ }
39
+ /**
40
+ * Collects `Module.Entity` keys implied by entity master router paths on menu rows
41
+ * (`/{app}/m/{module}/e/{entity}/...`).
42
+ */
43
+ function collectEntityFullNamesFromMenuPaths(paths) {
44
+ const seen = new Set();
45
+ const re = /\/m\/([^/?#]+)\/e\/([^/?#]+)\//g;
46
+ for (const raw of paths) {
47
+ if (!raw) {
48
+ continue;
49
+ }
50
+ re.lastIndex = 0;
51
+ let m;
52
+ while ((m = re.exec(raw)) !== null) {
53
+ seen.add(`${m[1]}.${m[2]}`);
54
+ }
55
+ }
56
+ return seen;
57
+ }
58
+ //#endregion
59
+ //#region ---- List platform navigation for AI ----
60
+ /**
61
+ * Builds a flattened, searchable view of visible platform menu entries (middleware-filtered snapshot)
62
+ * for product “how‑to” and navigation assistants. Intended for **read-only grounding** —
63
+ * callers should complement with entity schema tools when field-level detail matters.
64
+ * **Sidebar menus are not the full entity catalog** — use optional **`includeRegisteredEntitiesNotInSidebarMenu`**
65
+ * or **`ListRegisteredEntities`** when assistants must not equate “in the menu” with “all registered entities”.
66
+ * Optional **`entityFullName`** (`Module.Entity`) adds toolbar action labels from that entity’s master interfaces.
67
+ */
68
+ class AXMListPlatformNavigationForAiQuery {
69
+ constructor() {
70
+ //#region ---- Services & Dependencies ----
71
+ this.menuProviders = inject(AXPMenuProviderService);
72
+ this.translation = inject(AXTranslationService);
73
+ this.entityResolver = inject(AXPEntityResolver);
74
+ }
75
+ //#endregion
76
+ //#region ---- Query Execution ----
77
+ async fetch(input) {
78
+ try {
79
+ const opts = input ?? {};
80
+ const limit = normalizeLimit(opts.limit);
81
+ const search = opts.quickSearch?.trim();
82
+ const entityFullName = opts.entityFullName?.trim();
83
+ const tree = await this.menuProviders.items();
84
+ const flattened = this.flattenMenus(tree);
85
+ const linkedFromMenuPaths = collectEntityFullNamesFromMenuPaths(flattened.map((r) => r.path));
86
+ let rows = flattened;
87
+ if (search) {
88
+ rows = flattened.filter((r) => matchesFold(`${r.menuName ?? ''}|${r.title}|${r.titleKey}|${r.path ?? ''}|${r.hierarchyPath}`, search));
89
+ }
90
+ rows.sort((a, b) => a.hierarchyPath.localeCompare(b.hierarchyPath));
91
+ let matchStatus;
92
+ if (search && rows.length === 0) {
93
+ matchStatus = 'empty';
94
+ }
95
+ else if (search) {
96
+ matchStatus = 'filtered';
97
+ }
98
+ else {
99
+ matchStatus = 'catalog';
100
+ }
101
+ const truncated = rows.length > limit;
102
+ let entityMasterUiActions;
103
+ let entityMasterUiActionsMatch;
104
+ if (entityFullName) {
105
+ const parsed = parseRegisteredEntityFullName(entityFullName);
106
+ if (!parsed) {
107
+ entityMasterUiActions = null;
108
+ entityMasterUiActionsMatch = 'none';
109
+ }
110
+ else {
111
+ const def = await this.entityResolver.get(parsed.module, parsed.name);
112
+ if (def) {
113
+ entityMasterUiActions = axmSummarizeMasterUiActionsForAi(def, (key) => this.resolveMenuTitle(key));
114
+ entityMasterUiActionsMatch = 'single';
115
+ }
116
+ else {
117
+ entityMasterUiActions = null;
118
+ entityMasterUiActionsMatch = 'none';
119
+ }
120
+ }
121
+ }
122
+ let registeredEntitiesNotInSidebarMenu;
123
+ if (opts.includeRegisteredEntitiesNotInSidebarMenu) {
124
+ const catalog = await this.entityResolver.listAll();
125
+ const sortedCatalog = [...catalog].sort((a, b) => {
126
+ const byModule = a.module.localeCompare(b.module);
127
+ return byModule !== 0 ? byModule : a.name.localeCompare(b.name);
128
+ });
129
+ registeredEntitiesNotInSidebarMenu = sortedCatalog
130
+ .filter((e) => !linkedFromMenuPaths.has(e.fullName))
131
+ .map((e) => e.fullName);
132
+ }
133
+ return runtimeQuerySuccessObject({
134
+ matchStatus,
135
+ truncated,
136
+ navigation: rows.slice(0, limit),
137
+ ...(entityFullName
138
+ ? {
139
+ entityMasterUiActions: entityMasterUiActions ?? null,
140
+ entityMasterUiActionsMatch,
141
+ }
142
+ : {}),
143
+ ...(registeredEntitiesNotInSidebarMenu !== undefined
144
+ ? { registeredEntitiesNotInSidebarMenu }
145
+ : {}),
146
+ });
147
+ }
148
+ catch (error) {
149
+ return runtimeQueryFailure(error instanceof Error ? error.message : 'Unknown error occurred');
150
+ }
151
+ }
152
+ //#endregion
153
+ //#region ---- Private ----
154
+ resolveMenuTitle(text) {
155
+ try {
156
+ return this.translation.translateSync(text);
157
+ }
158
+ catch {
159
+ return text;
160
+ }
161
+ }
162
+ flattenMenus(items) {
163
+ const rows = [];
164
+ const walk = (nodes, ancestorsResolved) => {
165
+ for (const item of nodes) {
166
+ const title = this.resolveMenuTitle(item.text);
167
+ const ancestors = [...ancestorsResolved, title];
168
+ rows.push({
169
+ menuName: item.name,
170
+ title,
171
+ titleKey: item.text,
172
+ hierarchyPath: ancestors.join(' › '),
173
+ depth: ancestorsResolved.length,
174
+ ...(item.path ? { path: item.path } : {}),
175
+ ...(item.type ? { menuType: item.type } : {}),
176
+ });
177
+ if (item.children?.length) {
178
+ walk(item.children, ancestors);
179
+ }
180
+ }
181
+ };
182
+ walk(items, []);
183
+ return rows;
184
+ }
185
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMListPlatformNavigationForAiQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
186
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMListPlatformNavigationForAiQuery, providedIn: 'root' }); }
187
+ }
188
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMListPlatformNavigationForAiQuery, decorators: [{
189
+ type: Injectable,
190
+ args: [{ providedIn: 'root' }]
191
+ }] });
192
+
193
+ export { AXMListPlatformNavigationForAiQuery };
194
+ //# sourceMappingURL=acorex-platform-module-platform-management-client-list-platform-navigation-for-ai.query-2oHMITw-.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-platform-management-client-list-platform-navigation-for-ai.query-2oHMITw-.mjs","sources":["../../../../libs/modules/platform-management/client/src/lib/features/queries/list-platform-navigation-for-ai.query.ts"],"sourcesContent":["import { AXTranslationService } from '@acorex/core/translation';\nimport type { AXPMenuItem } from '@acorex-platform/framework-client/common';\nimport { AXPMenuProviderService } from '@acorex-platform/framework-client/common';\nimport type { AXPQuery, AXPQueryFetchResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n runtimeQueryFailure,\n runtimeQuerySuccessObject,\n type AXPRuntimeQueryResult,\n} from '@acorex-platform/framework-shared/core';\nimport { AXPEntityResolver } from '@acorex-platform/framework-client/layout/entity';\nimport { Injectable, inject } from '@angular/core';\n\nimport type { AXMEntityMasterUiActionsForAi } from './entity-master-actions-for-ai.util';\nimport { axmSummarizeMasterUiActionsForAi } from './entity-master-actions-for-ai.util';\n\n//#region ---- Types ----\n\nexport interface AXMListPlatformNavigationForAiQueryInput {\n /**\n * Single-line filter against resolved titles, `titleKey`, `menuName`, routing `path`,\n * and hierarchical path text (case-insensitive substring match).\n * When omitted, all visible menu rows after middleware are returned (truncated via `limit`).\n */\n quickSearch?: string;\n /**\n * Soft cap after filtering; enforced between 40 and 500. Omit for default **300**.\n */\n limit?: number;\n /**\n * When set to exact `ModuleName.EntityName`, the result includes **`entityMasterUiActions`**\n * (toolbar labels from registered entity layouts) alongside navigation rows — same derivation as **`ListRegisteredEntities`**.\n */\n entityFullName?: string;\n /**\n * When true, the result includes **`registeredEntitiesNotInSidebarMenu`** — resolver catalog entries whose\n * standard master path segment **`/m/{module}/e/{entity}/`** does not appear in any flattened menu **`path`**.\n * Heuristic (see result field); pair with **`ListRegisteredEntities`** for the full catalog.\n */\n includeRegisteredEntitiesNotInSidebarMenu?: boolean;\n}\n\n/** One flattened row from the middleware-applied sidebar / shell menu tree. */\nexport interface AXMPlatformNavigationAiRow {\n /** Stable menu item key when present (often useful for correlate with manifests). */\n menuName?: string;\n /** User-visible title resolved with {@link AXTranslationService.translateSync} when possible. */\n title: string;\n /** Original `text` from the menu definition (typically a `@scope:key` token). */\n titleKey: string;\n /** Breadcrumb of resolved ancestor titles separated by › (current item included last). */\n hierarchyPath: string;\n depth: number;\n /** Entity / page route fragment when navigable via router. */\n path?: string;\n /** `menu` | `group` | `break` when present — folder vs leaf-ish chrome. */\n menuType?: string;\n}\n\n/** `catalog`: no filter. `filtered`: `quickSearch` applied. `empty`: matched nothing. */\nexport type AXMPlatformNavigationAiMatchStatus = 'catalog' | 'filtered' | 'empty';\n\nexport interface AXMListPlatformNavigationForAiQueryResult {\n matchStatus: AXMPlatformNavigationAiMatchStatus;\n /** Flattened menu rows sorted by hierarchy path — how-to answers should cite these verbatim. */\n navigation: AXMPlatformNavigationAiRow[];\n truncated: boolean;\n /**\n * Present when **`entityFullName`** was supplied: master list + detail toolbar action labels from the resolver.\n * `null` when the entity did not resolve.\n */\n entityMasterUiActions?: AXMEntityMasterUiActionsForAi | null;\n entityMasterUiActionsMatch?: AXMNavigationEntityUiActionsMatch;\n /**\n * Present when **`includeRegisteredEntitiesNotInSidebarMenu`** was true: `Module.Entity` keys from\n * {@link AXPEntityResolver.listAll} with no matching **`/m/{module}/e/{entity}/`** segment in any menu **`path`**.\n * Entities reachable only via lookups, merge-detail, related lists, or **`command`** navigation (no `path`) can appear here.\n */\n registeredEntitiesNotInSidebarMenu?: string[];\n}\n\n/** Resolver outcome for optional {@link AXMListPlatformNavigationForAiQueryInput.entityFullName}. */\nexport type AXMNavigationEntityUiActionsMatch = 'none' | 'single';\n\n//#endregion\n\n//#region ---- Helpers ----\n\nconst DEFAULT_ROW_LIMIT = 300;\nconst MIN_ROW_LIMIT = 40;\nconst MAX_ROW_LIMIT = 500;\n\nfunction normalizeLimit(raw: unknown): number {\n if (typeof raw === 'number' && Number.isFinite(raw)) {\n const n = Math.floor(raw);\n return Math.min(MAX_ROW_LIMIT, Math.max(MIN_ROW_LIMIT, n));\n }\n if (typeof raw === 'string') {\n const parsed = Number.parseInt(raw.trim(), 10);\n if (Number.isFinite(parsed)) {\n return Math.min(MAX_ROW_LIMIT, Math.max(MIN_ROW_LIMIT, parsed));\n }\n }\n return DEFAULT_ROW_LIMIT;\n}\n\nfunction matchesFold(haystack: string, needle: string): boolean {\n return haystack.toLocaleUpperCase().includes(needle.toLocaleUpperCase());\n}\n\n/** Expects **`Module.Entity`** (`SecurityManagement.User`). */\nfunction parseRegisteredEntityFullName(fullName: string): { module: string; name: string } | null {\n const trimmed = fullName.trim();\n const dot = trimmed.indexOf('.');\n if (dot <= 0 || dot >= trimmed.length - 1) {\n return null;\n }\n return { module: trimmed.slice(0, dot), name: trimmed.slice(dot + 1) };\n}\n\n/**\n * Collects `Module.Entity` keys implied by entity master router paths on menu rows\n * (`/{app}/m/{module}/e/{entity}/...`).\n */\nfunction collectEntityFullNamesFromMenuPaths(paths: Iterable<string | undefined>): Set<string> {\n const seen = new Set<string>();\n const re = /\\/m\\/([^/?#]+)\\/e\\/([^/?#]+)\\//g;\n for (const raw of paths) {\n if (!raw) {\n continue;\n }\n re.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = re.exec(raw)) !== null) {\n seen.add(`${m[1]}.${m[2]}`);\n }\n }\n return seen;\n}\n\n//#endregion\n\n//#region ---- List platform navigation for AI ----\n\n/**\n * Builds a flattened, searchable view of visible platform menu entries (middleware-filtered snapshot)\n * for product “how‑to” and navigation assistants. Intended for **read-only grounding** —\n * callers should complement with entity schema tools when field-level detail matters.\n * **Sidebar menus are not the full entity catalog** — use optional **`includeRegisteredEntitiesNotInSidebarMenu`**\n * or **`ListRegisteredEntities`** when assistants must not equate “in the menu” with “all registered entities”.\n * Optional **`entityFullName`** (`Module.Entity`) adds toolbar action labels from that entity’s master interfaces.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMListPlatformNavigationForAiQuery\n implements AXPQuery<AXMListPlatformNavigationForAiQueryInput, AXMListPlatformNavigationForAiQueryResult>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly menuProviders = inject(AXPMenuProviderService);\n private readonly translation = inject(AXTranslationService);\n private readonly entityResolver = inject(AXPEntityResolver);\n\n //#endregion\n\n //#region ---- Query Execution ----\n\n async fetch(\n input?: AXMListPlatformNavigationForAiQueryInput | null,\n ): AXPQueryFetchResultPromise<AXMListPlatformNavigationForAiQueryResult> {\n try {\n const opts = input ?? {};\n const limit = normalizeLimit(opts.limit);\n const search = opts.quickSearch?.trim();\n\n const entityFullName = opts.entityFullName?.trim();\n\n const tree = await this.menuProviders.items();\n const flattened = this.flattenMenus(tree);\n const linkedFromMenuPaths = collectEntityFullNamesFromMenuPaths(flattened.map((r) => r.path));\n\n let rows = flattened;\n if (search) {\n rows = flattened.filter((r) =>\n matchesFold(`${r.menuName ?? ''}|${r.title}|${r.titleKey}|${r.path ?? ''}|${r.hierarchyPath}`, search),\n );\n }\n\n rows.sort((a, b) => a.hierarchyPath.localeCompare(b.hierarchyPath));\n\n let matchStatus: AXMPlatformNavigationAiMatchStatus;\n if (search && rows.length === 0) {\n matchStatus = 'empty';\n } else if (search) {\n matchStatus = 'filtered';\n } else {\n matchStatus = 'catalog';\n }\n\n const truncated = rows.length > limit;\n\n let entityMasterUiActions: AXMEntityMasterUiActionsForAi | null | undefined;\n let entityMasterUiActionsMatch: AXMNavigationEntityUiActionsMatch | undefined;\n\n if (entityFullName) {\n const parsed = parseRegisteredEntityFullName(entityFullName);\n if (!parsed) {\n entityMasterUiActions = null;\n entityMasterUiActionsMatch = 'none';\n } else {\n const def = await this.entityResolver.get(parsed.module, parsed.name);\n if (def) {\n entityMasterUiActions = axmSummarizeMasterUiActionsForAi(def, (key) =>\n this.resolveMenuTitle(key),\n );\n entityMasterUiActionsMatch = 'single';\n } else {\n entityMasterUiActions = null;\n entityMasterUiActionsMatch = 'none';\n }\n }\n }\n\n let registeredEntitiesNotInSidebarMenu: string[] | undefined;\n if (opts.includeRegisteredEntitiesNotInSidebarMenu) {\n const catalog = await this.entityResolver.listAll();\n const sortedCatalog = [...catalog].sort((a, b) => {\n const byModule = a.module.localeCompare(b.module);\n return byModule !== 0 ? byModule : a.name.localeCompare(b.name);\n });\n registeredEntitiesNotInSidebarMenu = sortedCatalog\n .filter((e) => !linkedFromMenuPaths.has(e.fullName))\n .map((e) => e.fullName);\n }\n\n return runtimeQuerySuccessObject({\n matchStatus,\n truncated,\n navigation: rows.slice(0, limit),\n ...(entityFullName\n ? {\n entityMasterUiActions: entityMasterUiActions ?? null,\n entityMasterUiActionsMatch,\n }\n : {}),\n ...(registeredEntitiesNotInSidebarMenu !== undefined\n ? { registeredEntitiesNotInSidebarMenu }\n : {}),\n });\n } catch (error) {\n return runtimeQueryFailure(\n error instanceof Error ? error.message : 'Unknown error occurred',\n );\n }\n }\n\n //#endregion\n\n //#region ---- Private ----\n\n private resolveMenuTitle(text: string): string {\n try {\n return this.translation.translateSync(text);\n } catch {\n return text;\n }\n }\n\n private flattenMenus(items: AXPMenuItem[]): AXMPlatformNavigationAiRow[] {\n const rows: AXMPlatformNavigationAiRow[] = [];\n\n const walk = (nodes: AXPMenuItem[], ancestorsResolved: string[]): void => {\n for (const item of nodes) {\n const title = this.resolveMenuTitle(item.text);\n const ancestors = [...ancestorsResolved, title];\n\n rows.push({\n menuName: item.name,\n title,\n titleKey: item.text,\n hierarchyPath: ancestors.join(' › '),\n depth: ancestorsResolved.length,\n ...(item.path ? { path: item.path } : {}),\n ...(item.type ? { menuType: item.type }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AI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;AACzC,oBAAA,IAAI,IAAI,CAAC,IAAI,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;AAC9C,iBAAA,CAAC;AAEF,gBAAA,IAAI,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE;AACzB,oBAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC;gBAChC;YACF;AACF,QAAA,CAAC;AAED,QAAA,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;AACf,QAAA,OAAO,IAAI;IACb;8GA5IW,mCAAmC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAnC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mCAAmC,cADtB,MAAM,EAAA,CAAA,CAAA;;2FACnB,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAD/C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
@@ -0,0 +1,136 @@
1
+ import { collectEntityQuickSearchFieldPaths } from '@acorex-platform/framework-shared/entity';
2
+ import { runtimeQuerySuccessObject, runtimeQueryFailure } from '@acorex-platform/framework-shared/core';
3
+ import { AXTranslationService } from '@acorex/core/translation';
4
+ import { AXPEntityResolver } from '@acorex-platform/framework-client/layout/entity';
5
+ import * as i0 from '@angular/core';
6
+ import { inject, Injectable } from '@angular/core';
7
+ import { a as axmSummarizeMasterUiActionsForAi } from './acorex-platform-module-platform-management-client-entity-master-actions-for-ai.util-DmGyoy9o.mjs';
8
+
9
+ //#endregion
10
+ //#region ---- Property summary ----
11
+ function toRegisteredEntityPropertySummary(prop) {
12
+ const iface = prop.schema?.interface;
13
+ const rawType = iface?.type;
14
+ const interfaceType = typeof rawType === 'string' ? rawType : undefined;
15
+ const opts = iface?.options;
16
+ let lookupEntity;
17
+ let filterValuePaths;
18
+ if (opts && typeof opts['entity'] === 'string' && opts['entity'].trim()) {
19
+ lookupEntity = opts['entity'].trim();
20
+ }
21
+ const expose = opts?.['expose'];
22
+ if (Array.isArray(expose)) {
23
+ const paths = expose
24
+ .map((row) => (row && typeof row === 'object' ? row.target : undefined))
25
+ .filter((t) => typeof t === 'string' && t.length > 0);
26
+ if (paths.length) {
27
+ filterValuePaths = paths;
28
+ }
29
+ }
30
+ return {
31
+ name: prop.name,
32
+ title: prop.title,
33
+ dataType: prop.schema?.dataType ?? 'unknown',
34
+ nullable: prop.schema?.nullable,
35
+ ...(interfaceType ? { interfaceType } : {}),
36
+ ...(lookupEntity ? { lookupEntity } : {}),
37
+ ...(filterValuePaths ? { filterValuePaths } : {}),
38
+ };
39
+ }
40
+ //#endregion
41
+ //#region ---- List Registered Entities Query ----
42
+ /**
43
+ * Returns every entity known to {@link AXPEntityResolver} (all loaders), sorted by module then entity name,
44
+ * unless {@link AXMListRegisteredEntitiesQueryInput.entityFullName} is set — then only that entity is returned,
45
+ * with property metadata and **master UI action** summaries (list + detail toolbars).
46
+ */
47
+ class AXMListRegisteredEntitiesQuery {
48
+ constructor() {
49
+ //#region ---- Services & Dependencies ----
50
+ this.entityResolver = inject(AXPEntityResolver);
51
+ this.translation = inject(AXTranslationService);
52
+ }
53
+ //#endregion
54
+ //#region ---- Query Execution ----
55
+ async fetch(input) {
56
+ try {
57
+ const opts = input ?? {};
58
+ const entries = await this.entityResolver.listAll();
59
+ const targetFullName = opts.entityFullName?.trim();
60
+ const sorted = [...entries].sort((a, b) => {
61
+ const byModule = a.module.localeCompare(b.module);
62
+ if (byModule !== 0) {
63
+ return byModule;
64
+ }
65
+ return a.name.localeCompare(b.name);
66
+ });
67
+ const entities = [];
68
+ for (const e of sorted) {
69
+ if (targetFullName && e.fullName !== targetFullName) {
70
+ continue;
71
+ }
72
+ const base = {
73
+ module: e.module,
74
+ name: e.name,
75
+ fullName: e.fullName,
76
+ };
77
+ if (targetFullName) {
78
+ const def = await this.entityResolver.get(e.module, e.name);
79
+ const props = def?.properties?.map(toRegisteredEntityPropertySummary) ?? [];
80
+ const masterUiActions = def ? axmSummarizeMasterUiActionsForAi(def, (k) => this.resolveEntityCopy(k)) : undefined;
81
+ const quickSearchPaths = def
82
+ ? await collectEntityQuickSearchFieldPaths(def, (m, n) => this.entityResolver.get(m, n))
83
+ : undefined;
84
+ entities.push({
85
+ ...base,
86
+ properties: props,
87
+ ...(quickSearchPaths?.length ? { quickSearchPaths } : {}),
88
+ ...(masterUiActions ? { masterUiActions } : {}),
89
+ });
90
+ }
91
+ else {
92
+ entities.push(base);
93
+ }
94
+ }
95
+ let matchStatus;
96
+ if (!targetFullName) {
97
+ matchStatus = 'catalog';
98
+ }
99
+ else if (entities.length === 0) {
100
+ matchStatus = 'none';
101
+ }
102
+ else if (entities.length === 1) {
103
+ matchStatus = 'single';
104
+ }
105
+ else {
106
+ matchStatus = 'multiple';
107
+ }
108
+ return runtimeQuerySuccessObject({
109
+ matchStatus,
110
+ entities,
111
+ });
112
+ }
113
+ catch (error) {
114
+ return runtimeQueryFailure(error instanceof Error ? error.message : 'Unknown error occurred');
115
+ }
116
+ }
117
+ //#endregion
118
+ //#region ---- Private helpers ----
119
+ resolveEntityCopy(text) {
120
+ try {
121
+ return this.translation.translateSync(text);
122
+ }
123
+ catch {
124
+ return text;
125
+ }
126
+ }
127
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMListRegisteredEntitiesQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
128
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMListRegisteredEntitiesQuery, providedIn: 'root' }); }
129
+ }
130
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMListRegisteredEntitiesQuery, decorators: [{
131
+ type: Injectable,
132
+ args: [{ providedIn: 'root' }]
133
+ }] });
134
+
135
+ export { AXMListRegisteredEntitiesQuery };
136
+ //# sourceMappingURL=acorex-platform-module-platform-management-client-list-registered-entities.query-DjStd3a8.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-platform-management-client-list-registered-entities.query-DjStd3a8.mjs","sources":["../../../../libs/modules/platform-management/client/src/lib/features/queries/list-registered-entities.query.ts"],"sourcesContent":["\n\nimport { AXPQuery, type AXPQueryFetchResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { type AXPEntityProperty, collectEntityQuickSearchFieldPaths } from '@acorex-platform/framework-shared/entity';\nimport {\n runtimeQueryFailure,\n runtimeQuerySuccessObject,\n type AXPRuntimeQueryResult,\n} from '@acorex-platform/framework-shared/core';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPEntityResolver } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\n\nimport type { AXMEntityMasterUiActionsForAi } from './entity-master-actions-for-ai.util';\nimport { axmSummarizeMasterUiActionsForAi } from './entity-master-actions-for-ai.util';\n\n//#region ---- Types ----\n\nexport interface AXMListRegisteredEntitiesQueryInput {\n /**\n * Optional `ModuleName.EntityName`. When set, the result list is filtered to that entity only and its row\n * includes a full `properties` array. When omitted, the entire catalog is returned without `properties` on\n * any row (lightweight list).\n */\n entityFullName?: string;\n}\n\nexport interface AXMRegisteredEntityPropertySummary {\n name: string;\n title: string;\n dataType: string;\n nullable?: boolean;\n /** Editor/widget type when present (e.g. lookup). */\n interfaceType?: string;\n /** For lookup-like fields: related catalog entity as `Module.Entity`. */\n lookupEntity?: string;\n /**\n * Denormalized value paths on stored rows (lodash `get` paths for filters), e.g. `brand.title` alongside `brandId`.\n */\n filterValuePaths?: string[];\n}\n\nexport interface AXMListRegisteredEntitiesQueryItem {\n /** Module key as registered on entity loaders (first segment of fullName). */\n module: string;\n /** Entity name (second segment of fullName). */\n name: string;\n /** Canonical `ModuleName.EntityName` string; use this value for Entity:GetDetails `entity`. */\n fullName: string;\n /**\n * Present on each row when {@link AXMListRegisteredEntitiesQueryInput.entityFullName} was provided (the single\n * matching catalog entry). Omitted on every row when that input was not provided.\n */\n properties?: AXMRegisteredEntityPropertySummary[];\n /**\n * When {@link AXMListRegisteredEntitiesQueryInput.entityFullName} was supplied and the resolver returned a definition:\n * master **list** and **detail (single)** toolbar actions (resolved titles — Create, Delete, View, …).\n */\n masterUiActions?: AXMEntityMasterUiActionsForAi;\n /**\n * When {@link AXMListRegisteredEntitiesQueryInput.entityFullName} was supplied and a definition was resolved:\n * lodash-get paths included in mock storage **`quickSearch`** (text `contains`), including merge-detail related\n * snapshots (e.g. `person.fullName`) and dotted column paths.\n */\n quickSearchPaths?: string[];\n}\n\n/** How the result relates to the optional entityFullName filter; omitted when success is false. */\nexport type AXMListRegisteredEntitiesMatchStatus = 'none' | 'single' | 'multiple' | 'catalog';\n\nexport interface AXMListRegisteredEntitiesQueryResult {\n /** Documents catalog vs filter match cardinality for agents. */\n matchStatus: AXMListRegisteredEntitiesMatchStatus;\n entities: AXMListRegisteredEntitiesQueryItem[];\n}\n\n//#endregion\n\n//#region ---- Property summary ----\n\nfunction toRegisteredEntityPropertySummary(prop: AXPEntityProperty): AXMRegisteredEntityPropertySummary {\n const iface = prop.schema?.interface;\n const rawType = iface?.type;\n const interfaceType = typeof rawType === 'string' ? rawType : undefined;\n const opts = iface?.options as Record<string, unknown> | undefined;\n\n let lookupEntity: string | undefined;\n let filterValuePaths: string[] | undefined;\n\n if (opts && typeof opts['entity'] === 'string' && opts['entity'].trim()) {\n lookupEntity = opts['entity'].trim();\n }\n\n const expose = opts?.['expose'];\n if (Array.isArray(expose)) {\n const paths = expose\n .map((row) => (row && typeof row === 'object' ? (row as { target?: unknown }).target : undefined))\n .filter((t): t is string => typeof t === 'string' && t.length > 0);\n if (paths.length) {\n filterValuePaths = paths;\n }\n }\n\n return {\n name: prop.name,\n title: prop.title,\n dataType: prop.schema?.dataType ?? 'unknown',\n nullable: prop.schema?.nullable,\n ...(interfaceType ? { interfaceType } : {}),\n ...(lookupEntity ? { lookupEntity } : {}),\n ...(filterValuePaths ? { filterValuePaths } : {}),\n };\n}\n\n//#endregion\n\n//#region ---- List Registered Entities Query ----\n\n/**\n * Returns every entity known to {@link AXPEntityResolver} (all loaders), sorted by module then entity name,\n * unless {@link AXMListRegisteredEntitiesQueryInput.entityFullName} is set — then only that entity is returned,\n * with property metadata and **master UI action** summaries (list + detail toolbars).\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMListRegisteredEntitiesQuery\n implements AXPQuery<AXMListRegisteredEntitiesQueryInput, AXMListRegisteredEntitiesQueryResult>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityResolver = inject(AXPEntityResolver);\n private readonly translation = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Query Execution ----\n\n async fetch(\n input?: AXMListRegisteredEntitiesQueryInput | null,\n ): AXPQueryFetchResultPromise<AXMListRegisteredEntitiesQueryResult> {\n try {\n const opts = input ?? {};\n const entries = await this.entityResolver.listAll();\n const targetFullName = opts.entityFullName?.trim();\n\n const sorted = [...entries].sort((a, b) => {\n const byModule = a.module.localeCompare(b.module);\n if (byModule !== 0) {\n return byModule;\n }\n return a.name.localeCompare(b.name);\n });\n\n const entities: AXMListRegisteredEntitiesQueryItem[] = [];\n\n for (const e of sorted) {\n if (targetFullName && e.fullName !== targetFullName) {\n continue;\n }\n\n const base: AXMListRegisteredEntitiesQueryItem = {\n module: e.module,\n name: e.name,\n fullName: e.fullName,\n };\n\n if (targetFullName) {\n const def = await this.entityResolver.get(e.module, e.name);\n const props = def?.properties?.map(toRegisteredEntityPropertySummary) ?? [];\n const masterUiActions = def ? axmSummarizeMasterUiActionsForAi(def, (k) => this.resolveEntityCopy(k)) : undefined;\n const quickSearchPaths = def\n ? await collectEntityQuickSearchFieldPaths(def, (m, n) => this.entityResolver.get(m, n))\n : undefined;\n entities.push({\n ...base,\n properties: props,\n ...(quickSearchPaths?.length ? { quickSearchPaths } : {}),\n ...(masterUiActions ? { masterUiActions } : {}),\n });\n } else {\n entities.push(base);\n }\n }\n\n let matchStatus: AXMListRegisteredEntitiesMatchStatus;\n if (!targetFullName) {\n matchStatus = 'catalog';\n } else if (entities.length === 0) {\n matchStatus = 'none';\n } else if (entities.length === 1) {\n matchStatus = 'single';\n } else {\n matchStatus = 'multiple';\n }\n\n return runtimeQuerySuccessObject({\n matchStatus,\n entities,\n });\n } catch (error) {\n return runtimeQueryFailure(\n error instanceof Error ? error.message : 'Unknown error occurred',\n );\n }\n }\n\n //#endregion\n\n //#region ---- Private helpers ----\n\n private resolveEntityCopy(text: string): string {\n try {\n return this.translation.translateSync(text);\n } catch {\n return text;\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;AA6EA;AAEA;AAEA,SAAS,iCAAiC,CAAC,IAAuB,EAAA;AAChE,IAAA,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS;AACpC,IAAA,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI;AAC3B,IAAA,MAAM,aAAa,GAAG,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,SAAS;AACvE,IAAA,MAAM,IAAI,GAAG,KAAK,EAAE,OAA8C;AAElE,IAAA,IAAI,YAAgC;AACpC,IAAA,IAAI,gBAAsC;AAE1C,IAAA,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE;QACvE,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE;IACtC;AAEA,IAAA,MAAM,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC;AAC/B,IAAA,IAAI,KAA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,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,8BAA8B,cADjB,MAAM,EAAA,CAAA,CAAA;;2FACnB,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
@@ -0,0 +1,122 @@
1
+ import { resolveCollectionSkip, resolveCollectionTake } from '@acorex-platform/framework-shared/runtime';
2
+ import { runtimeQuerySuccessCollection, runtimeQueryFailure } from '@acorex-platform/framework-shared/core';
3
+ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
4
+ import { RootConfig } from '@acorex-platform/module-platform-management-client/contracts';
5
+ import * as i0 from '@angular/core';
6
+ import { inject, Injectable } from '@angular/core';
7
+
8
+ //#region ----- Imports -----
9
+ //#endregion
10
+ //#region ----- Query -----
11
+ /**
12
+ * Lists {@link AXMQueryDefinitionEntityModel} rows from entity storage for designers and pickers.
13
+ * Optional {@link AXMListRegisteredQueriesQueryInput.resultType} / `queryName` / `kind` filters rows.
14
+ * Returns `kind: 'collection'` so select-editors can bind `options.dataSource` to this key.
15
+ */
16
+ class AXMListRegisteredQueriesQuery {
17
+ constructor() {
18
+ //#region ----- Services & Dependencies -----
19
+ this.entityService = inject(AXPEntityService);
20
+ }
21
+ //#endregion
22
+ //#region ----- Query Execution -----
23
+ async fetch(input) {
24
+ try {
25
+ const entityData = this.entityService
26
+ .withEntity(RootConfig.module.name, RootConfig.entities.queryDefinition.name)
27
+ .data();
28
+ const resultType = input?.resultType?.trim();
29
+ const queryName = input?.queryName?.trim();
30
+ const kind = this.normalizeKind(input?.kind);
31
+ const filters = [];
32
+ if (resultType) {
33
+ filters.push({ field: 'resultType', operator: { type: 'equal' }, value: resultType });
34
+ }
35
+ if (queryName) {
36
+ filters.push({ field: 'name', operator: { type: 'equal' }, value: queryName });
37
+ }
38
+ if (kind) {
39
+ filters.push({ field: 'kind', operator: { type: 'equal' }, value: kind });
40
+ }
41
+ const result = await entityData.query({
42
+ skip: 0,
43
+ take: 5000,
44
+ fields: ['id', 'name', 'catalogTitle', 'description', 'resultType', 'kind', 'binding', 'columns'],
45
+ ...(filters.length
46
+ ? { filter: { logic: 'and', filters } }
47
+ : {}),
48
+ });
49
+ let rows = (result.items ?? []).map((row) => this.mapRow(row, !!queryName));
50
+ if (kind) {
51
+ rows = rows.filter((row) => row.kind === kind);
52
+ }
53
+ rows = rows.sort((a, b) => a.title.localeCompare(b.title));
54
+ const skip = resolveCollectionSkip(input?.skip);
55
+ const take = resolveCollectionTake(input?.take);
56
+ const total = rows.length;
57
+ const items = rows.slice(skip, skip + take);
58
+ return runtimeQuerySuccessCollection({ items, total });
59
+ }
60
+ catch (error) {
61
+ return runtimeQueryFailure(error instanceof Error ? error.message : 'Unknown error occurred');
62
+ }
63
+ }
64
+ //#endregion
65
+ //#region ----- Helpers -----
66
+ mapRow(row, includeColumnNames) {
67
+ const binding = this.resolveBinding(row.binding);
68
+ const columns = this.resolveColumns(row.columns);
69
+ const kind = this.normalizeKind(row.kind);
70
+ const base = {
71
+ name: row.name,
72
+ title: row.catalogTitle ?? row.name,
73
+ ...(kind ? { kind } : {}),
74
+ ...(row.resultType ? { resultType: row.resultType } : {}),
75
+ ...(row.description ? { description: row.description } : {}),
76
+ ...(binding ? { binding } : {}),
77
+ ...(columns.length ? { columns } : {}),
78
+ ...(binding?.valueField ? { valueFieldName: binding.valueField } : {}),
79
+ ...(binding?.textField ? { textFieldName: binding.textField } : {}),
80
+ };
81
+ if (includeColumnNames && columns.length) {
82
+ base.columnNames = columns.map((c) => c.name).filter(Boolean);
83
+ }
84
+ return base;
85
+ }
86
+ normalizeKind(value) {
87
+ return value === 'value' || value === 'object' || value === 'collection' ? value : undefined;
88
+ }
89
+ resolveBinding(raw) {
90
+ if (!raw || typeof raw !== 'object') {
91
+ return undefined;
92
+ }
93
+ const record = raw;
94
+ const valueField = typeof record.valueField === 'string' ? record.valueField.trim() : '';
95
+ const textField = typeof record.textField === 'string' ? record.textField.trim() : '';
96
+ if (!valueField && !textField) {
97
+ return undefined;
98
+ }
99
+ return {
100
+ valueField: valueField || 'id',
101
+ textField: textField || 'title',
102
+ };
103
+ }
104
+ resolveColumns(raw) {
105
+ if (Array.isArray(raw)) {
106
+ return raw.filter((col) => !!col && typeof col === 'object' && typeof col.name === 'string');
107
+ }
108
+ if (raw && typeof raw === 'object' && Array.isArray(raw.definition)) {
109
+ return this.resolveColumns(raw.definition);
110
+ }
111
+ return [];
112
+ }
113
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMListRegisteredQueriesQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
114
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMListRegisteredQueriesQuery, providedIn: 'root' }); }
115
+ }
116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMListRegisteredQueriesQuery, decorators: [{
117
+ type: Injectable,
118
+ args: [{ providedIn: 'root' }]
119
+ }] });
120
+
121
+ export { AXMListRegisteredQueriesQuery };
122
+ //# sourceMappingURL=acorex-platform-module-platform-management-client-list-registered-queries.query-C-IfkTel.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-platform-management-client-list-registered-queries.query-C-IfkTel.mjs","sources":["../../../../libs/modules/platform-management/client/src/lib/features/queries/list-registered-queries.query.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport {\n resolveCollectionSkip,\n resolveCollectionTake,\n type AXPCollectionQuery,\n type AXPCollectionQueryInput,\n type AXPQueryCollectionFetchResultPromise,\n type AXPQueryKind,\n} from '@acorex-platform/framework-shared/runtime';\nimport {\n runtimeQueryFailure,\n runtimeQuerySuccessCollection,\n} from '@acorex-platform/framework-shared/core';\nimport type { AXPPropertyDefinition } from '@acorex-platform/framework-shared/domain';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { RootConfig } from '@acorex-platform/module-platform-management-client/contracts';\nimport type { AXMQueryDefinitionEntityModel } from '@acorex-platform/module-platform-management-client/contracts';\nimport type { AXDataSourceFilterOption } from '@acorex/cdk/common';\n\nimport { Injectable, inject } from '@angular/core';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport interface AXMListRegisteredQueriesQueryInput extends AXPCollectionQueryInput {\n /** Optional exact result DTO id (e.g. `AXPBarChartQueryResult`) to filter catalog rows. */\n resultType?: string;\n /** Optional exact query key (same string used in `options.dataSource` / `options.query`). */\n queryName?: string;\n /** Optional result kind (`value` | `object` | `collection`). Select pickers should pass `collection`. */\n kind?: AXPQueryKind;\n}\n\nexport interface AXMRegisteredQueryCatalogItem {\n name: string;\n title: string;\n kind?: AXPQueryKind;\n resultType?: string;\n description?: string;\n /** Collection select/lookup binding from query metadata. */\n binding?: { valueField: string; textField: string };\n /** Result field schema for object/collection queries. */\n columns?: AXPPropertyDefinition[];\n /** Flattened binding helpers for designers / AI. */\n valueFieldName?: string;\n textFieldName?: string;\n columnNames?: string[];\n}\n\nexport type AXMListRegisteredQueriesQueryResult = AXMRegisteredQueryCatalogItem;\n\n//#endregion\n\n//#region ----- Query -----\n\n/**\n * Lists {@link AXMQueryDefinitionEntityModel} rows from entity storage for designers and pickers.\n * Optional {@link AXMListRegisteredQueriesQueryInput.resultType} / `queryName` / `kind` filters rows.\n * Returns `kind: 'collection'` so select-editors can bind `options.dataSource` to this key.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMListRegisteredQueriesQuery\n implements AXPCollectionQuery<AXMListRegisteredQueriesQueryInput, AXMListRegisteredQueriesQueryResult>\n{\n //#region ----- Services & Dependencies -----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ----- Query Execution -----\n\n async fetch(\n input?: AXMListRegisteredQueriesQueryInput | null,\n ): AXPQueryCollectionFetchResultPromise<AXMListRegisteredQueriesQueryResult> {\n try {\n const entityData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.queryDefinition.name)\n .data<string, AXMQueryDefinitionEntityModel>();\n\n const resultType = input?.resultType?.trim();\n const queryName = input?.queryName?.trim();\n const kind = this.normalizeKind(input?.kind);\n const filters: AXDataSourceFilterOption[] = [];\n if (resultType) {\n filters.push({ field: 'resultType', operator: { type: 'equal' }, value: resultType });\n }\n if (queryName) {\n filters.push({ field: 'name', operator: { type: 'equal' }, value: queryName });\n }\n if (kind) {\n filters.push({ field: 'kind', operator: { type: 'equal' }, value: kind });\n }\n\n const result = await entityData.query({\n skip: 0,\n take: 5000,\n fields: ['id', 'name', 'catalogTitle', 'description', 'resultType', 'kind', 'binding', 'columns'],\n ...(filters.length\n ? { filter: { logic: 'and' as const, filters } }\n : {}),\n });\n\n let rows: AXMListRegisteredQueriesQueryResult[] = (result.items ?? []).map((row) =>\n this.mapRow(row, !!queryName),\n );\n if (kind) {\n rows = rows.filter((row) => row.kind === kind);\n }\n\n rows = rows.sort((a, b) => a.title.localeCompare(b.title));\n\n const skip = resolveCollectionSkip(input?.skip);\n const take = resolveCollectionTake(input?.take);\n const total = rows.length;\n const items = rows.slice(skip, skip + take);\n\n return runtimeQuerySuccessCollection({ items, total });\n } catch (error) {\n return runtimeQueryFailure(\n error instanceof Error ? error.message : 'Unknown error occurred',\n );\n }\n }\n\n //#endregion\n\n //#region ----- Helpers -----\n\n private mapRow(\n row: AXMQueryDefinitionEntityModel,\n includeColumnNames: boolean,\n ): AXMRegisteredQueryCatalogItem {\n const binding = this.resolveBinding(row.binding);\n const columns = this.resolveColumns(row.columns);\n const kind = this.normalizeKind(row.kind);\n const base: AXMRegisteredQueryCatalogItem = {\n name: row.name,\n title: row.catalogTitle ?? row.name,\n ...(kind ? { kind } : {}),\n ...(row.resultType ? { resultType: row.resultType } : {}),\n ...(row.description ? { description: row.description } : {}),\n ...(binding ? { binding } : {}),\n ...(columns.length ? { columns } : {}),\n ...(binding?.valueField ? { valueFieldName: binding.valueField } : {}),\n ...(binding?.textField ? { textFieldName: binding.textField } : {}),\n };\n if (includeColumnNames && columns.length) {\n base.columnNames = columns.map((c) => c.name).filter(Boolean);\n }\n return base;\n }\n\n private normalizeKind(value: unknown): AXPQueryKind | undefined {\n return value === 'value' || value === 'object' || value === 'collection' ? value : undefined;\n }\n\n private resolveBinding(raw: unknown): { valueField: string; textField: string } | undefined {\n if (!raw || typeof raw !== 'object') {\n return undefined;\n }\n const record = raw as { valueField?: unknown; textField?: unknown };\n const valueField = typeof record.valueField === 'string' ? record.valueField.trim() : '';\n const textField = typeof record.textField === 'string' ? record.textField.trim() : '';\n if (!valueField && !textField) {\n return undefined;\n }\n return {\n valueField: valueField || 'id',\n textField: textField || 'title',\n };\n }\n\n private resolveColumns(raw: unknown): AXPPropertyDefinition[] {\n if (Array.isArray(raw)) {\n return raw.filter(\n (col): col is AXPPropertyDefinition =>\n !!col && typeof col === 'object' && typeof (col as AXPPropertyDefinition).name === 'string',\n );\n }\n if (raw && typeof raw === 'object' && Array.isArray((raw as { definition?: unknown }).definition)) {\n return this.resolveColumns((raw as { definition: unknown }).definition);\n }\n return [];\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAAA;AAqDA;AAEA;AAEA;;;;AAIG;MAEU,6BAA6B,CAAA;AAD1C,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAyH1D,IAAA;;;IAnHC,MAAM,KAAK,CACT,KAAiD,EAAA;AAEjD,QAAA,IAAI;AACF,YAAA,MAAM,UAAU,GAAG,IAAI,CAAC;AACrB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI;AAC3E,iBAAA,IAAI,EAAyC;YAEhD,MAAM,UAAU,GAAG,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE;YAC5C,MAA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