@orchestrator-ui/orchestrator-ui-components 5.9.0 → 6.1.0

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 (61) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/.turbo/turbo-lint.log +10 -1
  3. package/.turbo/turbo-test.log +10 -10
  4. package/CHANGELOG.md +12 -0
  5. package/__mocks__/@copilotkit/react-core.js +9 -0
  6. package/__mocks__/@copilotkit/react-ui.js +11 -0
  7. package/dist/index.d.ts +1432 -2
  8. package/dist/index.js +3006 -28
  9. package/dist/index.js.map +1 -1
  10. package/package.json +5 -1
  11. package/src/components/WfoAgent/FilterDisplay/FilterDisplay.tsx +182 -0
  12. package/src/components/WfoAgent/FilterDisplay/index.ts +1 -0
  13. package/src/components/WfoAgent/FilterDisplay/styles.ts +62 -0
  14. package/src/components/WfoAgent/WfoAgent/WfoAgent.tsx +100 -0
  15. package/src/components/WfoAgent/WfoAgent/index.ts +1 -0
  16. package/src/components/WfoAgent/index.ts +2 -0
  17. package/src/components/WfoSearchPage/WfoConditionRow/WfoConditionRow.tsx +388 -0
  18. package/src/components/WfoSearchPage/WfoConditionRow/WfoFieldSelector.tsx +43 -0
  19. package/src/components/WfoSearchPage/WfoConditionRow/WfoOperatorSelector.tsx +100 -0
  20. package/src/components/WfoSearchPage/WfoConditionRow/WfoPathChips.tsx +193 -0
  21. package/src/components/WfoSearchPage/WfoConditionRow/WfoPathSelector.tsx +54 -0
  22. package/src/components/WfoSearchPage/WfoConditionRow/WfoRenderFunctions.tsx +107 -0
  23. package/src/components/WfoSearchPage/WfoConditionRow/WfoSelectedPathDisplay.tsx +75 -0
  24. package/src/components/WfoSearchPage/WfoConditionRow/index.ts +11 -0
  25. package/src/components/WfoSearchPage/WfoConditionRow/types.ts +84 -0
  26. package/src/components/WfoSearchPage/WfoConditionRow/utils.ts +63 -0
  27. package/src/components/WfoSearchPage/WfoFilterGroup/WfoFilterGroup.tsx +238 -0
  28. package/src/components/WfoSearchPage/WfoFilterGroup/index.ts +1 -0
  29. package/src/components/WfoSearchPage/WfoSearch/WfoSearch.tsx +453 -0
  30. package/src/components/WfoSearchPage/WfoSearch/index.ts +1 -0
  31. package/src/components/WfoSearchPage/WfoSearchResults/WfoHighlightedText.tsx +63 -0
  32. package/src/components/WfoSearchPage/WfoSearchResults/WfoPathBreadcrumb.tsx +80 -0
  33. package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchEmptyState.tsx +24 -0
  34. package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchLoadingState.tsx +24 -0
  35. package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchMetadataHeader.tsx +24 -0
  36. package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchPaginationInfo.tsx +107 -0
  37. package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchResultItem.tsx +157 -0
  38. package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchResults.tsx +65 -0
  39. package/src/components/WfoSearchPage/WfoSearchResults/WfoSubscriptionDetailModal.tsx +55 -0
  40. package/src/components/WfoSearchPage/WfoSearchResults/index.ts +10 -0
  41. package/src/components/WfoSearchPage/WfoValueControl/WfoValueControl.tsx +247 -0
  42. package/src/components/WfoSearchPage/WfoValueControl/index.ts +1 -0
  43. package/src/components/WfoSearchPage/constants.ts +17 -0
  44. package/src/components/WfoSearchPage/index.ts +6 -0
  45. package/src/components/WfoSearchPage/utils.ts +271 -0
  46. package/src/components/index.ts +2 -0
  47. package/src/configuration/version.ts +1 -1
  48. package/src/hooks/useDebounce.ts +21 -0
  49. package/src/hooks/usePathAutoComplete.ts +133 -0
  50. package/src/hooks/useSearch.ts +83 -0
  51. package/src/hooks/useSearchPagination.ts +148 -0
  52. package/src/hooks/useUrlParams.ts +120 -0
  53. package/src/icons/WfoPencil.tsx +23 -4
  54. package/src/messages/en-GB.json +79 -1
  55. package/src/messages/nl-NL.json +2 -1
  56. package/src/rtk/endpoints/index.ts +1 -0
  57. package/src/rtk/endpoints/search.ts +90 -0
  58. package/src/types/index.ts +1 -0
  59. package/src/types/search.ts +215 -0
  60. package/src/utils/optionalArray.spec.ts +27 -0
  61. package/src/utils/optionalArray.ts +5 -0
