@mohsinonxrm/pptb-fetchxml-studio 1.0.0 → 1.0.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/LICENSE +661 -0
- package/README.md +1 -1
- package/dist/assets/index-DD9fzkbz.js +232 -0
- package/dist/index.html +70 -0
- package/index.html +0 -1
- package/npm-shrinkwrap.json +6329 -0
- package/package.json +95 -51
- package/CHANGELOG.md +0 -120
- package/eslint.config.js +0 -23
- package/public/vite.svg +0 -1
- package/src/app/AppShell.tsx +0 -1733
- package/src/assets/20px-Microsoft_Office_Excel_(2025/342/200/223present).svg.png +0 -0
- package/src/assets/react.svg +0 -1
- package/src/features/fetchxml/api/dataverseMetadata.ts +0 -192
- package/src/features/fetchxml/api/excelExport.ts +0 -318
- package/src/features/fetchxml/api/formattedValues.ts +0 -107
- package/src/features/fetchxml/api/pptbClient.ts +0 -2635
- package/src/features/fetchxml/model/displaySettings.ts +0 -18
- package/src/features/fetchxml/model/fetchxml.ts +0 -346
- package/src/features/fetchxml/model/fetchxmlIntellisense.ts +0 -583
- package/src/features/fetchxml/model/fetchxmlParser.ts +0 -708
- package/src/features/fetchxml/model/layoutxml.ts +0 -372
- package/src/features/fetchxml/model/nodes.ts +0 -255
- package/src/features/fetchxml/model/operators.ts +0 -624
- package/src/features/fetchxml/model/treeUtils.ts +0 -174
- package/src/features/fetchxml/state/builderStore.tsx +0 -1160
- package/src/features/fetchxml/state/cache.ts +0 -393
- package/src/features/fetchxml/ui/Dialogs/BulkDeleteDialog.tsx +0 -352
- package/src/features/fetchxml/ui/Dialogs/DeleteConfirmDialog.tsx +0 -396
- package/src/features/fetchxml/ui/Dialogs/SaveViewDialog.tsx +0 -612
- package/src/features/fetchxml/ui/Dialogs/SolutionPicker.tsx +0 -114
- package/src/features/fetchxml/ui/Dialogs/WorkflowPickerDialog.tsx +0 -437
- package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/AttributeEditor.tsx +0 -214
- package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/ConditionEditor.tsx +0 -533
- package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/FetchOptionsEditor.tsx +0 -296
- package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/FilterEditor.tsx +0 -106
- package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/LinkEntityEditor.tsx +0 -433
- package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/OrderEditor.tsx +0 -161
- package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/ValueOfPicker.tsx +0 -194
- package/src/features/fetchxml/ui/LeftPane/PropertiesPanel.tsx +0 -225
- package/src/features/fetchxml/ui/LeftPane/TreeView.tsx +0 -604
- package/src/features/fetchxml/ui/RightPane/AddColumnsPanel.tsx +0 -800
- package/src/features/fetchxml/ui/RightPane/ColumnConfigDialog.tsx +0 -170
- package/src/features/fetchxml/ui/RightPane/DataGridCellRenderers.tsx +0 -356
- package/src/features/fetchxml/ui/RightPane/EditColumnsPanel.tsx +0 -372
- package/src/features/fetchxml/ui/RightPane/FetchXmlEditor.tsx +0 -399
- package/src/features/fetchxml/ui/RightPane/FormattedValueUtils.ts +0 -189
- package/src/features/fetchxml/ui/RightPane/LayoutXmlViewer.tsx +0 -171
- package/src/features/fetchxml/ui/RightPane/PreviewTabs.tsx +0 -471
- package/src/features/fetchxml/ui/RightPane/ResultsCommandBar.tsx +0 -430
- package/src/features/fetchxml/ui/RightPane/ResultsGrid.tsx +0 -983
- package/src/features/fetchxml/ui/RightPane/XmlTextArea.tsx +0 -65
- package/src/features/fetchxml/ui/Settings/SettingsDrawer.tsx +0 -175
- package/src/features/fetchxml/ui/Toolbar/EntitySelector.tsx +0 -788
- package/src/features/fetchxml/ui/Toolbar/LoadViewPicker.tsx +0 -274
- package/src/features/fetchxml/ui/Toolbar/SaveViewButton.tsx +0 -174
- package/src/main.tsx +0 -11
- package/src/shared/components/AttributePicker.tsx +0 -138
- package/src/shared/components/BetweenInputPicker.tsx +0 -120
- package/src/shared/components/BooleanValuePicker.tsx +0 -165
- package/src/shared/components/DateTimeInputPicker.tsx +0 -170
- package/src/shared/components/DynamicValueList.tsx +0 -128
- package/src/shared/components/ExcelIcon.tsx +0 -30
- package/src/shared/components/MultiValuePicker.tsx +0 -178
- package/src/shared/components/NumericInputPicker.tsx +0 -156
- package/src/shared/components/OptionSetValuePicker.tsx +0 -150
- package/src/shared/components/RelationshipPicker.tsx +0 -268
- package/src/shared/contexts/ThemeContext.tsx +0 -19
- package/src/shared/hooks/useAccessMode.ts +0 -77
- package/src/shared/hooks/useLazyMetadata.ts +0 -132
- package/src/shared/hooks/usePptbContext.ts +0 -170
- package/src/shared/hooks/usePublisherFilter.ts +0 -214
- package/src/shared/hooks/useSolutionFilter.ts +0 -162
- package/src/shared/utils/debug.ts +0 -87
- package/tsconfig.app.json +0 -28
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -7
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for traversing and querying FetchXML tree nodes
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { FetchNode, EntityNode, LinkEntityNode, NodeId, FilterNode } from "./nodes";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Information about a link-entity that can be referenced in entityname attribute
|
|
9
|
-
*/
|
|
10
|
-
export interface LinkEntityReference {
|
|
11
|
-
/** The alias if specified, otherwise the entity logical name */
|
|
12
|
-
identifier: string;
|
|
13
|
-
/** The entity logical name */
|
|
14
|
-
entityName: string;
|
|
15
|
-
/** The alias (if specified) */
|
|
16
|
-
alias?: string;
|
|
17
|
-
/** Display label for the UI (e.g., "contact_alias (contact)") */
|
|
18
|
-
displayLabel: string;
|
|
19
|
-
/** The node ID of the link-entity */
|
|
20
|
-
nodeId: NodeId;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Recursively collects all link-entity references from the FetchXML tree.
|
|
25
|
-
* These can be used in the entityname attribute of conditions.
|
|
26
|
-
*
|
|
27
|
-
* @param node - The FetchNode to traverse
|
|
28
|
-
* @returns Array of LinkEntityReference objects
|
|
29
|
-
*/
|
|
30
|
-
export function collectLinkEntityReferences(node: FetchNode | null): LinkEntityReference[] {
|
|
31
|
-
if (!node?.entity) {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const references: LinkEntityReference[] = [];
|
|
36
|
-
|
|
37
|
-
function collectFromEntity(entity: EntityNode | LinkEntityNode): void {
|
|
38
|
-
// For link-entities, add them as references
|
|
39
|
-
if (entity.type === "link-entity") {
|
|
40
|
-
const linkEntity = entity as LinkEntityNode;
|
|
41
|
-
const identifier = linkEntity.alias || linkEntity.name;
|
|
42
|
-
references.push({
|
|
43
|
-
identifier,
|
|
44
|
-
entityName: linkEntity.name,
|
|
45
|
-
alias: linkEntity.alias,
|
|
46
|
-
displayLabel: linkEntity.alias
|
|
47
|
-
? `${linkEntity.alias} (${linkEntity.name})`
|
|
48
|
-
: linkEntity.name,
|
|
49
|
-
nodeId: linkEntity.id,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Recursively process nested link-entities
|
|
54
|
-
if (entity.links) {
|
|
55
|
-
for (const link of entity.links) {
|
|
56
|
-
collectFromEntity(link);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Start from root entity's links
|
|
62
|
-
for (const link of node.entity.links) {
|
|
63
|
-
collectFromEntity(link);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return references;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Determines if a condition is within the root entity's filter tree.
|
|
71
|
-
* Conditions in root entity filters can use entityname to reference link-entities.
|
|
72
|
-
*
|
|
73
|
-
* @param fetchNode - The FetchNode to search in
|
|
74
|
-
* @param conditionId - The ID of the condition to find
|
|
75
|
-
* @returns True if the condition is in the root entity's filter tree
|
|
76
|
-
*/
|
|
77
|
-
export function isConditionInRootEntityFilter(
|
|
78
|
-
fetchNode: FetchNode | null,
|
|
79
|
-
conditionId: NodeId
|
|
80
|
-
): boolean {
|
|
81
|
-
if (!fetchNode?.entity) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Check if condition exists in root entity's filters
|
|
86
|
-
function checkInFilters(filters: FilterNode[]): boolean {
|
|
87
|
-
for (const filter of filters) {
|
|
88
|
-
// Check conditions in this filter
|
|
89
|
-
for (const condition of filter.conditions) {
|
|
90
|
-
if (condition.id === conditionId) {
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// Recursively check subfilters
|
|
95
|
-
if (checkInFilters(filter.subfilters)) {
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return checkInFilters(fetchNode.entity.filters);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Finds the parent entity or link-entity for a given node ID.
|
|
107
|
-
*
|
|
108
|
-
* @param fetchNode - The FetchNode to search in
|
|
109
|
-
* @param nodeId - The ID of the node to find the parent for
|
|
110
|
-
* @returns The entity/link-entity name or null if not found
|
|
111
|
-
*/
|
|
112
|
-
export function findParentEntityForNode(
|
|
113
|
-
fetchNode: FetchNode | null,
|
|
114
|
-
nodeId: NodeId
|
|
115
|
-
): string | null {
|
|
116
|
-
if (!fetchNode?.entity) {
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function findInEntity(
|
|
121
|
-
entity: EntityNode | LinkEntityNode,
|
|
122
|
-
targetId: NodeId,
|
|
123
|
-
parentName: string
|
|
124
|
-
): string | null {
|
|
125
|
-
// Check in attributes
|
|
126
|
-
for (const attr of entity.attributes) {
|
|
127
|
-
if (attr.id === targetId) return parentName;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Check in orders
|
|
131
|
-
if ("orders" in entity) {
|
|
132
|
-
for (const order of entity.orders) {
|
|
133
|
-
if (order.id === targetId) return parentName;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Check in filters and conditions
|
|
138
|
-
for (const filter of entity.filters) {
|
|
139
|
-
const result = findInFilter(filter, targetId, parentName);
|
|
140
|
-
if (result) return result;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Check in nested link-entities
|
|
144
|
-
const currentName = entity.type === "link-entity" ? entity.alias || entity.name : entity.name;
|
|
145
|
-
for (const link of entity.links) {
|
|
146
|
-
if (link.id === targetId) return parentName;
|
|
147
|
-
const result = findInEntity(link, targetId, currentName);
|
|
148
|
-
if (result) return result;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function findInFilter(filter: FilterNode, targetId: NodeId, parentName: string): string | null {
|
|
155
|
-
if (filter.id === targetId) return parentName;
|
|
156
|
-
|
|
157
|
-
for (const condition of filter.conditions) {
|
|
158
|
-
if (condition.id === targetId) return parentName;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
for (const subfilter of filter.subfilters) {
|
|
162
|
-
const result = findInFilter(subfilter, targetId, parentName);
|
|
163
|
-
if (result) return result;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// Check if it's the fetch or entity node itself
|
|
170
|
-
if (fetchNode.id === nodeId) return null;
|
|
171
|
-
if (fetchNode.entity.id === nodeId) return fetchNode.entity.name;
|
|
172
|
-
|
|
173
|
-
return findInEntity(fetchNode.entity, nodeId, fetchNode.entity.name);
|
|
174
|
-
}
|