@finos/legend-query-builder 4.1.3 → 4.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. package/lib/components/QueryBuilderTextEditor.d.ts.map +1 -1
  2. package/lib/components/QueryBuilderTextEditor.js +3 -1
  3. package/lib/components/QueryBuilderTextEditor.js.map +1 -1
  4. package/lib/components/QueryBuilder_LegendApplicationPlugin.js +1 -1
  5. package/lib/components/QueryBuilder_LegendApplicationPlugin.js.map +1 -1
  6. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.d.ts.map +1 -1
  7. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.js +2 -1
  8. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.js.map +1 -1
  9. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  10. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +2 -1
  11. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  12. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  13. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +51 -38
  14. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  15. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  16. package/lib/components/filter/QueryBuilderFilterPanel.js +2 -1
  17. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  18. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  19. package/lib/components/shared/CustomDatePicker.js +1 -2
  20. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  21. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  22. package/lib/components/shared/LambdaEditor.js +10 -3
  23. package/lib/components/shared/LambdaEditor.js.map +1 -1
  24. package/lib/graph-manager/QueryBuilder_GraphManagerPreset.js +1 -1
  25. package/lib/graph-manager/QueryBuilder_GraphManagerPreset.js.map +1 -1
  26. package/lib/graph-manager/QueryBuilder_PureGraphManagerPlugin.js +1 -1
  27. package/lib/graph-manager/QueryBuilder_PureGraphManagerPlugin.js.map +1 -1
  28. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +1 -1
  29. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  30. package/lib/index.css +2 -2
  31. package/lib/index.css.map +1 -1
  32. package/lib/package.json +6 -6
  33. package/lib/stores/QueryBuilderTextEditorState.d.ts +3 -1
  34. package/lib/stores/QueryBuilderTextEditorState.d.ts.map +1 -1
  35. package/lib/stores/QueryBuilderTextEditorState.js +2 -2
  36. package/lib/stores/QueryBuilderTextEditorState.js.map +1 -1
  37. package/lib/stores/QueryLoaderState.d.ts +2 -0
  38. package/lib/stores/QueryLoaderState.d.ts.map +1 -1
  39. package/lib/stores/QueryLoaderState.js +7 -3
  40. package/lib/stores/QueryLoaderState.js.map +1 -1
  41. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +0 -3
  42. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  43. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +3 -12
  44. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  45. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.d.ts.map +1 -1
  46. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js.map +1 -1
  47. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.d.ts.map +1 -1
  48. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js.map +1 -1
  49. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.d.ts.map +1 -1
  50. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js.map +1 -1
  51. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.d.ts.map +1 -1
  52. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js.map +1 -1
  53. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts +4 -1
  54. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
  55. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js +5 -3
  56. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  57. package/lib/stores/shared/LambdaEditorState.d.ts +7 -2
  58. package/lib/stores/shared/LambdaEditorState.d.ts.map +1 -1
  59. package/lib/stores/shared/LambdaEditorState.js +7 -2
  60. package/lib/stores/shared/LambdaEditorState.js.map +1 -1
  61. package/package.json +14 -14
  62. package/src/components/QueryBuilderTextEditor.tsx +3 -1
  63. package/src/components/QueryBuilder_LegendApplicationPlugin.ts +1 -1
  64. package/src/components/execution-plan/FunctionParametersValidationNodeViewer.tsx +2 -3
  65. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +5 -1
  66. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +117 -64
  67. package/src/components/filter/QueryBuilderFilterPanel.tsx +5 -1
  68. package/src/components/shared/CustomDatePicker.tsx +3 -4
  69. package/src/components/shared/LambdaEditor.tsx +10 -3
  70. package/src/graph-manager/QueryBuilder_GraphManagerPreset.ts +1 -1
  71. package/src/graph-manager/QueryBuilder_PureGraphManagerPlugin.ts +1 -1
  72. package/src/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +1 -1
  73. package/src/stores/QueryBuilderTextEditorState.ts +4 -2
  74. package/src/stores/QueryLoaderState.ts +11 -1
  75. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +3 -17
  76. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +1 -3
  77. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +1 -3
  78. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +1 -3
  79. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +1 -3
  80. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.ts +8 -3
  81. package/src/stores/shared/LambdaEditorState.ts +12 -5
@@ -24,12 +24,14 @@ import {
24
24
  type QueryInfo,
25
25
  type BasicGraphManagerState,
26
26
  type Query,
27
+ GRAPH_MANAGER_EVENT,
27
28
  } from '@finos/legend-graph';
28
29
  import {
29
30
  ActionState,
30
31
  type GeneratorFn,
31
32
  assertErrorThrown,
32
33
  guaranteeNonNullable,
34
+ LogEvent,
33
35
  } from '@finos/legend-shared';
34
36
  import { makeObservable, observable, action, flow } from 'mobx';
35
37
  import type { QueryBuilderState } from './QueryBuilderState.js';
