@mohsinonxrm/pptb-fetchxml-studio 1.2.1 → 1.2.2-beta.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,319 @@
1
+ # Changelog
2
+
3
+ All notable changes to FetchXML Studio will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [1.2.2-beta.2] - 2026-06-16
11
+
12
+ ### ✨ Added
13
+
14
+ #### Tool-to-Tool (T2T) Invocation — Callee (prefill + return)
15
+
16
+ FetchXML Studio can now be *launched by* another PPTB tool, pre-populated with an inbound query, and hand a query back. Completes the round-trip alongside the existing caller support.
17
+
18
+ - **Inbound prefill** — On launch via T2T, FetchXML Studio reads its launch context and pre-populates the builder. Resolution priority is `fetchXml` → `viewRef` → `entityLogicalName`: a `fetchXml` string is loaded directly; a `viewRef` has its FetchXML retrieved from the referenced `savedquery`/`userquery`; and a bare `entityLogicalName` starts a fresh query on that entity. When `fetchXml` is present the root entity is **derived from the FetchXML itself** and any `entityLogicalName` hint is ignored, because a mismatched value would break this metadata-driven tool's lookups.
19
+ - **Return FetchXML button** — When launched as a callee, a "Return FetchXML" button appears in the FetchXML toolbar. It returns `{ fetchXml }` (the current editor-or-tree query) to the caller via `returnData()`, which the host resolves as the caller's `launchTool(...)` result. This is intentionally separate from the host-injected "Return to [Caller]" banner, which only navigates back and resolves the caller's promise with `null`.
20
+ - **`pptb.config.json`** — Added the `fetchxml` capability tag (for discovery via `findToolsByCapability`) and a `returnTopic` describing the `{ fetchXml }` return shape. Relaxed the prefill contract so `entityLogicalName` is optional/hint-only.
21
+
22
+ ### 🏗️ Technical
23
+
24
+ - `src/features/fetchxml/api/invocation.ts` — Added callee helpers: `getLaunchContext()`, `resolveLaunchPrefill(context)` (returns a `{ kind: "fetchxml" | "entity" }` action following the `fetchXml` → `viewRef` → `entityLogicalName` priority; resolves `viewRef` by reusing the `dataverseAPI.queryData` view-read route filtered to a single record), `returnDataToInvokingTool(data)`, and `returnFetchXmlToInvokingTool(fetchXml)`. Added `FetchXmlStudioLaunchPrefill` type and `LaunchPrefillAction` union.
25
+ - `src/shared/hooks/useLaunchContext.ts` — New hook. Calls `getLaunchContext()` once on mount and exposes `{ loading, isCallee, context }` so detection happens in one place.
26
+ - `src/app/AppShell.tsx` — Consumes the prefill exactly once on launch (loads incoming FetchXML via `builder.loadFetchXml`), and passes `isCallee` to `PreviewTabs`.
27
+ - `src/features/fetchxml/ui/RightPane/PreviewTabs.tsx` — Added `isCallee?` prop and a `ReturnFetchXmlButton` (gated on `isCallee`) rendered next to Execute; uses a `getCurrentXml()` helper that returns the live editor buffer when in editor mode.
28
+
29
+ ### 🔧 Changed
30
+
31
+ - **"Send to Tool" button visibility** — The caller button is now hidden entirely unless at least one target tool is configured under Settings → Tool Integration (previously it rendered as a disabled button with a tooltip). The two T2T toolbar actions are now strictly capability-gated and never change meaning by mode: **Return FetchXML** shows only when launched as a callee (`isCallee`); **Send to Tool** shows only when targets are configured.
32
+
33
+ ## [1.2.2-beta.1] - 2026-05-25
34
+
35
+ ### ✨ Added
36
+
37
+ #### Tool-to-Tool (T2T) Invocation — Caller
38
+
39
+ FetchXML Studio can now send the active query to any other PPTB tool that accepts a FetchXML prefill payload. Requires **PPTB host ≥ 1.2.2**.
40
+
41
+ - **Send to Tool button** — A new "Send to Tool" button appears in the toolbar (alongside Save View) whenever the PPTB host exposes the `toolboxAPI.invocation` API. Three interaction modes depending on how many target tools are configured:
42
+ - *No tools configured* — Button is disabled with a tooltip pointing to Settings → Tool Integration.
43
+ - *One tool configured* — Single button; click launches the tool directly.
44
+ - *Multiple tools configured* — Dropdown menu listing all configured tools; click an item to launch.
45
+ - **Settings → Tool Integration section** — New section in the Settings drawer to manage the list of target tool npm package IDs (e.g. `@linked365/pptb-bulk-data-studio`). Supports add (text input + Enter/Add button) and remove (× button per item). The list is persisted via `toolboxAPI.settings` alongside other display preferences.
46
+ - **Active connection forwarding** — The caller automatically retrieves the currently active Dataverse connection and forwards its ID as `primaryConnectionId` when launching the target tool, so the callee opens against the same environment.
47
+ - **`pptb.config.json`** — Added PPTB callee contract file at the repository root. Declares the prefill schema this tool accepts when *receiving* a T2T invocation from another tool (see [Callee Contract](#-callee-contract-pptbconfigjson) in the README). `viewRef` is modelled as a Dataverse EntityReference: required fields `id` (UUID string) and `entityLogicalName` (enum: `"savedquery"` | `"userquery"`).
48
+
49
+ ### 🏗️ Technical
50
+
51
+ - `src/features/fetchxml/api/invocation.ts` — New module. Defines a local `InvocationAPI` interface (mirrors the PPTB host API not yet in `@pptb/types`) and exposes `isT2TSupported()` and `sendFetchXmlToTool(targetToolId, { fetchXml, entityLogicalName })`.
52
+ - `src/features/fetchxml/ui/Toolbar/SendToToolButton.tsx` — New toolbar component. Handles the disabled / single / multi-tool rendering variants; calls `sendFetchXmlToTool`; surfaces errors via `toolboxAPI.utils.showNotification`.
53
+ - `src/features/fetchxml/model/displaySettings.ts` — Added `targetTools: string[]` (default `[]`) to `DisplaySettings` interface and `defaultDisplaySettings`.
54
+ - `src/features/fetchxml/ui/Settings/SettingsDrawer.tsx` — Added Tool Integration section with add/remove UI. Added `Input`, `Field`, `Add20Regular`, `Dismiss16Regular`, `PlugConnected20Regular` to imports.
55
+ - `src/features/fetchxml/ui/RightPane/PreviewTabs.tsx` — Added `sendToToolButton?: ReactNode` prop; rendered unconditionally (all tabs) next to `saveViewButton`.
56
+ - `src/app/AppShell.tsx` — Imports `SendToToolButton` + `isT2TSupported`; passes `sendToToolButton` prop to `PreviewTabs` gated on `isT2TSupported()`.
57
+ - `package.json` — `features.minAPI` bumped from `1.2.0` → `1.2.2` to reflect the new PPTB host requirement. `scheduler` added to `devDependencies` (required peer dep of `@fluentui/react-context-selector` that was missing from the install tree).
58
+
59
+ #### Packaging fixes (resolves #33)
60
+
61
+ - **`icon` path corrected** — `"icon"` field in `package.json` was missing the `icons/` directory prefix (`"icon-insider.svg"` → `"icons/icon-insider.svg"`). Icon was not resolvable by PPTB at install time.
62
+ - **`files` array expanded** — Added `"icons"`, `"index.html"`, `"LICENSE"`, `"README.md"`, `"CHANGELOG.md"`, `"SECURITY.md"` alongside the existing `"dist"` and `"npm-shrinkwrap.json"` entries. Previously the `icons/` folder (referenced by the `"icon"` field) and all root-level docs were absent from the published package.
63
+ - **Production source maps disabled** — Added `sourcemap: false` to `vite.config.ts` `build` options. Monaco worker source maps were silently adding ~17 MB to the package; disabling them brings the published size down to ~3–4 MB.
64
+
65
+ ---
66
+
67
+ ## [1.2.1] - 2026-04-07
68
+
69
+ ### ✨ Added
70
+
71
+ - **Copy button in editor mode** — The FetchXML editor toolbar now includes a Copy button when in editor mode, making it consistent with the read-only toolbar. Previously Copy was only available when the editor was not in edit mode.
72
+
73
+ ### 🔧 Fixed
74
+
75
+ - **Results grid column overlap** — Column widths are now estimated dynamically from header text (capped at 400 px) so adjacent columns no longer overlap on first render. All cells use `TableCellLayout truncate` for clean overflow.
76
+ - **Results grid header/row misalignment** — Removed a stray CSS class from `DataGridBody` that was causing header and row widths to drift out of sync when the grid had overflowing content.
77
+ - **Alias validation in property editors** — Typing an invalid alias character (space, hyphen, special character) in `AttributeEditor` or `LinkEntityEditor` now sanitizes the value in real time: invalid characters are stripped, and a leading digit is prefixed with `_`.
78
+ - **Alias validation in parser** — When parsing FetchXML (both *Parse to Tree* and *Execute*), invalid aliases are now automatically sanitized. A parse warning describes the correction (e.g. *"Alias 'this is id' had invalid characters and was corrected to 'thisisid'."*) instead of silently forwarding the invalid alias to Dataverse where it would cause an API error.
79
+ - **Execute blocked when alias warnings are present** — Clicking Execute in editor mode now validates the XML completely before sending it to Dataverse. If parse warnings exist (e.g. an invalid alias that wasn't auto-corrected via *Parse to Tree*), execution is blocked and the warning is surfaced in a message bar above the editor with a hint to use *Parse to Tree* to auto-correct. Previously the bad alias was silently sent to Dataverse and the error appeared in the Results tab.
80
+ - **Editor state preserved across tab switches** — Switching from the FetchXML tab to Results or LayoutXML and back no longer resets editor mode or discards the edited XML. The editor component is now always mounted (hidden via `display: none` when not active) so Monaco state — editor mode toggle, cursor position, edit buffer — is fully preserved.
81
+ - **Validate contradictory messages** — *Validate* no longer shows both a "Valid" success message and warnings simultaneously. When warnings are present, validate now shows each warning plus an "Action required" notice and stops — the "Valid" success message is only shown when there are zero warnings.
82
+ - **Parse to Tree corrections shown as informational** — Auto-corrected alias warnings from *Parse to Tree* are now shown with `intent="info"` (blue) rather than `intent="warning"` (yellow), correctly communicating that the tool has already resolved the problem.
83
+ - **Execute API errors surfaced** — Dataverse API errors that occur during query execution are now captured and displayed in a message bar in the Results tab. Previously they were only visible in the browser console.
84
+
85
+ ### 🏗️ Technical
86
+
87
+ - Added `src/features/fetchxml/model/aliasUtils.ts` — `isValidAlias()` and `sanitizeAlias()` shared utilities enforcing the Dataverse alias constraint (`[A-Za-z_][A-Za-z0-9_]*`).
88
+ - `fetchxmlParser.ts` — `parseAttribute` and `parseLinkEntity` now import `sanitizeAlias`; invalid aliases are corrected in place and described in the parse warning rather than propagated as-is.
89
+ - `PreviewTabs.tsx` — `FetchXmlEditor` is always mounted; `handleExecute` blocks on parse warnings; navigating back to the FetchXML tab clears any stale editor validation error banner.
90
+ - `AppShell.tsx` — `handleExecute` accepts an optional `xmlOverride` (used when editor mode is active); `executeError` state threads Dataverse API errors back to the `PreviewTabs` message bar.
91
+
92
+ ---
93
+
94
+ ## [1.2.0] - 2026-04-03
95
+
96
+ ### ✨ Added
97
+
98
+ #### Query Scope Settings
99
+ - **Entity Scope Mode** — New setting (persisted across sessions) to control which entities appear in the entity dropdown:
100
+ - **Publisher + Solution** — Select a publisher, then narrow to specific solutions; only entities belonging to those solutions are shown
101
+ - **Solution Only** — Skip the publisher step and pick solutions directly
102
+ - **All Entities** — Show every entity in the environment (no solution filter)
103
+ - **Advanced Find Only toggle** — When enabled (default), entities and attributes are limited to those marked `IsValidForAdvancedFind = true`, matching the classic Advanced Find behavior. Disabling shows all entities and attributes — including system and developer-only tables — useful for building admin or integration queries. The filter is applied locally so toggling is instant with no additional API call.
104
+ - Scope mode and Advanced Find preference are persisted individually via `toolboxAPI.settings` and survive across sessions.
105
+
106
+ #### Monaco Editor — Local Bundling
107
+ - Monaco is now fully bundled in `dist/` instead of being fetched from a CDN at runtime.
108
+ - Eliminates CSP errors and ensures line numbers, syntax highlighting, and all editor features work correctly in the PPTB host environment without network access to external CDNs.
109
+
110
+ ### 🔧 Fixed
111
+
112
+ - **Internal solutions in Solution-only mode** — Solutions from `isreadonly = true` publishers (Microsoft, system publishers) are now excluded from the solution picker, consistent with what Publisher + Solution mode shows. Previously some Microsoft-owned visible solutions appeared in the list.
113
+ - **Parse-to-tree no longer resets the entity** — Pasting FetchXML into the editor and clicking "Parse to Tree" no longer wipes the selected entity. The validation that auto-clears the entity selection now only fires when there is an active solution filter in place (i.e. specific solutions have been selected) and the entity has dropped out of scope — not when the entity was set programmatically via the XML editor.
114
+ - **Entity list cache race condition** — `loadAllEntities` no longer accepts an `advancedFindOnly` parameter. It always fetches all entities from the server (no `$filter=IsValidForAdvancedFind eq true`). The Advanced Find filter is now applied locally in the EntitySelector `memo`. This eliminates a bug where an earlier `advancedFindOnly=true` load could poison the cache and cause subsequent `advancedFindOnly=false` calls to silently return the wrong (filtered) set.
115
+ - **Privilege check console noise** — `checkPrivilegeByName` errors for privileges that don't exist in the environment (e.g. `prvDeleteGitorganization` for system tables) are now logged as `console.warn` instead of `console.error`. The UI behavior is unchanged.
116
+ - **CSP exception** — Removed the invalid `*.crm*.dynamics.com` wildcard from `cspExceptions` (browsers reject multi-depth subdomain wildcards). The only `connect-src` exception kept is `https://*.dynamics.com`.
117
+
118
+ ### 🏗️ Technical
119
+
120
+ - `useAccessMode` preloads only the AF-valid entity metadata cache (`allEntityMetadataCache`) on startup — used by publisher-solution and solution-only modes. The all-entities cache is populated lazily the first time "All Entities" scope mode is used.
121
+ - `loadAllEntities` / `useLazyMetadata.loadEntities` signatures simplified (no `advancedFindOnly` param — always fetches everything).
122
+ - `vite.config.ts` — `manualChunks` splits Monaco into its own chunk (`monaco-editor-*.js`, ~3.7 MB; `monaco-editor-*.css`, ~145 kB).
123
+ - TypeScript strict compile: **zero errors** (`tsc -b --noEmit`).
124
+
125
+ ---
126
+
127
+ ## [1.1.0] - 2026-03-23
128
+
129
+ ### ⬆️ Upgraded
130
+
131
+ - **`@pptb/types` 1.0.7 → 1.2.0** — now the authoritative source for all PPTB host API types (`window.dataverseAPI`, `window.toolboxAPI`). Added to `tsconfig.app.json` `types` array so global augmentations apply project-wide without per-file triple-slash references.
132
+ - **`features.minAPI`** set to `"1.2.0"` in `package.json` to enforce the correct PPTB host version at install time.
133
+
134
+ ### ✨ Added
135
+
136
+ #### Native File Save Dialog
137
+ - Both export paths (local ExcelJS export and Dataverse `ExportToExcel` action) now use `window.toolboxAPI.fileSystem.saveFile` when running inside the PPTB desktop host, presenting a native OS save-file dialog instead of a forced browser blob download.
138
+ - Graceful fallback to browser blob/anchor download when running in standalone or dev context (i.e. when `window.toolboxAPI` is not available).
139
+
140
+ #### Connection Environment Awareness
141
+ - `PptbContext` now exposes `environment?: "Dev" | "Test" | "UAT" | "Production"` sourced from the active `DataverseConnection`.
142
+ - Subscribes to `connection:updated`, `connection:created`, and `connection:deleted` PPTB events to keep the field in sync dynamically.
143
+
144
+ #### Package Manifest Hardening
145
+ - Added top-level `"icon"` field pointing to `icons/icon.svg` (replacing deprecated `configurations.iconUrl`).
146
+ - `"features"` block added: `{ "multiConnection": "none", "minAPI": "1.2.0" }`.
147
+ - `cspExceptions` migrated from plain-string arrays to the required object format with `domain` + `exceptionReason` fields (+ `optional: true` on style-src).
148
+ - Added `"validate": "pptb-validate"` npm script for pre-publish manifest validation.
149
+ - Added `"finalize-package": "npm run build && npm shrinkwrap"` convenience script.
150
+
151
+ ### ♻️ Refactored
152
+
153
+ #### `pptbClient.ts`
154
+ - Removed the entire hand-written `declare global { interface Window { dataverseAPI?: { ... } } }` block (~60 lines). The `window.dataverseAPI` global is now typed entirely by `@pptb/types`.
155
+ - Added local `DataverseFetchXmlResponse` interface to capture OData response annotations beyond what `@pptb/types` `FetchXmlResult` declares (`@Microsoft.Dynamics.CRM.totalrecordcount`, `morerecords`, `pagingcookie`, `totalrecordcountlimitexceeded`). These are OData wire annotations returned directly by Dataverse — not fabricated by PPTB — so the cast is safe at runtime.
156
+ - `downloadBase64File()` changed from `void` to `async Promise<void>`; uses `fileSystem.saveFile` when available.
157
+
158
+ #### `usePptbContext.ts`
159
+ - Removed the entire hand-written `declare global { interface Window { toolboxAPI?: { ... } } }` block. The `window.toolboxAPI` global is now typed entirely by `@pptb/types`.
160
+ - `PptbContext` interface: removed legacy `organizationId?: string` (not present in `DataverseConnection` v1.2.0 types); replaced with `environment?: "Dev" | "Test" | "UAT" | "Production"`.
161
+
162
+ #### `excelExport.ts`
163
+ - `downloadExcelFile()` changed from `void` to `async Promise<void>`; uses `fileSystem.saveFile` when available.
164
+
165
+ #### `AppShell.tsx`
166
+ - Both download call sites updated with `await` to match the new async signatures.
167
+
168
+ ### 🔧 Technical
169
+
170
+ - TypeScript strict compile: **zero errors** (`tsc -b --noEmit`).
171
+ - `pptb-validate`: **✔ Validation passed**.
172
+
173
+ ---
174
+
175
+ ## [1.0.6] - 2026-01-14
176
+
177
+ ### ✨ Added
178
+
179
+ #### Select Attributes Dialog (#12)
180
+ - **Bulk Attribute Selection**: New "Select Attributes" modal dialog for efficient multi-attribute selection
181
+ - Accessible from entity and link-entity context menus in the tree view
182
+ - Works on root entity, link-entities, and nested link-entities at any level
183
+ - **Smart Selection Grid**: DataGrid showing all available entity attributes
184
+ - Three sortable columns: Logical Name, Display Name, and Data Type
185
+ - Pre-selects currently selected attributes with checkboxes
186
+ - Multi-select support for bulk add/remove operations
187
+ - **Search & Filter**: Integrated SearchBox for quick attribute filtering
188
+ - Filters across all columns (logical name, display name, data type)
189
+ - Real-time filtering as you type
190
+ - **Fixed Headers**: Column headers remain visible while scrolling through attributes
191
+ - **Confirmation Required**: Changes only applied when user clicks Apply button
192
+ - Cancel button discards changes without affecting the tree
193
+ - **Smart Updates**: Intelligently adds new attributes and removes deselected ones
194
+ - Preserves existing attributes that remain selected
195
+ - Maintains attribute order and properties
196
+ - **Performance**: Leverages metadata cache for fast attribute loading
197
+ - Falls back to API loading if attributes not cached
198
+ - Shows only attributes valid for Advanced Find
199
+
200
+ ### 🔧 Technical
201
+
202
+ - Added `SelectAttributesDialog` component with FluentUI DataGrid
203
+ - New `UPDATE_ATTRIBUTES` action in builderStore for bulk attribute operations
204
+ - Enhanced TreeView with dialog state management and attribute loading
205
+ - Integrated with existing metadata caching system
206
+
207
+ ## [1.0.0] - 2024-12-15
208
+
209
+ ### 🎉 Initial Release
210
+
211
+ FetchXML Studio v1.0.0 - A powerful FetchXML query builder for Power Platform ToolBox.
212
+
213
+ ### ✨ Features
214
+
215
+ #### Query Builder
216
+ - Tree-based visual query builder with hierarchical FetchXML structure
217
+ - Full entity, attribute, filter, order, and link-entity support
218
+ - Context-aware properties panel for each node type
219
+ - Nested filter groups with AND/OR logic
220
+ - Support for all FetchXML operators (60+ operators)
221
+ - Aggregate queries with groupby and distinct
222
+ - Query hints for performance optimization
223
+
224
+ #### Relationships & Joins
225
+ - Relationship picker with 1:N, N:1, N:N categorization
226
+ - Inner and outer join support
227
+ - Filter link-entity for any/all/not any/not all scenarios
228
+ - Value-of conditions for cross-entity comparisons
229
+ - Entity name conditions for outer join filtering
230
+
231
+ #### Results Grid
232
+ - Virtualized DataGrid for large datasets (react-window)
233
+ - Rich cell rendering for lookups, option sets, dates, currency
234
+ - Multi-column sorting (click + Shift+click)
235
+ - Row selection (single and multi-select)
236
+ - Resizable and reorderable columns
237
+ - Formatted values with raw value toggle
238
+
239
+ #### FetchXML Editor
240
+ - Monaco editor with XML syntax highlighting
241
+ - Bi-directional editing (visual ↔ XML)
242
+ - Parse FetchXML to visual builder
243
+ - Copy to clipboard
244
+ - LayoutXML preview tab
245
+
246
+ #### Views
247
+ - Load system and personal views
248
+ - Optimized view execution via SavedQuery/UserQuery APIs
249
+ - Save queries as personal views
250
+ - Update existing views
251
+ - Solution-aware save (add to solution)
252
+
253
+ #### Data Operations
254
+ - Export to Excel with native data types
255
+ - Delete selected records
256
+ - Bulk delete jobs (async)
257
+ - Run on-demand workflows on selection
258
+ - Batch progress tracking with ETA
259
+
260
+ #### User Experience
261
+ - Dark/Light theme support (follows PPTB theme)
262
+ - Lazy metadata loading
263
+ - Intelligent caching (per-session)
264
+ - Resizable split panes
265
+ - Keyboard shortcuts (Ctrl+Enter to execute)
266
+
267
+ #### Security
268
+ - Privilege-aware operations
269
+ - Export/Delete privilege checks
270
+ - Bulk delete privilege validation
271
+ - Workflow execution privilege checks
272
+
273
+ ### 🏗️ Technical
274
+
275
+ - Built with React 19 and TypeScript 5.9
276
+ - Fluent UI v9 components
277
+ - Monaco Editor integration
278
+ - ExcelJS for native Excel export
279
+ - Vite build tooling
280
+ - Power Platform ToolBox integration via @pptb/types
281
+
282
+ ### 📚 Documentation
283
+
284
+ - Comprehensive README with feature overview
285
+ - Debug logging system documentation
286
+ - Project structure guide
287
+ - Contributing guidelines
288
+
289
+ ---
290
+
291
+ ## Development History
292
+
293
+ ### Pre-release commits (dev branch)
294
+
295
+ - `feat: Beta release enhancements - Settings, Export, and UX improvements`
296
+ - `feat(preview): add LayoutXML tab to preview pane`
297
+ - `feat(commands): add record action commands - delete, bulk delete, workflow`
298
+ - `feat(columns): Add/Edit Columns panels with related entity support`
299
+ - `feat(export): add Export to Excel with status feedback and privilege check`
300
+ - `feat(paging): fix paging with cookies and page size support`
301
+ - `feat(grid): multi-entity metadata & column display name fixes`
302
+ - `feat(builder): Sprint 1 - Foundation & Layout improvements`
303
+ - `feat(save): implement Save View functionality`
304
+ - `feat(sort): Add multi-column sort with FetchXML integration`
305
+ - `feat(results): Add Column from Results Grid`
306
+ - `feat(views): Load view LayoutXML for column configuration`
307
+ - `feat(layout): Add column resize and reorder`
308
+ - `feat(layout): Add LayoutXML foundation`
309
+ - `feat(filter): Add filter link-entity support for any/not any/all scenarios`
310
+ - `feat(condition): Add valueof cross-entity comparison`
311
+ - `feat(condition): Add valueof same-row column comparison`
312
+ - `feat(condition): Add entityname support for outer join filtering`
313
+ - `feat(views): Add Load View picker and optimized view execution`
314
+ - `feat(parser): Add FetchXML parser with Monaco editor dialog`
315
+ - `feat: Implement Phases 1-4 - DataGrid UI polish`
316
+ - `feat: add filter consistency, cascading validation, and global metadata caching`
317
+ - `feat(entity-selector): implement advanced filtering with publisher/solution multiselect`
318
+ - `feat(ui): add resizable panes with visual grip indicators and command bar`
319
+ - `Initial commit - setup main branch`
package/README.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  A powerful, modern FetchXML query builder and data explorer for [Power Platform ToolBox](https://github.com/PowerPlatformToolBox/desktop-app). Inspired by the XrmToolBox FetchXML Builder, reimagined with React 18, Fluent UI v9, and seamless Dataverse integration.
4
4
 
5
- ![Version](https://img.shields.io/badge/version-1.2.1-blue)
5
+ ![Version](https://img.shields.io/badge/version-1.2.2--beta.1-orange)
6
6
  ![React](https://img.shields.io/badge/React-18-61DAFB?logo=react)
7
7
  ![TypeScript](https://img.shields.io/badge/TypeScript-5.9-3178C6?logo=typescript)
8
8
  ![Fluent UI](https://img.shields.io/badge/Fluent%20UI-v9-0078D4?logo=microsoft)
9
- ![PPTB Types](https://img.shields.io/badge/%40pptb%2Ftypes-1.2.0-orange)
9
+ ![PPTB Types](https://img.shields.io/badge/%40pptb%2Ftypes-1.2.2--beta.1-orange)
10
10
 
11
11
  ## ✨ Features
12
12
 
@@ -63,8 +63,13 @@ A powerful, modern FetchXML query builder and data explorer for [Power Platform
63
63
  - **Query scope settings** — Control which entities appear in the entity picker: *Publisher + Solution* (full filter), *Solution Only*, or *All Entities* (no filter). Persisted across sessions.
64
64
  - **Advanced Find Only toggle** — When on (default), limits entities and attributes to those marked `IsValidForAdvancedFind = true`. Disable to access all entities including system and developer tables. Filter is applied locally — toggling is instant with no additional API call.
65
65
 
66
- ### 🔒 Privilege-Aware
67
- - **Security checks** — Validates user privileges before every destructive or restricted operation
66
+ ### � Tool-to-Tool (T2T) Integration
67
+ - **Send to Tool button** — Launch any other PPTB tool directly from FetchXML Studio, pre-loading it with the current FetchXML query and active Dataverse connection. Appears automatically when running on PPTB host ≥ 1.2.2.
68
+ - **Multi-tool picker** — Configure one or more target tools in Settings → Tool Integration. When multiple tools are configured, the button shows a dropdown menu.
69
+ - **Active connection forwarding** — The active Dataverse connection is forwarded automatically so the target tool opens against the same environment.
70
+ - **Inbound prefill** — FetchXML Studio also accepts incoming T2T invocations from other tools (see [Callee Contract](#-callee-contract-pptbconfigjson) below).
71
+
72
+ ### �🔒 Privilege-Aware
68
73
  - **Export privilege check** — Only shows Dataverse export option if user has access
69
74
  - **Delete privilege check** — Validates entity-specific delete permissions before enabling delete actions
70
75
  - **Bulk delete privilege check** — Validates `prvBulkDelete` before surfacing bulk delete
@@ -75,7 +80,7 @@ A powerful, modern FetchXML query builder and data explorer for [Power Platform
75
80
 
76
81
  ```
77
82
  ┌─────────────────────────────────────────────────────────────────────────┐
78
- │ [Entity Selector ▼] [Load View ▼] [Save View] [⚙ Settings]│
83
+ │ [Entity Selector ▼] [Load View ▼] [Save View] [Send to Tool ▼] [⚙] │
79
84
  ├──────────────────────┬──────────────────────────────────────────────────┤
80
85
  │ │ [FetchXML] [LayoutXML] [Results] [▶ Execute]│
81
86
  │ Query Tree ├──────────────────────────────────────────────────┤
@@ -169,7 +174,7 @@ disableAllDebug();
169
174
  | **Monaco Editor** | 0.54 | VS Code XML editor for FetchXML authoring |
170
175
  | **react-window** | 2 | Virtualized list rendering for large datasets |
171
176
  | **ExcelJS** | 4.4 | Native `.xlsx` generation with typed cells |
172
- | **@pptb/types** | 1.2.0 | Power Platform ToolBox host API types (`window.dataverseAPI`, `window.toolboxAPI`) |
177
+ | **@pptb/types** | 1.2.2-beta.1 | Power Platform ToolBox host API types (`window.dataverseAPI`, `window.toolboxAPI`) |
173
178
 
174
179
  ## 📁 Project Structure
175
180
 
@@ -182,7 +187,8 @@ src/
182
187
  │ │ ├── pptbClient.ts # window.dataverseAPI wrapper (all Dataverse ops)
183
188
  │ │ ├── dataverseMetadata.ts # Lazy metadata loading with cache + dedup
184
189
  │ │ ├── excelExport.ts # Local ExcelJS export with native types
185
- │ │ └── formattedValues.ts # OData @FormattedValue annotation helpers
190
+ │ │ ├── formattedValues.ts # OData @FormattedValue annotation helpers
191
+ │ │ └── invocation.ts # T2T caller API (isT2TSupported, sendFetchXmlToTool)
186
192
  │ ├── model/
187
193
  │ │ ├── nodes.ts # FetchXML node TypeScript definitions
188
194
  │ │ ├── fetchxml.ts # FetchXML XML generation
@@ -200,7 +206,8 @@ src/
200
206
  │ │ └── PropertiesPanel/
201
207
  │ │ └── editors/ # Node-specific property editors
202
208
  │ ├── RightPane/ # Monaco editor, LayoutXML viewer, results grid
203
- │ ├── Toolbar/ # Entity selector, load view picker, save button
209
+ │ ├── Toolbar/ # Entity selector, load view picker, save button,
210
+ │ │ # send-to-tool button
204
211
  │ ├── Dialogs/ # Save view, select attributes, delete, bulk
205
212
  │ │ # delete, workflow picker, solution picker
206
213
  │ └── Settings/ # Settings drawer (display preferences)
@@ -238,6 +245,64 @@ src/
238
245
  | Filter link-entity (any/all) | ✅ |
239
246
  | Query hints | ✅ |
240
247
 
248
+ ## 🔗 Callee Contract (`pptb.config.json`)
249
+
250
+ FetchXML Studio declares a PPTB [Inter-Tool Invocation](https://github.com/PowerPlatformToolBox/desktop-app) callee contract in `pptb.config.json` at the repository root, and declares the `fetchxml` capability so callers can discover it. Any other PPTB tool can launch FetchXML Studio and pre-populate it by passing a prefill payload that matches the following schema:
251
+
252
+ ```json
253
+ {
254
+ "fetchXml": "<fetch><entity name=\"account\">...</entity></fetch>"
255
+ }
256
+ ```
257
+
258
+ | Field | Type | Required | Description |
259
+ |---|---|---|---|
260
+ | `fetchXml` | `string` | One of these three | Full serialized FetchXML query string. The root entity is parsed from this. |
261
+ | `viewRef` | `object` | One of these three | EntityReference to an existing view. The FetchXML is retrieved from the view record. |
262
+ | `entityLogicalName` | `string` | One of these three | Root entity logical name (e.g. `"account"`). Starts a fresh query on that entity. **Ignored when `fetchXml` is present** — the root entity is then derived from the FetchXML, since a mismatched value would break this metadata-driven tool's lookups. |
263
+ | `viewRef.id` | `string` (uuid) | Required if viewRef | GUID of the view record |
264
+ | `viewRef.entityLogicalName` | `"savedquery"` \| `"userquery"` | Required if viewRef | Dataverse entity logical name — `savedquery` = system/public view, `userquery` = personal view |
265
+
266
+ Resolution priority at runtime: **`fetchXml` → `viewRef` → `entityLogicalName`**. With no prefill (a standalone launch) the tool opens empty.
267
+
268
+ ### Returning a query to the caller
269
+
270
+ When FetchXML Studio is launched by another tool, a **Return FetchXML** button appears in the FetchXML toolbar. Clicking it returns the current query to the caller:
271
+
272
+ ```json
273
+ { "fetchXml": "<fetch>...</fetch>" }
274
+ ```
275
+
276
+ The caller receives this as the resolved value of `launchTool(...)`. This is distinct from the host-injected "Return to [Caller]" banner, which simply navigates back and resolves the caller's promise with `null` (no data).
277
+
278
+ ### Sending a query from another PPTB tool
279
+
280
+ To launch FetchXML Studio from your own PPTB tool with a pre-loaded query:
281
+
282
+ ```typescript
283
+ const result = await window.toolboxAPI.invocation.launchTool(
284
+ "@mohsinonxrm/pptb-fetchxml-studio",
285
+ { fetchXml: "<fetch><entity name=\"account\"><attribute name=\"name\"/></entity></fetch>" },
286
+ { primaryConnectionId: connection?.id ?? null },
287
+ );
288
+
289
+ // If the user clicks "Return FetchXML", result is { fetchXml }.
290
+ // If they close the window or click the host's back banner, result is null.
291
+ const editedFetchXml = (result as { fetchXml?: string } | null)?.fetchXml;
292
+ ```
293
+
294
+ ### Configuring outbound targets (Send to Tool)
295
+
296
+ To send FetchXML Studio queries *to* another tool:
297
+
298
+ 1. Open **Settings** (⚙ icon in the toolbar)
299
+ 2. Scroll to **Tool Integration**
300
+ 3. Enter the target tool's npm package ID (e.g. `@linked365/pptb-bulk-data-studio`) and click **Add**
301
+
302
+ The "Send to Tool" button will appear in the toolbar. Multiple tools show a dropdown picker.
303
+
304
+ ---
305
+
241
306
  ## 🤝 Contributing
242
307
 
243
308
  Contributions are welcome! Please feel free to submit a Pull Request.
package/SECURITY.md ADDED
@@ -0,0 +1,13 @@
1
+ # Security Policy
2
+
3
+ ## Reporting a Vulnerability
4
+
5
+ Please do **not** open a public issue.
6
+ Use GitHub Security Advisories: <https://github.com/mohsinonxrm/pptb-mxrm-fetchxml-studio/security/advisories/new>
7
+
8
+ ## Scope
9
+
10
+ - Authentication flows
11
+ - Token handling
12
+ - Dataverse request logging
13
+ - Dependency vulnerabilities