@@ -0,0 +1,90 @@
1
+ import { getEndpointPath } from '@/components/WfoSearchPage/utils';
2
+ import { BaseQueryTypes, orchestratorApi } from '@/rtk';
3
+ import {
4
+ EntityKind,
5
+ Group,
6
+ PaginatedSearchResults,
7
+ PathAutocompleteResponse,
8
+ value_schema,
9
+ } from '@/types';
10
+
11
+ export interface SearchPayload {
12
+ action: 'select';
13
+ entity_type: EntityKind;
14
+ query: string;
15
+ filters?: Group;
16
+ limit?: number;
17
+ }
18
+
19
+ export interface SearchPaginationPayload extends SearchPayload {
20
+ cursor: number;
21
+ }
22
+
23
+ export interface SearchDefinitionsResponse {
24
+ [key: string]: {
25
+ operators: string[];
26
+ value_schema: Record<string, value_schema>;
27
+ };
28
+ }
29
+
30
+ const searchApi = orchestratorApi.injectEndpoints({
31
+ endpoints: (build) => ({
32
+ search: build.mutation<PaginatedSearchResults, SearchPayload>({
33
+ query: (payload) => ({
34
+ url: `search/${getEndpointPath(payload.entity_type)}`,
35
+ method: 'POST',
36
+ body: payload,
37
+ headers: {
38
+ 'Content-Type': 'application/json',
39
+ },
40
+ }),
41
+ extraOptions: {
42
+ baseQueryType: BaseQueryTypes.fetch,
43
+ },
44
+ }),
45
+ searchWithPagination: build.mutation<
46
+ PaginatedSearchResults,
47
+ SearchPaginationPayload
48
+ >({
49
+ query: ({ cursor, ...payload }) => ({
50
+ url: `search/${getEndpointPath(payload.entity_type)}?cursor=${cursor}`,
51
+ method: 'POST',
52
+ body: payload,
53
+ headers: {
54
+ 'Content-Type': 'application/json',
55
+ },
56
+ }),
57
+ extraOptions: {
58
+ baseQueryType: BaseQueryTypes.fetch,
59
+ },
60
+ }),
61
+ searchPaths: build.query<
62
+ PathAutocompleteResponse,
63
+ { q: string; entity_type: EntityKind }
64
+ >({
65
+ query: ({ q, entity_type }) => ({
66
+ url: `search/paths?q=${encodeURIComponent(q)}&entity_type=${entity_type}`,
67
+ method: 'GET',
68
+ }),
69
+ extraOptions: {
70
+ baseQueryType: BaseQueryTypes.fetch,
71
+ },
72
+ }),
73
+ searchDefinitions: build.query<SearchDefinitionsResponse, void>({
74
+ query: () => ({
75
+ url: 'search/definitions',
76
+ method: 'GET',
77
+ }),
78
+ extraOptions: {
79
+ baseQueryType: BaseQueryTypes.fetch,
80
+ },
81
+ }),
82
+ }),
83
+ });
84
+
85
+ export const {
86
+ useSearchMutation,
87
+ useSearchWithPaginationMutation,
88
+ useSearchPathsQuery,
89
+ useSearchDefinitionsQuery,
90
+ } = searchApi;
@@ -1,3 +1,4 @@
1
1
  export * from './types';
2
2
  export * from './deprecated';
3
3
  export * from './forms';