@@ -62,6 +64,7 @@ export class QueryLoaderState {
62
64
  readonly isReadOnly?: boolean | undefined;
63
65
  readonly onQueryRenamed?: ((query: LightQuery) => void) | undefined;
64
66
  readonly onQueryDeleted?: ((query: LightQuery) => void) | undefined;
67
+ readonly handleFetchDefaultQueriesFailure?: (() => void) | undefined;
65
68
 
66
69
  queryBuilderState?: QueryBuilderState | undefined;
67
70
 
@@ -93,6 +96,7 @@ export class QueryLoaderState {
93
96
  isReadOnly?: boolean | undefined;
94
97
  onQueryRenamed?: ((query: LightQuery) => void) | undefined;
95
98
  onQueryDeleted?: ((query: LightQuery) => void) | undefined;
99
+ handleFetchDefaultQueriesFailure?: (() => void) | undefined;
96
100
  },
97
101
  ) {
98
102
  makeObservable(this, {
@@ -126,6 +130,8 @@ export class QueryLoaderState {
126
130
  this.isReadOnly = options.isReadOnly;
127
131
  this.onQueryRenamed = options.onQueryRenamed;
128
132
  this.onQueryDeleted = options.onQueryDeleted;
133
+ this.handleFetchDefaultQueriesFailure =
134
+ options.handleFetchDefaultQueriesFailure;
129
135
  }
130
136
 
131
137
  setSearchText(val: string): void {
@@ -190,7 +196,11 @@ export class QueryLoaderState {
190
196
  } catch (error) {
191
197
  this.searchQueriesState.fail();
192
198
  assertErrorThrown(error);
193
- this.applicationStore.notificationService.notifyError(error);
199
+ this.applicationStore.logService.error(
200
+ LogEvent.create(GRAPH_MANAGER_EVENT.GET_QUERY_FAILURE),
201
+ error,
202
+ );
203
+ this.handleFetchDefaultQueriesFailure?.();
194
204
  }
195
205
  }
196
206
 
@@ -121,8 +121,6 @@ export class QueryBuilderTDSState
121
121
  isConvertDerivationProjectionObjects = false;
122
122
  showPostFilterPanel: boolean;
123
123
  showWindowFuncPanel = false;
124
- draggedColumnIndex: number | undefined;
125
- hoveredColumnIndex: number | undefined;
126
124
 
127
125
  postFilterOperators: QueryBuilderPostFilterOperator[] =
128
126
  getQueryBuilderCorePostFilterOperators();
@@ -144,14 +142,11 @@ export class QueryBuilderTDSState
144
142
  isConvertDerivationProjectionObjects: observable,
145
143
  showPostFilterPanel: observable,
146
144
  showWindowFuncPanel: observable,
147
- draggedColumnIndex: observable,
148
- hoveredColumnIndex: observable,
149
145
  TEMPORARY__showPostFetchStructurePanel: computed,
150
146
  derivations: computed,
151
147
  hasParserError: computed,
152
148
  addColumn: action,
153
149
  moveColumn: action,
154
- setRearrangeColumnsIndex: action,
155
150
  replaceColumn: action,
156
151
  initialize: action,
157
152
  setShowPostFilterPanel: action,
@@ -159,9 +154,6 @@ export class QueryBuilderTDSState
159
154
  convertDerivationProjectionObjects: flow,
160
155
  });
161
156
 
162
- this.draggedColumnIndex = undefined;
163
- this.hoveredColumnIndex = undefined;
164
-
165
157
  this.resultSetModifierState = new QueryResultSetModifierState(this);
166
158
  this.postFilterState = new QueryBuilderPostFilterState(
167
159
  this,
@@ -182,14 +174,6 @@ export class QueryBuilderTDSState
182
174
  ) ?? false;
183
175
  }
184
176
 
185
- setRearrangeColumnsIndex(
186
- draggedColumnIndex: number | undefined,
187
- hoveredColumnIndex: number | undefined,
188
- ): void {
189
- this.draggedColumnIndex = draggedColumnIndex;
190
- this.hoveredColumnIndex = hoveredColumnIndex;
191
- }
192
-
193
177
  get type(): string {
194
178
  return FETCH_STRUCTURE_IMPLEMENTATION.TABULAR_DATA_STRUCTURE;
195
179
  }
@@ -481,7 +465,9 @@ export class QueryBuilderTDSState
481
465
  // convert to grammar for display
482
466
  flowResult(
483
467
  derivationColumnState.derivationLambdaEditorState.convertLambdaObjectToGrammarString(
484
- false,
468
+ {
469
+ pretty: false,
470
+ },
485
471
  ),
486
472
  ).catch(this.queryBuilderState.applicationStore.alertUnhandledError);
487
473
  }
@@ -81,9 +81,7 @@ export class QueryBuilderPostFilterOperator_EndWith
81
81
  }