4
+ export * from './search';
@@ -0,0 +1,215 @@
1
+ export type EntityKind = 'SUBSCRIPTION' | 'PRODUCT' | 'WORKFLOW' | 'PROCESS';
2
+
3
+ export interface SubscriptionMatchingField {
4
+ text: string;
5
+ path: string;
6
+ highlight_indices: [number, number][];
7
+ }
8
+
9
+ export interface SubscriptionSearchResult {
10
+ score: number;
11
+ perfect_match: number;
12
+ matching_field?: SubscriptionMatchingField | null;
13
+ subscription: {
14
+ subscription_id: string;
15
+ description: string;
16
+ product: {
17
+ name: string;
18
+ description: string;
19
+ };
20
+ };
21
+ }
22
+
23
+ export interface ProcessSearchResult {
24
+ score: number;
25
+ perfect_match: number;
26
+ matching_field?: SubscriptionMatchingField | null;
27
+ process: {
28
+ processId: string;
29
+ workflowName: string;
30
+ workflowId: string;
31
+ status: string;
32
+ isTask: boolean;
33
+ createdBy?: string | null;
34
+ startedAt: string;
35
+ lastModifiedAt: string;
36
+ lastStep?: string | null;
37
+ failedReason?: string | null;
38
+ subscriptionIds?: string[] | null;
39
+ };
40
+ }
41
+
42
+ export interface ProductSearchResult {
43
+ score: number;
44
+ perfect_match: number;
45
+ matching_field?: SubscriptionMatchingField | null;
46
+ product: {
47
+ product_id: string;
48
+ name: string;
49
+ product_type: string;
50
+ tag?: string | null;
51
+ description?: string | null;
52
+ status?: string | null;
53
+ created_at?: string | null;
54
+ };
55
+ }
56
+
57
+ export interface WorkflowSearchResult {
58
+ score: number;
59
+ perfect_match: number;
60
+ matching_field?: SubscriptionMatchingField | null;
61
+ workflow: {
62
+ name: string;
63
+ products: {
64
+ product_type: string;
65
+ product_id: string;
66
+ name: string;
67
+ }[];
68
+ description?: string | null;
69
+ created_at?: string | null;
70
+ };
71
+ }
72
+
73
+ /** Union of all search results */
74
+ export type AnySearchResult =
75
+ | SubscriptionSearchResult
76
+ | ProcessSearchResult
77
+ | ProductSearchResult
78
+ | WorkflowSearchResult;
79
+
80
+ /** Paginated search results */
81
+ export type PaginatedSearchResults = {
82
+ data: AnySearchResult[];
83
+ page_info: {
84
+ has_next_page: boolean;
85
+ next_page_cursor: number | null;
86
+ };
87
+ search_metadata: {
88
+ search_type: string | null;
89
+ description: string | null;
90
+ };
91
+ };
92
+
93
+ /** ---------- PathFilter & condition types ---------- */
94
+
95
+ export type DateRange = {
96
+ from: string;
97
+ to: string;
98
+ };
99
+
100
+ export type DateEqFilter = { op: 'eq'; value: string };
101
+ export type DateNeqFilter = { op: 'neq'; value: string };
102
+ export type DateLtFilter = { op: 'lt'; value: string };
103
+ export type DateLteFilter = { op: 'lte'; value: string };
104
+ export type DateGtFilter = { op: 'gt'; value: string };
105
+ export type DateGteFilter = { op: 'gte'; value: string };
106
+ export type DateBetweenFilter = { op: 'between'; value: DateRange };
107
+ export type DateIsNullFilter = { op: 'is_null' };
108
+ export type DateIsNotNullFilter = { op: 'is_not_null' };
109
+
110
+ export type StrEqFilter = { op: 'eq'; value: string };
111
+ export type StrNeFilter = { op: 'ne'; value: string };
112
+
113
+ export type LtreeDescendantFilter = { op: 'is_descendant'; value: string };
114
+ export type LtreeAncestorFilter = { op: 'is_ancestor'; value: string };
115
+ export type LtreeMatchesFilter = { op: 'matches_lquery'; value: string };
116
+
117
+ export type PathFilter = {
118
+ path: string;
119
+ condition:
120
+ | DateEqFilter
121
+ | DateNeqFilter
122
+ | DateLtFilter
123
+ | DateLteFilter
124
+ | DateGtFilter
125
+ | DateGteFilter
126
+ | DateBetweenFilter
127
+ | DateIsNullFilter
128
+ | DateIsNotNullFilter
129
+ | StrEqFilter
130
+ | StrNeFilter
131
+ | LtreeDescendantFilter
132
+ | LtreeAncestorFilter
133
+ | LtreeMatchesFilter;
134
+ };
135
+
136
+ type ActionType = 'select';
137
+
138
+ type BaseSearchParameters = {
139
+ query?: string | null;
140
+
141
+ filters?: PathFilter[] | null;
142
+
143
+ action: ActionType;
144
+ };
145
+
146
+ export type SubscriptionSearchParameters = BaseSearchParameters & {
147
+ entity_type: 'SUBSCRIPTION';
148
+ };
149
+
150
+ export type ProductSearchParameters = BaseSearchParameters & {
151
+ entity_type: 'PRODUCT';
152
+ };
153
+
154
+ export type WorkflowSearchParameters = BaseSearchParameters & {
155
+ entity_type: 'WORKFLOW';
156
+ };
157
+
158
+ export type ProcessSearchParameters = BaseSearchParameters & {
159
+ entity_type: 'PROCESS';
160
+ };
161
+
162
+ export type AnySearchParameters =
163
+ | SubscriptionSearchParameters
164
+ | ProductSearchParameters
165
+ | WorkflowSearchParameters
166
+ | ProcessSearchParameters;
167
+
168
+ export type Condition = {
169
+ path: string;
170
+ value_kind?: string;
171
+ condition: { op: string; value?: unknown };
172
+ };
173
+
174
+ export type Group = {
175
+ op: 'AND' | 'OR';
176
+ children: Array<Group | Condition>;
177
+ };
178
+
179
+ export type value_schema = {
180
+ kind: 'string' | 'number' | 'datetime' | 'boolean' | 'object' | 'none';
181
+ format?: string;
182
+ fields?: Record<string, value_schema>;
183
+ };
184
+
185
+ export type PathLeaf = {
186
+ name: string;
187
+ ui_types: string[];
188
+ paths?: string[];
189
+ };
190
+
191
+ export type PathAutocompleteResponse = {
192
+ leaves: PathLeaf[];
193
+ components: PathLeaf[];
194
+ };
195
+
196
+ export type PathDataType =
197
+ | 'string'
198
+ | 'number'
199
+ | 'datetime'
200
+ | 'boolean'
201
+ | 'component';
202
+
203
+ export type PathInfo = {
204
+ path: string;
205
+ type: PathDataType;
206
+ operators: string[];
207
+ value_schema: Record<string, value_schema>;
208
+ example_values?: string[];
209
+ group: 'leaf' | 'component';
210
+ displayLabel?: string;
211
+ ui_types?: string[];
212
+ fullPath?: string;
213
+ availablePaths?: string[];
214
+ pathCount?: number;
215
+ };
@@ -1,3 +1,5 @@
1
+ import { toOptionalObjectProperty } from 'pydantic-forms';
2
+
1
3
  import {
2
4
  optionalArrayMapper,
3
5
  toOptionalArrayEntries,
@@ -70,3 +72,28 @@ describe('optionalArrayMapper', () => {
70
72
  expect(result).toEqual([]);
71
73
  });
72
74
  });
75
+
76
+ describe('toOptionalObjectProperty', () => {
77
+ const flatSchema = { const: 'CONST_VAL' };
78
+ function withSpread(addConstValue: boolean) {
79
+ return {
80
+ ...(addConstValue && { const: flatSchema.const }),
81
+ };
82
+ }
83
+ function withHelper(addConstValue: boolean) {
84
+ return {
85
+ ...toOptionalObjectProperty(
86
+ { const: flatSchema.const },
87
+ addConstValue,
88
+ ),
89
+ };
90
+ }
91
+ it('adds const when addConstValue = true', () => {
92
+ expect(withSpread(true)).toEqual(withHelper(true));
93
+ expect(withSpread(true)).toHaveProperty('const', 'CONST_VAL');
94
+ });
95
+ it('omits const when addConstValue = false', () => {
96
+ expect(withSpread(false)).toEqual(withHelper(false));
97
+ expect(withSpread(false)).not.toHaveProperty('const');
98
+ });
99
+ });
@@ -12,3 +12,8 @@ export const optionalArrayMapper = <T, U>(
12
12
  data: T[] | undefined = [],
13
13
  mapper: (input: T) => U,
14
14
  ): U[] => data.map(mapper);
15
+
16
+ export const toOptionalObjectProperty = <T extends object>(
17
+ entries: T,
18
+ condition: boolean,
19
+ ): T | object => (condition ? entries : {});