82
82
  default:
83
83
  throw new UnsupportedOperationError(
84
- `Can't get default value for post-filter operator '${this.getLabel()}' when the LHS property is of type '${
85
- propertyType?.path
86
- }'`,
84
+ `Can't get default value for post-filter operator '${this.getLabel()}' when the LHS property is of type '${propertyType?.path}'`,
87
85
  );
88
86
  }
89
87
  }
@@ -110,9 +110,7 @@ export class QueryBuilderPostFilterOperator_GreaterThan
110
110
  }
111
111
  default:
112
112
  throw new UnsupportedOperationError(
113
- `Can't get default value for post-filter operator '${this.getLabel()}' when the LHS property is of type '${
114
- propertyType?.path
115
- }'`,
113
+ `Can't get default value for post-filter operator '${this.getLabel()}' when the LHS property is of type '${propertyType?.path}'`,
116
114
  );
117
115
  }
118
116
  }
@@ -110,9 +110,7 @@ export class QueryBuilderPostFilterOperator_LessThan
110
110
  }
111
111
  default:
112
112
  throw new UnsupportedOperationError(
113
- `Can't get default value for post-filter operator '${this.getLabel()}' when the LHS property is of type '${
114
- propertyType?.path
115
- }'`,
113
+ `Can't get default value for post-filter operator '${this.getLabel()}' when the LHS property is of type '${propertyType?.path}'`,
116
114
  );
117
115
  }
118
116
  }
@@ -82,9 +82,7 @@ export class QueryBuilderPostFilterOperator_StartWith
82
82
  }
83
83
  default:
84
84
  throw new UnsupportedOperationError(
85
- `Can't get default value for post-filter operator '${this.getLabel()}' when the LHS property is of type '${
86
- propertyType?.path
87
- }'`,
85
+ `Can't get default value for post-filter operator '${this.getLabel()}' when the LHS property is of type '${propertyType?.path}'`,
88
86
  );
89
87
  }
90
88
  }
@@ -226,7 +226,10 @@ class QueryBuilderDerivationProjectionLambdaState extends LambdaEditorState {
226
226
  }
227
227
  }
228
228
 
229
- *convertLambdaObjectToGrammarString(pretty: boolean): GeneratorFn<void> {
229
+ *convertLambdaObjectToGrammarString(options?: {
230
+ pretty?: boolean | undefined;
231
+ preserveCompilationError?: boolean | undefined;
232
+ }): GeneratorFn<void> {
230
233
  if (this.derivationProjectionColumnState.lambda.body) {
231
234
  try {
232
235
  const lambdas = new Map<string, RawLambda>();
@@ -240,7 +243,7 @@ class QueryBuilderDerivationProjectionLambdaState extends LambdaEditorState {
240
243
  const isolatedLambdas =
241
244
  (yield this.queryBuilderState.graphManagerState.graphManager.lambdasToPureCode(
242
245
  lambdas,
243
- pretty,
246
+ options?.pretty,
244
247
  )) as Map<string, string>;
245
248
  const grammarText = isolatedLambdas.get(this.lambdaId);
246
249
  this.setLambdaString(
@@ -248,7 +251,9 @@ class QueryBuilderDerivationProjectionLambdaState extends LambdaEditorState {
248
251
  ? this.extractLambdaString(grammarText)
249
252
  : '',
250
253
  );
251
- this.clearErrors();
254
+ this.clearErrors({
255
+ preserveCompilationError: options?.preserveCompilationError,
256
+ });
252
257
  } catch (error) {
253
258
  assertErrorThrown(error);
254
259
  this.queryBuilderState.applicationStore.logService.error(
@@ -64,9 +64,15 @@ export abstract class LambdaEditorState {
64
64
  this.lambdaString = val;
65
65
  }
66
66
 
67
- clearErrors(): void {
68
- this.setCompilationError(undefined);
67
+ clearErrors(options?: {
68
+ preserveCompilationError?: boolean | undefined;
69
+ }): void {
69
70
  this.setParserError(undefined);
71
+ if (options?.preserveCompilationError && this.compilationError) {
72
+ this.compilationError.sourceInformation = undefined;
73
+ } else {
74
+ this.setCompilationError(undefined);
75
+ }
70
76
  }
71
77
 
72
78
  setCompilationError(compilationError: CompilationError | undefined): void {
@@ -113,7 +119,8 @@ export abstract class LambdaEditorState {
113
119
  }
114
120
 
115
121
  abstract convertLambdaGrammarStringToObject(): GeneratorFn<void>;
116
- abstract convertLambdaObjectToGrammarString(
117
- pretty: boolean,
118
- ): GeneratorFn<void>;
122
+ abstract convertLambdaObjectToGrammarString(options?: {
123
+ pretty?: boolean | undefined;
124
+ preserveCompilationError?: boolean | undefined;
125
+ }): GeneratorFn<void>;
119
126
  }