@memberjunction/ng-query-viewer 6.2.0-edge.5 → 6.2.0-edge.7

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 (49) hide show
  1. package/dist/lib/query-data-grid/models/query-grid-types.d.ts +17 -0
  2. package/dist/lib/query-data-grid/models/query-grid-types.d.ts.map +1 -1
  3. package/dist/lib/query-data-grid/models/query-grid-types.js +51 -0
  4. package/dist/lib/query-data-grid/models/query-grid-types.js.map +1 -1
  5. package/dist/lib/query-data-grid/open-in-excel.d.ts +32 -0
  6. package/dist/lib/query-data-grid/open-in-excel.d.ts.map +1 -0
  7. package/dist/lib/query-data-grid/open-in-excel.js +63 -0
  8. package/dist/lib/query-data-grid/open-in-excel.js.map +1 -0
  9. package/dist/lib/query-data-grid/query-data-grid.component.d.ts +60 -3
  10. package/dist/lib/query-data-grid/query-data-grid.component.d.ts.map +1 -1
  11. package/dist/lib/query-data-grid/query-data-grid.component.js +322 -58
  12. package/dist/lib/query-data-grid/query-data-grid.component.js.map +1 -1
  13. package/dist/lib/query-diagnostics/query-diagnostics.component.d.ts +30 -0
  14. package/dist/lib/query-diagnostics/query-diagnostics.component.d.ts.map +1 -0
  15. package/dist/lib/query-diagnostics/query-diagnostics.component.js +183 -0
  16. package/dist/lib/query-diagnostics/query-diagnostics.component.js.map +1 -0
  17. package/dist/lib/query-info-panel/query-info-panel.component.d.ts +12 -1
  18. package/dist/lib/query-info-panel/query-info-panel.component.d.ts.map +1 -1
  19. package/dist/lib/query-info-panel/query-info-panel.component.js +27 -8
  20. package/dist/lib/query-info-panel/query-info-panel.component.js.map +1 -1
  21. package/dist/lib/query-parameter-form/query-parameter-form.component.d.ts +11 -1
  22. package/dist/lib/query-parameter-form/query-parameter-form.component.d.ts.map +1 -1
  23. package/dist/lib/query-parameter-form/query-parameter-form.component.js +96 -56
  24. package/dist/lib/query-parameter-form/query-parameter-form.component.js.map +1 -1
  25. package/dist/lib/query-refresh/query-refresh-dialog.component.d.ts +72 -0
  26. package/dist/lib/query-refresh/query-refresh-dialog.component.d.ts.map +1 -0
  27. package/dist/lib/query-refresh/query-refresh-dialog.component.js +388 -0
  28. package/dist/lib/query-refresh/query-refresh-dialog.component.js.map +1 -0
  29. package/dist/lib/query-refresh/query-refresh-model.d.ts +50 -0
  30. package/dist/lib/query-refresh/query-refresh-model.d.ts.map +1 -0
  31. package/dist/lib/query-refresh/query-refresh-model.js +62 -0
  32. package/dist/lib/query-refresh/query-refresh-model.js.map +1 -0
  33. package/dist/lib/query-refresh/query-refresh-report.component.d.ts +44 -0
  34. package/dist/lib/query-refresh/query-refresh-report.component.d.ts.map +1 -0
  35. package/dist/lib/query-refresh/query-refresh-report.component.js +469 -0
  36. package/dist/lib/query-refresh/query-refresh-report.component.js.map +1 -0
  37. package/dist/lib/query-viewer/query-viewer.component.d.ts +40 -2
  38. package/dist/lib/query-viewer/query-viewer.component.d.ts.map +1 -1
  39. package/dist/lib/query-viewer/query-viewer.component.js +121 -17
  40. package/dist/lib/query-viewer/query-viewer.component.js.map +1 -1
  41. package/dist/lib/query-viewer.module.d.ts +4 -1
  42. package/dist/lib/query-viewer.module.d.ts.map +1 -1
  43. package/dist/lib/query-viewer.module.js +21 -5
  44. package/dist/lib/query-viewer.module.js.map +1 -1
  45. package/dist/public-api.d.ts +4 -0
  46. package/dist/public-api.d.ts.map +1 -1
  47. package/dist/public-api.js +4 -0
  48. package/dist/public-api.js.map +1 -1
  49. package/package.json +16 -15
@@ -0,0 +1,388 @@
1
+ import { ChangeDetectorRef, Component, EventEmitter, Input, Output, inject } from '@angular/core';
2
+ import { QueryRefreshExtractionOperation, UserInfoEngine } from '@memberjunction/core-entities';
3
+ import { BaseAngularComponent } from '@memberjunction/ng-base-types';
4
+ import { MJButtonDirective, MJDialogActionsComponent, MJDialogComponent, MJProgressBarComponent, } from '@memberjunction/ng-ui-components';
5
+ import { QueryRefreshReportComponent } from './query-refresh-report.component';
6
+ import { IsQueryRefreshScopeEmpty, QUERY_REFRESH_SKIP_DRY_RUN_SETTING, QueryRefreshHasChanges, QueryRefreshInputFor, QueryRefreshPercent, } from './query-refresh-model';
7
+ import * as i0 from "@angular/core";
8
+ function QueryRefreshDialogComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
9
+ i0.ɵɵelementStart(0, "div", 2);
10
+ i0.ɵɵelement(1, "i", 9);
11
+ i0.ɵɵtext(2);
12
+ i0.ɵɵelementEnd();
13
+ } if (rf & 2) {
14
+ const ctx_r0 = i0.ɵɵnextContext();
15
+ i0.ɵɵadvance(2);
16
+ i0.ɵɵtextInterpolate1(" ", ctx_r0.ScopeLabel);
17
+ } }
18
+ function QueryRefreshDialogComponent_Case_3_Conditional_3_Conditional_3_Template(rf, ctx) { if (rf & 1) {
19
+ i0.ɵɵtext(0);
20
+ } if (rf & 2) {
21
+ const ctx_r0 = i0.ɵɵnextContext(3);
22
+ i0.ɵɵtextInterpolate1(" \u00B7 ", ctx_r0.ProgressMessage, " ");
23
+ } }
24
+ function QueryRefreshDialogComponent_Case_3_Conditional_3_Template(rf, ctx) { if (rf & 1) {
25
+ i0.ɵɵelement(0, "mj-progress-bar", 12);
26
+ i0.ɵɵelementStart(1, "div", 13);
27
+ i0.ɵɵtext(2);
28
+ i0.ɵɵconditionalCreate(3, QueryRefreshDialogComponent_Case_3_Conditional_3_Conditional_3_Template, 1, 1);
29
+ i0.ɵɵelementEnd();
30
+ } if (rf & 2) {
31
+ const ctx_r0 = i0.ɵɵnextContext(2);
32
+ i0.ɵɵproperty("Value", ctx_r0.Percent);
33
+ i0.ɵɵadvance(2);
34
+ i0.ɵɵtextInterpolate2("", ctx_r0.Processed, " of ", ctx_r0.Total, " queries ");
35
+ i0.ɵɵadvance();
36
+ i0.ɵɵconditional(ctx_r0.ProgressMessage ? 3 : -1);
37
+ } }
38
+ function QueryRefreshDialogComponent_Case_3_Conditional_4_Template(rf, ctx) { if (rf & 1) {
39
+ i0.ɵɵelement(0, "mj-progress-bar", 11);
40
+ } }
41
+ function QueryRefreshDialogComponent_Case_3_Template(rf, ctx) { if (rf & 1) {
42
+ i0.ɵɵelementStart(0, "div", 3)(1, "div", 10);
43
+ i0.ɵɵtext(2, "Checking what would change (dry run, nothing is written)\u2026");
44
+ i0.ɵɵelementEnd();
45
+ i0.ɵɵconditionalCreate(3, QueryRefreshDialogComponent_Case_3_Conditional_3_Template, 4, 4)(4, QueryRefreshDialogComponent_Case_3_Conditional_4_Template, 1, 0, "mj-progress-bar", 11);
46
+ i0.ɵɵelementEnd();
47
+ } if (rf & 2) {
48
+ const ctx_r0 = i0.ɵɵnextContext();
49
+ i0.ɵɵadvance(3);
50
+ i0.ɵɵconditional(ctx_r0.Percent !== null ? 3 : 4);
51
+ } }
52
+ function QueryRefreshDialogComponent_Case_4_Conditional_3_Conditional_3_Template(rf, ctx) { if (rf & 1) {
53
+ i0.ɵɵtext(0);
54
+ } if (rf & 2) {
55
+ const ctx_r0 = i0.ɵɵnextContext(3);
56
+ i0.ɵɵtextInterpolate1(" \u00B7 ", ctx_r0.ProgressMessage, " ");
57
+ } }
58
+ function QueryRefreshDialogComponent_Case_4_Conditional_3_Template(rf, ctx) { if (rf & 1) {
59
+ i0.ɵɵelement(0, "mj-progress-bar", 12);
60
+ i0.ɵɵelementStart(1, "div", 13);
61
+ i0.ɵɵtext(2);
62
+ i0.ɵɵconditionalCreate(3, QueryRefreshDialogComponent_Case_4_Conditional_3_Conditional_3_Template, 1, 1);
63
+ i0.ɵɵelementEnd();
64
+ } if (rf & 2) {
65
+ const ctx_r0 = i0.ɵɵnextContext(2);
66
+ i0.ɵɵproperty("Value", ctx_r0.Percent);
67
+ i0.ɵɵadvance(2);
68
+ i0.ɵɵtextInterpolate2("", ctx_r0.Processed, " of ", ctx_r0.Total, " queries ");
69
+ i0.ɵɵadvance();
70
+ i0.ɵɵconditional(ctx_r0.ProgressMessage ? 3 : -1);
71
+ } }
72
+ function QueryRefreshDialogComponent_Case_4_Conditional_4_Template(rf, ctx) { if (rf & 1) {
73
+ i0.ɵɵelement(0, "mj-progress-bar", 11);
74
+ } }
75
+ function QueryRefreshDialogComponent_Case_4_Template(rf, ctx) { if (rf & 1) {
76
+ i0.ɵɵelementStart(0, "div", 3)(1, "div", 10);
77
+ i0.ɵɵtext(2, "Applying the refresh\u2026");
78
+ i0.ɵɵelementEnd();
79
+ i0.ɵɵconditionalCreate(3, QueryRefreshDialogComponent_Case_4_Conditional_3_Template, 4, 4)(4, QueryRefreshDialogComponent_Case_4_Conditional_4_Template, 1, 0, "mj-progress-bar", 11);
80
+ i0.ɵɵelementEnd();
81
+ } if (rf & 2) {
82
+ const ctx_r0 = i0.ɵɵnextContext();
83
+ i0.ɵɵadvance(3);
84
+ i0.ɵɵconditional(ctx_r0.Percent !== null ? 3 : 4);
85
+ } }
86
+ function QueryRefreshDialogComponent_Case_5_Conditional_2_Template(rf, ctx) { if (rf & 1) {
87
+ i0.ɵɵtext(0, " Dry run: these are the changes a refresh would make. Nothing has been written yet. ");
88
+ } }
89
+ function QueryRefreshDialogComponent_Case_5_Conditional_3_Template(rf, ctx) { if (rf & 1) {
90
+ i0.ɵɵtext(0, " Dry run: the stored metadata already matches the SQL. There is nothing to apply. ");
91
+ } }
92
+ function QueryRefreshDialogComponent_Case_5_Template(rf, ctx) { if (rf & 1) {
93
+ const _r2 = i0.ɵɵgetCurrentView();
94
+ i0.ɵɵelementStart(0, "div", 14);
95
+ i0.ɵɵelement(1, "i", 15);
96
+ i0.ɵɵconditionalCreate(2, QueryRefreshDialogComponent_Case_5_Conditional_2_Template, 1, 0)(3, QueryRefreshDialogComponent_Case_5_Conditional_3_Template, 1, 0);
97
+ i0.ɵɵelementEnd();
98
+ i0.ɵɵelementStart(4, "mj-query-refresh-report", 16);
99
+ i0.ɵɵlistener("OpenQuery", function QueryRefreshDialogComponent_Case_5_Template_mj_query_refresh_report_OpenQuery_4_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.OpenQuery.emit($event)); });
100
+ i0.ɵɵelementEnd();
101
+ } if (rf & 2) {
102
+ const ctx_r0 = i0.ɵɵnextContext();
103
+ i0.ɵɵadvance(2);
104
+ i0.ɵɵconditional(ctx_r0.CanApply ? 2 : 3);
105
+ i0.ɵɵadvance(2);
106
+ i0.ɵɵproperty("Output", ctx_r0.Report)("AllowOpenQuery", ctx_r0.AllowOpenQuery);
107
+ } }
108
+ function QueryRefreshDialogComponent_Case_6_Template(rf, ctx) { if (rf & 1) {
109
+ const _r3 = i0.ɵɵgetCurrentView();
110
+ i0.ɵɵelementStart(0, "div", 17);
111
+ i0.ɵɵelement(1, "i", 18);
112
+ i0.ɵɵtext(2, " The refresh was applied. ");
113
+ i0.ɵɵelementEnd();
114
+ i0.ɵɵelementStart(3, "mj-query-refresh-report", 16);
115
+ i0.ɵɵlistener("OpenQuery", function QueryRefreshDialogComponent_Case_6_Template_mj_query_refresh_report_OpenQuery_3_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.OpenQuery.emit($event)); });
116
+ i0.ɵɵelementEnd();
117
+ } if (rf & 2) {
118
+ const ctx_r0 = i0.ɵɵnextContext();
119
+ i0.ɵɵadvance(3);
120
+ i0.ɵɵproperty("Output", ctx_r0.Report)("AllowOpenQuery", ctx_r0.AllowOpenQuery);
121
+ } }
122
+ function QueryRefreshDialogComponent_Case_7_Template(rf, ctx) { if (rf & 1) {
123
+ i0.ɵɵelementStart(0, "div", 4);
124
+ i0.ɵɵelement(1, "i", 19);
125
+ i0.ɵɵtext(2);
126
+ i0.ɵɵelementEnd();
127
+ } if (rf & 2) {
128
+ const ctx_r0 = i0.ɵɵnextContext();
129
+ i0.ɵɵadvance(2);
130
+ i0.ɵɵtextInterpolate1(" ", ctx_r0.ErrorMessage, " ");
131
+ } }
132
+ function QueryRefreshDialogComponent_Conditional_8_Template(rf, ctx) { if (rf & 1) {
133
+ const _r4 = i0.ɵɵgetCurrentView();
134
+ i0.ɵɵelementStart(0, "label", 5)(1, "input", 20);
135
+ i0.ɵɵlistener("change", function QueryRefreshDialogComponent_Conditional_8_Template_input_change_1_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.OnSkipDryRunToggled($event)); });
136
+ i0.ɵɵelementEnd();
137
+ i0.ɵɵtext(2, " Skip the dry run for future query refreshes ");
138
+ i0.ɵɵelementEnd();
139
+ } if (rf & 2) {
140
+ const ctx_r0 = i0.ɵɵnextContext();
141
+ i0.ɵɵadvance();
142
+ i0.ɵɵproperty("checked", ctx_r0.SkipDryRun);
143
+ } }
144
+ function QueryRefreshDialogComponent_Conditional_10_Template(rf, ctx) { if (rf & 1) {
145
+ const _r5 = i0.ɵɵgetCurrentView();
146
+ i0.ɵɵelementStart(0, "button", 21);
147
+ i0.ɵɵlistener("click", function QueryRefreshDialogComponent_Conditional_10_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r5); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.Apply()); });
148
+ i0.ɵɵelement(1, "i", 22);
149
+ i0.ɵɵtext(2, " Apply changes ");
150
+ i0.ɵɵelementEnd();
151
+ } if (rf & 2) {
152
+ const ctx_r0 = i0.ɵɵnextContext();
153
+ i0.ɵɵproperty("disabled", !ctx_r0.CanApply);
154
+ } }
155
+ function QueryRefreshDialogComponent_Conditional_11_Template(rf, ctx) { if (rf & 1) {
156
+ const _r6 = i0.ɵɵgetCurrentView();
157
+ i0.ɵɵelementStart(0, "button", 23);
158
+ i0.ɵɵlistener("click", function QueryRefreshDialogComponent_Conditional_11_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r6); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.RunDryRunAgain()); });
159
+ i0.ɵɵelement(1, "i", 24);
160
+ i0.ɵɵtext(2, " Dry run again ");
161
+ i0.ɵɵelementEnd();
162
+ } }
163
+ /**
164
+ * `<mj-query-refresh-dialog>` — refreshes saved queries' metadata (fields, parameters, entities,
165
+ * dependencies) from their SQL and the database server, through the `Query.RefreshExtraction`
166
+ * remote operation.
167
+ *
168
+ * Opening it always starts with a dry run: the operation reports what would change and writes
169
+ * nothing, live progress shows as each query is checked, and the report is shown for review. The
170
+ * user then applies it, which runs the refresh for real and shows what was written. When
171
+ * `AllowSkipDryRun` is set, the review offers a user setting, "skip the dry run for future query
172
+ * refreshes"; with it on, a later opening applies straight away.
173
+ *
174
+ * Composite (L2): it calls the operation on `ProviderToUse` and reads and writes the user setting,
175
+ * but never navigates: a query the user asks to open is emitted as `OpenQuery`.
176
+ */
177
+ export class QueryRefreshDialogComponent extends BaseAngularComponent {
178
+ cdr = inject(ChangeDetectorRef);
179
+ _visible = false;
180
+ /** Increments on every run, so a run the user has moved on from cannot overwrite a newer one. */
181
+ runSequence = 0;
182
+ /** Which queries to refresh. */
183
+ Scope = null;
184
+ /** Names the scope in the dialog, e.g. `Query "Sales by Region"` or `Category "Reports"`. */
185
+ ScopeLabel = '';
186
+ Title = 'Refresh query metadata';
187
+ /** Whether the user may turn on "skip the dry run for future query refreshes". */
188
+ AllowSkipDryRun = false;
189
+ /** Whether query names in the report are buttons that emit {@link OpenQuery}. */
190
+ AllowOpenQuery = false;
191
+ set Visible(value) {
192
+ const opening = value && !this._visible;
193
+ this._visible = value;
194
+ // Start after this change detection pass has applied every input: a host that sets the
195
+ // scope and opens the dialog together may bind Visible before Scope.
196
+ if (opening)
197
+ void Promise.resolve().then(() => { if (this._visible)
198
+ return this.Start(); });
199
+ }
200
+ get Visible() {
201
+ return this._visible;
202
+ }
203
+ /** The dialog was closed. */
204
+ Closed = new EventEmitter();
205
+ /** A refresh was applied; carries its report. */
206
+ Applied = new EventEmitter();
207
+ /** The ID of a query the user asked to open from the report. */
208
+ OpenQuery = new EventEmitter();
209
+ Phase = 'Idle';
210
+ Report = null;
211
+ ErrorMessage = null;
212
+ Processed = 0;
213
+ Total = undefined;
214
+ ProgressMessage = '';
215
+ SkipDryRun = false;
216
+ get IsRunning() {
217
+ return this.Phase === 'DryRunning' || this.Phase === 'Applying';
218
+ }
219
+ get Percent() {
220
+ return QueryRefreshPercent(this.Processed, this.Total);
221
+ }
222
+ get CanApply() {
223
+ return this.Phase === 'Review' && QueryRefreshHasChanges(this.Report);
224
+ }
225
+ /** Begins a refresh: a dry run, or straight to applying when the user turned dry runs off. */
226
+ async Start() {
227
+ this.Report = null;
228
+ this.ErrorMessage = null;
229
+ this.SkipDryRun = this.AllowSkipDryRun && this.readSkipDryRunSetting();
230
+ if (IsQueryRefreshScopeEmpty(this.Scope)) {
231
+ this.fail('Nothing is selected to refresh.');
232
+ return;
233
+ }
234
+ await this.run(!this.SkipDryRun);
235
+ }
236
+ /** Applies the refresh the dry run reported. */
237
+ async Apply() {
238
+ if (this.IsRunning)
239
+ return;
240
+ await this.run(false);
241
+ }
242
+ /** Runs the dry run again, e.g. after the SQL or the database changed. */
243
+ async RunDryRunAgain() {
244
+ if (this.IsRunning)
245
+ return;
246
+ await this.run(true);
247
+ }
248
+ /** Turns the "skip the dry run for future query refreshes" setting on or off for this user. */
249
+ async OnSkipDryRunChange(value) {
250
+ this.SkipDryRun = value;
251
+ this.cdr.detectChanges();
252
+ try {
253
+ await UserInfoEngine.Instance.SetSetting(QUERY_REFRESH_SKIP_DRY_RUN_SETTING, value ? 'true' : 'false');
254
+ }
255
+ catch (error) {
256
+ console.error('[query-refresh-dialog] Could not save the dry-run setting:', error);
257
+ }
258
+ }
259
+ /** The setting's checkbox changed. */
260
+ async OnSkipDryRunToggled(event) {
261
+ const target = event.target;
262
+ if (target instanceof HTMLInputElement)
263
+ await this.OnSkipDryRunChange(target.checked);
264
+ }
265
+ Close() {
266
+ this.runSequence++;
267
+ this._visible = false;
268
+ this.Phase = 'Idle';
269
+ this.Closed.emit();
270
+ this.cdr.detectChanges();
271
+ }
272
+ async run(dryRun) {
273
+ const scope = this.Scope;
274
+ if (!scope)
275
+ return;
276
+ const sequence = ++this.runSequence;
277
+ this.beginPhase(dryRun ? 'DryRunning' : 'Applying');
278
+ try {
279
+ const result = await new QueryRefreshExtractionOperation().Execute(QueryRefreshInputFor(scope, dryRun), {
280
+ provider: this.ProviderToUse,
281
+ onProgress: p => this.onProgress(sequence, p),
282
+ });
283
+ if (sequence !== this.runSequence)
284
+ return;
285
+ if (!result.Success || !result.Output) {
286
+ this.fail(result.ErrorMessage || 'The refresh did not complete.');
287
+ return;
288
+ }
289
+ this.finish(result.Output, dryRun);
290
+ }
291
+ catch (error) {
292
+ if (sequence === this.runSequence)
293
+ this.fail(error instanceof Error ? error.message : String(error));
294
+ }
295
+ }
296
+ beginPhase(phase) {
297
+ this.Phase = phase;
298
+ this.ErrorMessage = null;
299
+ this.Processed = 0;
300
+ this.Total = undefined;
301
+ this.ProgressMessage = '';
302
+ this.cdr.detectChanges();
303
+ }
304
+ onProgress(sequence, progress) {
305
+ if (sequence !== this.runSequence)
306
+ return;
307
+ this.Processed = progress.Processed ?? this.Processed;
308
+ this.Total = progress.Total ?? this.Total;
309
+ this.ProgressMessage = progress.Message ?? '';
310
+ this.cdr.detectChanges();
311
+ }
312
+ finish(output, dryRun) {
313
+ this.Report = output;
314
+ this.Phase = dryRun ? 'Review' : 'Done';
315
+ this.cdr.detectChanges();
316
+ if (!dryRun)
317
+ this.Applied.emit(output);
318
+ }
319
+ fail(message) {
320
+ this.ErrorMessage = message;
321
+ this.Phase = 'Failed';
322
+ this.cdr.detectChanges();
323
+ }
324
+ readSkipDryRunSetting() {
325
+ try {
326
+ return UserInfoEngine.Instance.GetSetting(QUERY_REFRESH_SKIP_DRY_RUN_SETTING) === 'true';
327
+ }
328
+ catch {
329
+ return false;
330
+ }
331
+ }
332
+ static ɵfac = /*@__PURE__*/ (() => { let ɵQueryRefreshDialogComponent_BaseFactory; return function QueryRefreshDialogComponent_Factory(__ngFactoryType__) { return (ɵQueryRefreshDialogComponent_BaseFactory || (ɵQueryRefreshDialogComponent_BaseFactory = i0.ɵɵgetInheritedFactory(QueryRefreshDialogComponent)))(__ngFactoryType__ || QueryRefreshDialogComponent); }; })();
333
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: QueryRefreshDialogComponent, selectors: [["mj-query-refresh-dialog"]], inputs: { Scope: "Scope", ScopeLabel: "ScopeLabel", Title: "Title", AllowSkipDryRun: "AllowSkipDryRun", AllowOpenQuery: "AllowOpenQuery", Visible: "Visible" }, outputs: { Closed: "Closed", Applied: "Applied", OpenQuery: "OpenQuery" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 14, vars: 8, consts: [["Size", "xl", 3, "Close", "Visible", "Title"], [1, "qrd"], [1, "qrd-scope"], ["aria-live", "polite", 1, "qrd-progress"], ["role", "alert", 1, "qrd-banner", "qrd-banner--error"], [1, "qrd-setting"], ["mjButton", "", "Variant", "primary", "type", "button", 3, "disabled"], ["mjButton", "", "Variant", "outline", "type", "button"], ["mjButton", "", "Variant", "flat", "type", "button", 3, "click"], [1, "fa-solid", "fa-database"], [1, "qrd-progress-title"], ["Type", "infinite"], [3, "Value"], [1, "qrd-progress-text"], [1, "qrd-banner", "qrd-banner--info"], [1, "fa-solid", "fa-flask"], [3, "OpenQuery", "Output", "AllowOpenQuery"], [1, "qrd-banner", "qrd-banner--success"], [1, "fa-solid", "fa-circle-check"], [1, "fa-solid", "fa-circle-exclamation"], ["type", "checkbox", 3, "change", "checked"], ["mjButton", "", "Variant", "primary", "type", "button", 3, "click", "disabled"], [1, "fa-solid", "fa-check"], ["mjButton", "", "Variant", "outline", "type", "button", 3, "click"], [1, "fa-solid", "fa-rotate"]], template: function QueryRefreshDialogComponent_Template(rf, ctx) { if (rf & 1) {
334
+ i0.ɵɵelementStart(0, "mj-dialog", 0);
335
+ i0.ɵɵlistener("Close", function QueryRefreshDialogComponent_Template_mj_dialog_Close_0_listener() { return ctx.Close(); });
336
+ i0.ɵɵelementStart(1, "div", 1);
337
+ i0.ɵɵconditionalCreate(2, QueryRefreshDialogComponent_Conditional_2_Template, 3, 1, "div", 2);
338
+ i0.ɵɵconditionalCreate(3, QueryRefreshDialogComponent_Case_3_Template, 5, 1, "div", 3)(4, QueryRefreshDialogComponent_Case_4_Template, 5, 1, "div", 3)(5, QueryRefreshDialogComponent_Case_5_Template, 5, 3)(6, QueryRefreshDialogComponent_Case_6_Template, 4, 2)(7, QueryRefreshDialogComponent_Case_7_Template, 3, 1, "div", 4);
339
+ i0.ɵɵconditionalCreate(8, QueryRefreshDialogComponent_Conditional_8_Template, 3, 1, "label", 5);
340
+ i0.ɵɵelementEnd();
341
+ i0.ɵɵelementStart(9, "mj-dialog-actions");
342
+ i0.ɵɵconditionalCreate(10, QueryRefreshDialogComponent_Conditional_10_Template, 3, 1, "button", 6);
343
+ i0.ɵɵconditionalCreate(11, QueryRefreshDialogComponent_Conditional_11_Template, 3, 0, "button", 7);
344
+ i0.ɵɵelementStart(12, "button", 8);
345
+ i0.ɵɵlistener("click", function QueryRefreshDialogComponent_Template_button_click_12_listener() { return ctx.Close(); });
346
+ i0.ɵɵtext(13);
347
+ i0.ɵɵelementEnd()()();
348
+ } if (rf & 2) {
349
+ let tmp_3_0;
350
+ i0.ɵɵproperty("Visible", ctx.Visible)("Title", ctx.Title);
351
+ i0.ɵɵadvance(2);
352
+ i0.ɵɵconditional(ctx.ScopeLabel ? 2 : -1);
353
+ i0.ɵɵadvance();
354
+ i0.ɵɵconditional((tmp_3_0 = ctx.Phase) === "DryRunning" ? 3 : tmp_3_0 === "Applying" ? 4 : tmp_3_0 === "Review" ? 5 : tmp_3_0 === "Done" ? 6 : tmp_3_0 === "Failed" ? 7 : -1);
355
+ i0.ɵɵadvance(5);
356
+ i0.ɵɵconditional(ctx.AllowSkipDryRun && (ctx.Phase === "Review" || ctx.Phase === "Done") ? 8 : -1);
357
+ i0.ɵɵadvance(2);
358
+ i0.ɵɵconditional(ctx.Phase === "Review" ? 10 : -1);
359
+ i0.ɵɵadvance();
360
+ i0.ɵɵconditional(ctx.Phase === "Failed" || ctx.Phase === "Done" ? 11 : -1);
361
+ i0.ɵɵadvance(2);
362
+ i0.ɵɵtextInterpolate(ctx.Phase === "Review" ? "Cancel" : "Close");
363
+ } }, dependencies: [MJDialogComponent, MJDialogActionsComponent, MJButtonDirective, MJProgressBarComponent, QueryRefreshReportComponent], styles: ["[_nghost-%COMP%] {\n display: contents;\n}\n\n.qrd[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: var(--mj-space-3);\n min-height: 8rem;\n max-height: 65vh;\n overflow: auto;\n font-size: var(--mj-text-sm);\n color: var(--mj-text-primary);\n}\n\n.qrd-scope[_ngcontent-%COMP%] {\n color: var(--mj-text-secondary);\n display: flex;\n gap: var(--mj-space-2);\n align-items: center;\n}\n\n.qrd-progress[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: var(--mj-space-2);\n padding: var(--mj-space-4) 0;\n}\n\n.qrd-progress-title[_ngcontent-%COMP%] {\n font-weight: var(--mj-font-medium);\n}\n\n.qrd-progress-text[_ngcontent-%COMP%] {\n color: var(--mj-text-secondary);\n font-size: var(--mj-text-xs);\n}\n\n.qrd-banner[_ngcontent-%COMP%] {\n --qrd-accent: var(--mj-status-info);\n display: flex;\n gap: var(--mj-space-2);\n align-items: center;\n padding: var(--mj-space-2) var(--mj-space-3);\n border-radius: var(--mj-radius-md);\n border-left: 3px solid var(--qrd-accent);\n background: color-mix(in srgb, var(--qrd-accent) 8%, var(--mj-bg-surface));\n}\n\n.qrd-banner[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n color: var(--qrd-accent);\n}\n\n.qrd-banner--success[_ngcontent-%COMP%] { --qrd-accent: var(--mj-status-success); }\n.qrd-banner--error[_ngcontent-%COMP%] { --qrd-accent: var(--mj-status-error); }\n\n.qrd-setting[_ngcontent-%COMP%] {\n display: flex;\n gap: var(--mj-space-2);\n align-items: center;\n color: var(--mj-text-secondary);\n cursor: pointer;\n}"] });
364
+ }
365
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(QueryRefreshDialogComponent, [{
366
+ type: Component,
367
+ args: [{ standalone: true, selector: 'mj-query-refresh-dialog', imports: [MJDialogComponent, MJDialogActionsComponent, MJButtonDirective, MJProgressBarComponent, QueryRefreshReportComponent], template: "<mj-dialog [Visible]=\"Visible\" [Title]=\"Title\" Size=\"xl\" (Close)=\"Close()\">\n <div class=\"qrd\">\n @if (ScopeLabel) {\n <div class=\"qrd-scope\"><i class=\"fa-solid fa-database\"></i> {{ ScopeLabel }}</div>\n }\n\n @switch (Phase) {\n @case ('DryRunning') {\n <div class=\"qrd-progress\" aria-live=\"polite\">\n <div class=\"qrd-progress-title\">Checking what would change (dry run, nothing is written)\u2026</div>\n @if (Percent !== null) {\n <mj-progress-bar [Value]=\"Percent\" />\n <div class=\"qrd-progress-text\">{{ Processed }} of {{ Total }} queries @if (ProgressMessage) { \u00B7 {{ ProgressMessage }} }</div>\n } @else {\n <mj-progress-bar Type=\"infinite\" />\n }\n </div>\n }\n @case ('Applying') {\n <div class=\"qrd-progress\" aria-live=\"polite\">\n <div class=\"qrd-progress-title\">Applying the refresh\u2026</div>\n @if (Percent !== null) {\n <mj-progress-bar [Value]=\"Percent\" />\n <div class=\"qrd-progress-text\">{{ Processed }} of {{ Total }} queries @if (ProgressMessage) { \u00B7 {{ ProgressMessage }} }</div>\n } @else {\n <mj-progress-bar Type=\"infinite\" />\n }\n </div>\n }\n @case ('Review') {\n <div class=\"qrd-banner qrd-banner--info\">\n <i class=\"fa-solid fa-flask\"></i>\n @if (CanApply) {\n Dry run: these are the changes a refresh would make. Nothing has been written yet.\n } @else {\n Dry run: the stored metadata already matches the SQL. There is nothing to apply.\n }\n </div>\n <mj-query-refresh-report [Output]=\"Report\" [AllowOpenQuery]=\"AllowOpenQuery\" (OpenQuery)=\"OpenQuery.emit($event)\" />\n }\n @case ('Done') {\n <div class=\"qrd-banner qrd-banner--success\">\n <i class=\"fa-solid fa-circle-check\"></i> The refresh was applied.\n </div>\n <mj-query-refresh-report [Output]=\"Report\" [AllowOpenQuery]=\"AllowOpenQuery\" (OpenQuery)=\"OpenQuery.emit($event)\" />\n }\n @case ('Failed') {\n <div class=\"qrd-banner qrd-banner--error\" role=\"alert\">\n <i class=\"fa-solid fa-circle-exclamation\"></i> {{ ErrorMessage }}\n </div>\n }\n }\n\n @if (AllowSkipDryRun && (Phase === 'Review' || Phase === 'Done')) {\n <label class=\"qrd-setting\">\n <input type=\"checkbox\" [checked]=\"SkipDryRun\" (change)=\"OnSkipDryRunToggled($event)\" />\n Skip the dry run for future query refreshes\n </label>\n }\n </div>\n\n <mj-dialog-actions>\n @if (Phase === 'Review') {\n <button mjButton Variant=\"primary\" type=\"button\" [disabled]=\"!CanApply\" (click)=\"Apply()\">\n <i class=\"fa-solid fa-check\"></i> Apply changes\n </button>\n }\n @if (Phase === 'Failed' || Phase === 'Done') {\n <button mjButton Variant=\"outline\" type=\"button\" (click)=\"RunDryRunAgain()\">\n <i class=\"fa-solid fa-rotate\"></i> Dry run again\n </button>\n }\n <button mjButton Variant=\"flat\" type=\"button\" (click)=\"Close()\">{{ Phase === 'Review' ? 'Cancel' : 'Close' }}</button>\n </mj-dialog-actions>\n</mj-dialog>\n", styles: [":host {\n display: contents;\n}\n\n.qrd {\n display: flex;\n flex-direction: column;\n gap: var(--mj-space-3);\n min-height: 8rem;\n max-height: 65vh;\n overflow: auto;\n font-size: var(--mj-text-sm);\n color: var(--mj-text-primary);\n}\n\n.qrd-scope {\n color: var(--mj-text-secondary);\n display: flex;\n gap: var(--mj-space-2);\n align-items: center;\n}\n\n.qrd-progress {\n display: flex;\n flex-direction: column;\n gap: var(--mj-space-2);\n padding: var(--mj-space-4) 0;\n}\n\n.qrd-progress-title {\n font-weight: var(--mj-font-medium);\n}\n\n.qrd-progress-text {\n color: var(--mj-text-secondary);\n font-size: var(--mj-text-xs);\n}\n\n.qrd-banner {\n --qrd-accent: var(--mj-status-info);\n display: flex;\n gap: var(--mj-space-2);\n align-items: center;\n padding: var(--mj-space-2) var(--mj-space-3);\n border-radius: var(--mj-radius-md);\n border-left: 3px solid var(--qrd-accent);\n background: color-mix(in srgb, var(--qrd-accent) 8%, var(--mj-bg-surface));\n}\n\n.qrd-banner i {\n color: var(--qrd-accent);\n}\n\n.qrd-banner--success { --qrd-accent: var(--mj-status-success); }\n.qrd-banner--error { --qrd-accent: var(--mj-status-error); }\n\n.qrd-setting {\n display: flex;\n gap: var(--mj-space-2);\n align-items: center;\n color: var(--mj-text-secondary);\n cursor: pointer;\n}\n"] }]
368
+ }], null, { Scope: [{
369
+ type: Input
370
+ }], ScopeLabel: [{
371
+ type: Input
372
+ }], Title: [{
373
+ type: Input
374
+ }], AllowSkipDryRun: [{
375
+ type: Input
376
+ }], AllowOpenQuery: [{
377
+ type: Input
378
+ }], Visible: [{
379
+ type: Input
380
+ }], Closed: [{
381
+ type: Output
382
+ }], Applied: [{
383
+ type: Output
384
+ }], OpenQuery: [{
385
+ type: Output
386
+ }] }); })();
387
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryRefreshDialogComponent, { className: "QueryRefreshDialogComponent", filePath: "src/lib/query-refresh/query-refresh-dialog.component.ts", lineNumber: 43 }); })();
388
+ //# sourceMappingURL=query-refresh-dialog.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-refresh-dialog.component.js","sourceRoot":"","sources":["../../../src/lib/query-refresh/query-refresh-dialog.component.ts","../../../src/lib/query-refresh/query-refresh-dialog.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAElG,OAAO,EAAE,+BAA+B,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEhG,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,E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C;YACL,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;yRAjKQ,2BAA2B,yBAA3B,2BAA2B;6DAA3B,2BAA2B;YC1CxC,oCAA2E;YAAlB,2GAAS,WAAO,IAAC;YACxE,8BAAiB;YACf,6FAAkB;YA4ChB,AANA,AAXA,AAXA,AAXA,sFAAsB,gEAWF,sDAWF,sDAWF,gEAME;YAOpB,+FAAmE;YAMrE,iBAAM;YAEN,yCAAmB;YACjB,kGAA0B;YAK1B,kGAA8C;YAK9C,kCAAgE;YAAlB,yGAAS,WAAO,IAAC;YAAC,aAA6C;YAEjH,AADE,AAD+G,iBAAS,EACpG,EACV;;;YA1EmB,AAApB,qCAAmB,oBAAgB;YAE1C,eAEC;YAFD,yCAEC;YAED,cA6CC;YA7CD,2CAAA,YAAY,mBAAZ,UAAU,mBAAV,QAAQ,mBAAR,MAAM,mBAAN,QAAQ,UA6CP;YAED,eAKC;YALD,kGAKC;YAID,eAIC;YAJD,kDAIC;YACD,cAIC;YAJD,0EAIC;YAC+D,eAA6C;YAA7C,iEAA6C;4BDlCnG,iBAAiB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,2BAA2B;;iFAIpH,2BAA2B;cAPvC,SAAS;6BACM,IAAI,YACN,yBAAyB,WAC1B,CAAC,iBAAiB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,2BAA2B,CAAC;;kBAW7H,KAAK;;kBAEL,KAAK;;kBACL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAaL,MAAM;;kBAEN,MAAM;;kBAEN,MAAM;;kFAjCE,2BAA2B","sourcesContent":["import { ChangeDetectorRef, Component, EventEmitter, Input, Output, inject } from '@angular/core';\nimport type { RemoteOpProgress } from '@memberjunction/core';\nimport { QueryRefreshExtractionOperation, UserInfoEngine } from '@memberjunction/core-entities';\nimport type { QueryRefreshExtractionOutput } from '@memberjunction/core-entities';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport {\n MJButtonDirective,\n MJDialogActionsComponent,\n MJDialogComponent,\n MJProgressBarComponent,\n} from '@memberjunction/ng-ui-components';\nimport { QueryRefreshReportComponent } from './query-refresh-report.component';\nimport {\n IsQueryRefreshScopeEmpty,\n QUERY_REFRESH_SKIP_DRY_RUN_SETTING,\n QueryRefreshHasChanges,\n QueryRefreshInputFor,\n QueryRefreshPercent,\n} from './query-refresh-model';\nimport type { QueryRefreshPhase, QueryRefreshScope } from './query-refresh-model';\n\n/**\n * `<mj-query-refresh-dialog>` — refreshes saved queries' metadata (fields, parameters, entities,\n * dependencies) from their SQL and the database server, through the `Query.RefreshExtraction`\n * remote operation.\n *\n * Opening it always starts with a dry run: the operation reports what would change and writes\n * nothing, live progress shows as each query is checked, and the report is shown for review. The\n * user then applies it, which runs the refresh for real and shows what was written. When\n * `AllowSkipDryRun` is set, the review offers a user setting, \"skip the dry run for future query\n * refreshes\"; with it on, a later opening applies straight away.\n *\n * Composite (L2): it calls the operation on `ProviderToUse` and reads and writes the user setting,\n * but never navigates: a query the user asks to open is emitted as `OpenQuery`.\n */\n@Component({\n standalone: true,\n selector: 'mj-query-refresh-dialog',\n imports: [MJDialogComponent, MJDialogActionsComponent, MJButtonDirective, MJProgressBarComponent, QueryRefreshReportComponent],\n templateUrl: './query-refresh-dialog.component.html',\n styleUrls: ['./query-refresh-dialog.component.css'],\n})\nexport class QueryRefreshDialogComponent extends BaseAngularComponent {\n private cdr = inject(ChangeDetectorRef);\n private _visible = false;\n /** Increments on every run, so a run the user has moved on from cannot overwrite a newer one. */\n private runSequence = 0;\n\n /** Which queries to refresh. */\n @Input() Scope: QueryRefreshScope | null = null;\n /** Names the scope in the dialog, e.g. `Query \"Sales by Region\"` or `Category \"Reports\"`. */\n @Input() ScopeLabel = '';\n @Input() Title = 'Refresh query metadata';\n /** Whether the user may turn on \"skip the dry run for future query refreshes\". */\n @Input() AllowSkipDryRun = false;\n /** Whether query names in the report are buttons that emit {@link OpenQuery}. */\n @Input() AllowOpenQuery = false;\n\n @Input()\n set Visible(value: boolean) {\n const opening = value && !this._visible;\n this._visible = value;\n // Start after this change detection pass has applied every input: a host that sets the\n // scope and opens the dialog together may bind Visible before Scope.\n if (opening) void Promise.resolve().then(() => { if (this._visible) return this.Start(); });\n }\n get Visible(): boolean {\n return this._visible;\n }\n\n /** The dialog was closed. */\n @Output() Closed = new EventEmitter<void>();\n /** A refresh was applied; carries its report. */\n @Output() Applied = new EventEmitter<QueryRefreshExtractionOutput>();\n /** The ID of a query the user asked to open from the report. */\n @Output() OpenQuery = new EventEmitter<string>();\n\n public Phase: QueryRefreshPhase = 'Idle';\n public Report: QueryRefreshExtractionOutput | null = null;\n public ErrorMessage: string | null = null;\n public Processed = 0;\n public Total: number | undefined = undefined;\n public ProgressMessage = '';\n public SkipDryRun = false;\n\n public get IsRunning(): boolean {\n return this.Phase === 'DryRunning' || this.Phase === 'Applying';\n }\n\n public get Percent(): number | null {\n return QueryRefreshPercent(this.Processed, this.Total);\n }\n\n public get CanApply(): boolean {\n return this.Phase === 'Review' && QueryRefreshHasChanges(this.Report);\n }\n\n /** Begins a refresh: a dry run, or straight to applying when the user turned dry runs off. */\n public async Start(): Promise<void> {\n this.Report = null;\n this.ErrorMessage = null;\n this.SkipDryRun = this.AllowSkipDryRun && this.readSkipDryRunSetting();\n if (IsQueryRefreshScopeEmpty(this.Scope)) {\n this.fail('Nothing is selected to refresh.');\n return;\n }\n await this.run(!this.SkipDryRun);\n }\n\n /** Applies the refresh the dry run reported. */\n public async Apply(): Promise<void> {\n if (this.IsRunning) return;\n await this.run(false);\n }\n\n /** Runs the dry run again, e.g. after the SQL or the database changed. */\n public async RunDryRunAgain(): Promise<void> {\n if (this.IsRunning) return;\n await this.run(true);\n }\n\n /** Turns the \"skip the dry run for future query refreshes\" setting on or off for this user. */\n public async OnSkipDryRunChange(value: boolean): Promise<void> {\n this.SkipDryRun = value;\n this.cdr.detectChanges();\n try {\n await UserInfoEngine.Instance.SetSetting(QUERY_REFRESH_SKIP_DRY_RUN_SETTING, value ? 'true' : 'false');\n } catch (error) {\n console.error('[query-refresh-dialog] Could not save the dry-run setting:', error);\n }\n }\n\n /** The setting's checkbox changed. */\n public async OnSkipDryRunToggled(event: Event): Promise<void> {\n const target = event.target;\n if (target instanceof HTMLInputElement) await this.OnSkipDryRunChange(target.checked);\n }\n\n public Close(): void {\n this.runSequence++;\n this._visible = false;\n this.Phase = 'Idle';\n this.Closed.emit();\n this.cdr.detectChanges();\n }\n\n private async run(dryRun: boolean): Promise<void> {\n const scope = this.Scope;\n if (!scope) return;\n const sequence = ++this.runSequence;\n this.beginPhase(dryRun ? 'DryRunning' : 'Applying');\n try {\n const result = await new QueryRefreshExtractionOperation().Execute(QueryRefreshInputFor(scope, dryRun), {\n provider: this.ProviderToUse,\n onProgress: p => this.onProgress(sequence, p),\n });\n if (sequence !== this.runSequence) return;\n if (!result.Success || !result.Output) {\n this.fail(result.ErrorMessage || 'The refresh did not complete.');\n return;\n }\n this.finish(result.Output, dryRun);\n } catch (error) {\n if (sequence === this.runSequence) this.fail(error instanceof Error ? error.message : String(error));\n }\n }\n\n private beginPhase(phase: QueryRefreshPhase): void {\n this.Phase = phase;\n this.ErrorMessage = null;\n this.Processed = 0;\n this.Total = undefined;\n this.ProgressMessage = '';\n this.cdr.detectChanges();\n }\n\n private onProgress(sequence: number, progress: RemoteOpProgress): void {\n if (sequence !== this.runSequence) return;\n this.Processed = progress.Processed ?? this.Processed;\n this.Total = progress.Total ?? this.Total;\n this.ProgressMessage = progress.Message ?? '';\n this.cdr.detectChanges();\n }\n\n private finish(output: QueryRefreshExtractionOutput, dryRun: boolean): void {\n this.Report = output;\n this.Phase = dryRun ? 'Review' : 'Done';\n this.cdr.detectChanges();\n if (!dryRun) this.Applied.emit(output);\n }\n\n private fail(message: string): void {\n this.ErrorMessage = message;\n this.Phase = 'Failed';\n this.cdr.detectChanges();\n }\n\n private readSkipDryRunSetting(): boolean {\n try {\n return UserInfoEngine.Instance.GetSetting(QUERY_REFRESH_SKIP_DRY_RUN_SETTING) === 'true';\n } catch {\n return false;\n }\n }\n}\n","<mj-dialog [Visible]=\"Visible\" [Title]=\"Title\" Size=\"xl\" (Close)=\"Close()\">\n <div class=\"qrd\">\n @if (ScopeLabel) {\n <div class=\"qrd-scope\"><i class=\"fa-solid fa-database\"></i> {{ ScopeLabel }}</div>\n }\n\n @switch (Phase) {\n @case ('DryRunning') {\n <div class=\"qrd-progress\" aria-live=\"polite\">\n <div class=\"qrd-progress-title\">Checking what would change (dry run, nothing is written)…</div>\n @if (Percent !== null) {\n <mj-progress-bar [Value]=\"Percent\" />\n <div class=\"qrd-progress-text\">{{ Processed }} of {{ Total }} queries @if (ProgressMessage) { · {{ ProgressMessage }} }</div>\n } @else {\n <mj-progress-bar Type=\"infinite\" />\n }\n </div>\n }\n @case ('Applying') {\n <div class=\"qrd-progress\" aria-live=\"polite\">\n <div class=\"qrd-progress-title\">Applying the refresh…</div>\n @if (Percent !== null) {\n <mj-progress-bar [Value]=\"Percent\" />\n <div class=\"qrd-progress-text\">{{ Processed }} of {{ Total }} queries @if (ProgressMessage) { · {{ ProgressMessage }} }</div>\n } @else {\n <mj-progress-bar Type=\"infinite\" />\n }\n </div>\n }\n @case ('Review') {\n <div class=\"qrd-banner qrd-banner--info\">\n <i class=\"fa-solid fa-flask\"></i>\n @if (CanApply) {\n Dry run: these are the changes a refresh would make. Nothing has been written yet.\n } @else {\n Dry run: the stored metadata already matches the SQL. There is nothing to apply.\n }\n </div>\n <mj-query-refresh-report [Output]=\"Report\" [AllowOpenQuery]=\"AllowOpenQuery\" (OpenQuery)=\"OpenQuery.emit($event)\" />\n }\n @case ('Done') {\n <div class=\"qrd-banner qrd-banner--success\">\n <i class=\"fa-solid fa-circle-check\"></i> The refresh was applied.\n </div>\n <mj-query-refresh-report [Output]=\"Report\" [AllowOpenQuery]=\"AllowOpenQuery\" (OpenQuery)=\"OpenQuery.emit($event)\" />\n }\n @case ('Failed') {\n <div class=\"qrd-banner qrd-banner--error\" role=\"alert\">\n <i class=\"fa-solid fa-circle-exclamation\"></i> {{ ErrorMessage }}\n </div>\n }\n }\n\n @if (AllowSkipDryRun && (Phase === 'Review' || Phase === 'Done')) {\n <label class=\"qrd-setting\">\n <input type=\"checkbox\" [checked]=\"SkipDryRun\" (change)=\"OnSkipDryRunToggled($event)\" />\n Skip the dry run for future query refreshes\n </label>\n }\n </div>\n\n <mj-dialog-actions>\n @if (Phase === 'Review') {\n <button mjButton Variant=\"primary\" type=\"button\" [disabled]=\"!CanApply\" (click)=\"Apply()\">\n <i class=\"fa-solid fa-check\"></i> Apply changes\n </button>\n }\n @if (Phase === 'Failed' || Phase === 'Done') {\n <button mjButton Variant=\"outline\" type=\"button\" (click)=\"RunDryRunAgain()\">\n <i class=\"fa-solid fa-rotate\"></i> Dry run again\n </button>\n }\n <button mjButton Variant=\"flat\" type=\"button\" (click)=\"Close()\">{{ Phase === 'Review' ? 'Cancel' : 'Close' }}</button>\n </mj-dialog-actions>\n</mj-dialog>\n"]}
@@ -0,0 +1,50 @@
1
+ import type { QueryRefreshExtractionInput, QueryRefreshExtractionOutput, QueryRefreshQueryReport, QueryRefreshRowChange } from '@memberjunction/core-entities';
2
+ /**
3
+ * Plain functions over a query metadata refresh (`Query.RefreshExtraction`): what to refresh, and
4
+ * how to read the report. No Angular and no data access, so the dialog and its tests share them.
5
+ */
6
+ /** Which queries a refresh covers. */
7
+ export type QueryRefreshScope = {
8
+ readonly Kind: 'Queries';
9
+ readonly QueryIDs: readonly string[];
10
+ } | {
11
+ readonly Kind: 'Category';
12
+ readonly CategoryPath: string;
13
+ } | {
14
+ readonly Kind: 'All';
15
+ };
16
+ /** The step a refresh is at. */
17
+ export type QueryRefreshPhase = 'Idle' | 'DryRunning' | 'Review' | 'Applying' | 'Done' | 'Failed';
18
+ /** The user setting that sends a single-query refresh straight to applying, with no dry run. */
19
+ export declare const QUERY_REFRESH_SKIP_DRY_RUN_SETTING = "QueryRefresh_SkipDryRun";
20
+ /** How many child rows one query's refresh adds, updates, removes and flags. */
21
+ export interface QueryRefreshCounts {
22
+ readonly Added: number;
23
+ readonly Updated: number;
24
+ readonly Removed: number;
25
+ readonly Flagged: number;
26
+ }
27
+ /** One collection's changes in a query's report, for the drill-in. */
28
+ export interface QueryRefreshCollectionChanges {
29
+ readonly Collection: QueryRefreshRowChange['collection'];
30
+ readonly Added: readonly QueryRefreshRowChange[];
31
+ readonly Updated: readonly QueryRefreshRowChange[];
32
+ readonly Removed: readonly QueryRefreshRowChange[];
33
+ }
34
+ /** The operation input for a scope; a dry run reports the changes without writing them. */
35
+ export declare function QueryRefreshInputFor(scope: QueryRefreshScope, dryRun: boolean): QueryRefreshExtractionInput;
36
+ /** Whether a scope selects anything at all. */
37
+ export declare function IsQueryRefreshScopeEmpty(scope: QueryRefreshScope | null): boolean;
38
+ /** The change counts of one query's report. */
39
+ export declare function QueryRefreshCountsOf(report: QueryRefreshQueryReport): QueryRefreshCounts;
40
+ /** Whether applying would write anything: some query's outcome is `Refreshed`. */
41
+ export declare function QueryRefreshHasChanges(output: QueryRefreshExtractionOutput | null): boolean;
42
+ /** A report's changes grouped by collection, leaving out collections with none. */
43
+ export declare function QueryRefreshChangesByCollection(report: QueryRefreshQueryReport): QueryRefreshCollectionChanges[];
44
+ /** How a query's outcome reads in the report; a dry run says what would happen. */
45
+ export declare function QueryRefreshOutcomeLabel(report: QueryRefreshQueryReport, dryRun: boolean): string;
46
+ /** The number of queries in each outcome, for the report's summary line. */
47
+ export declare function QueryRefreshOutcomeTotals(output: QueryRefreshExtractionOutput): Record<QueryRefreshQueryReport['outcome'], number>;
48
+ /** A progress fraction from 0 to 100, or `null` while the total is unknown. */
49
+ export declare function QueryRefreshPercent(processed: number | undefined, total: number | undefined): number | null;
50
+ //# sourceMappingURL=query-refresh-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-refresh-model.d.ts","sourceRoot":"","sources":["../../../src/lib/query-refresh/query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,GAAG,2BAA2B,CAM3G;AAED,+CAA+C;AAC/C,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,GAAG,OAAO,CAKjF;AAED,+CAA+C;AAC/C,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,uBAAuB,GAAG,kBAAkB,CAExF;AAED,kFAAkF;AAClF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,4BAA4B,GAAG,IAAI,GAAG,OAAO,CAE3F;AAED,mFAAmF;AACnF,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,uBAAuB,GAAG,6BAA6B,EAAE,CAOhH;AAED,mFAAmF;AACnF,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,uBAAuB,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAQjG;AAED,4EAA4E;AAC5E,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,4BAA4B,GAAG,MAAM,CAAC,uBAAuB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAIlI;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAG3G"}
@@ -0,0 +1,62 @@
1
+ /** The user setting that sends a single-query refresh straight to applying, with no dry run. */
2
+ export const QUERY_REFRESH_SKIP_DRY_RUN_SETTING = 'QueryRefresh_SkipDryRun';
3
+ const COLLECTIONS = ['Fields', 'Parameters', 'Entities', 'Dependencies'];
4
+ /** The operation input for a scope; a dry run reports the changes without writing them. */
5
+ export function QueryRefreshInputFor(scope, dryRun) {
6
+ switch (scope.Kind) {
7
+ case 'Queries': return { queryIDs: [...scope.QueryIDs], dryRun };
8
+ case 'Category': return { categoryPath: scope.CategoryPath, dryRun };
9
+ case 'All': return { all: true, dryRun };
10
+ }
11
+ }
12
+ /** Whether a scope selects anything at all. */
13
+ export function IsQueryRefreshScopeEmpty(scope) {
14
+ if (!scope)
15
+ return true;
16
+ if (scope.Kind === 'Queries')
17
+ return scope.QueryIDs.length === 0;
18
+ if (scope.Kind === 'Category')
19
+ return scope.CategoryPath.trim().length === 0;
20
+ return false;
21
+ }
22
+ /** The change counts of one query's report. */
23
+ export function QueryRefreshCountsOf(report) {
24
+ return { Added: report.added.length, Updated: report.updated.length, Removed: report.removed.length, Flagged: report.flagged.length };
25
+ }
26
+ /** Whether applying would write anything: some query's outcome is `Refreshed`. */
27
+ export function QueryRefreshHasChanges(output) {
28
+ return !!output && output.reports.some(r => r.outcome === 'Refreshed');
29
+ }
30
+ /** A report's changes grouped by collection, leaving out collections with none. */
31
+ export function QueryRefreshChangesByCollection(report) {
32
+ return COLLECTIONS.map(collection => ({
33
+ Collection: collection,
34
+ Added: report.added.filter(c => c.collection === collection),
35
+ Updated: report.updated.filter(c => c.collection === collection),
36
+ Removed: report.removed.filter(c => c.collection === collection),
37
+ })).filter(g => g.Added.length + g.Updated.length + g.Removed.length > 0);
38
+ }
39
+ /** How a query's outcome reads in the report; a dry run says what would happen. */
40
+ export function QueryRefreshOutcomeLabel(report, dryRun) {
41
+ switch (report.outcome) {
42
+ case 'Refreshed': return dryRun ? 'Would change' : 'Refreshed';
43
+ case 'Unchanged': return 'Unchanged';
44
+ case 'NotPermitted': return 'Skipped';
45
+ case 'Unavailable': return 'Not available';
46
+ case 'Failed': return 'Failed';
47
+ }
48
+ }
49
+ /** The number of queries in each outcome, for the report's summary line. */
50
+ export function QueryRefreshOutcomeTotals(output) {
51
+ const totals = { Refreshed: 0, Unchanged: 0, NotPermitted: 0, Unavailable: 0, Failed: 0 };
52
+ for (const report of output.reports)
53
+ totals[report.outcome]++;
54
+ return totals;
55
+ }
56
+ /** A progress fraction from 0 to 100, or `null` while the total is unknown. */
57
+ export function QueryRefreshPercent(processed, total) {
58
+ if (!total || total <= 0 || processed === undefined)
59
+ return null;
60
+ return Math.max(0, Math.min(100, Math.round((processed / total) * 100)));
61
+ }
62
+ //# sourceMappingURL=query-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AAK,WAAW,CAAC,CAAC,OAAO,WAAW,CAAC;QACrC,KAAK,cAAc,CAAC,CAAC,OAAO,SAAS,CAAC;QACtC,KAAK,aAAa,CAAC,CAAC,OAAO,eAAe,CAAC;QAC3C,KAAK,QAAQ,CAAC,CAAC,OAAO,QAAQ,CAAC;IACnC,CAAC;AACL,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,yBAAyB,CAAC,MAAoC;IAC1E,MAAM,MAAM,GAAuD,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAC9I,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO;QAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9D,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,mBAAmB,CAAC,SAA6B,EAAE,KAAyB;IACxF,IAAI,CAAC,KAAK,IAAI,KAAK,IAAI,CAAC,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACjE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import type {\n QueryRefreshExtractionInput,\n QueryRefreshExtractionOutput,\n QueryRefreshQueryReport,\n QueryRefreshRowChange,\n} from '@memberjunction/core-entities';\n\n/**\n * Plain functions over a query metadata refresh (`Query.RefreshExtraction`): what to refresh, and\n * how to read the report. No Angular and no data access, so the dialog and its tests share them.\n */\n\n/** Which queries a refresh covers. */\nexport type QueryRefreshScope =\n | { readonly Kind: 'Queries'; readonly QueryIDs: readonly string[] }\n | { readonly Kind: 'Category'; readonly CategoryPath: string }\n | { readonly Kind: 'All' };\n\n/** The step a refresh is at. */\nexport type QueryRefreshPhase = 'Idle' | 'DryRunning' | 'Review' | 'Applying' | 'Done' | 'Failed';\n\n/** The user setting that sends a single-query refresh straight to applying, with no dry run. */\nexport const QUERY_REFRESH_SKIP_DRY_RUN_SETTING = 'QueryRefresh_SkipDryRun';\n\n/** How many child rows one query's refresh adds, updates, removes and flags. */\nexport interface QueryRefreshCounts {\n readonly Added: number;\n readonly Updated: number;\n readonly Removed: number;\n readonly Flagged: number;\n}\n\n/** One collection's changes in a query's report, for the drill-in. */\nexport interface QueryRefreshCollectionChanges {\n readonly Collection: QueryRefreshRowChange['collection'];\n readonly Added: readonly QueryRefreshRowChange[];\n readonly Updated: readonly QueryRefreshRowChange[];\n readonly Removed: readonly QueryRefreshRowChange[];\n}\n\nconst COLLECTIONS: readonly QueryRefreshRowChange['collection'][] = ['Fields', 'Parameters', 'Entities', 'Dependencies'];\n\n/** The operation input for a scope; a dry run reports the changes without writing them. */\nexport function QueryRefreshInputFor(scope: QueryRefreshScope, dryRun: boolean): QueryRefreshExtractionInput {\n switch (scope.Kind) {\n case 'Queries': return { queryIDs: [...scope.QueryIDs], dryRun };\n case 'Category': return { categoryPath: scope.CategoryPath, dryRun };\n case 'All': return { all: true, dryRun };\n }\n}\n\n/** Whether a scope selects anything at all. */\nexport function IsQueryRefreshScopeEmpty(scope: QueryRefreshScope | null): boolean {\n if (!scope) return true;\n if (scope.Kind === 'Queries') return scope.QueryIDs.length === 0;\n if (scope.Kind === 'Category') return scope.CategoryPath.trim().length === 0;\n return false;\n}\n\n/** The change counts of one query's report. */\nexport function QueryRefreshCountsOf(report: QueryRefreshQueryReport): QueryRefreshCounts {\n return { Added: report.added.length, Updated: report.updated.length, Removed: report.removed.length, Flagged: report.flagged.length };\n}\n\n/** Whether applying would write anything: some query's outcome is `Refreshed`. */\nexport function QueryRefreshHasChanges(output: QueryRefreshExtractionOutput | null): boolean {\n return !!output && output.reports.some(r => r.outcome === 'Refreshed');\n}\n\n/** A report's changes grouped by collection, leaving out collections with none. */\nexport function QueryRefreshChangesByCollection(report: QueryRefreshQueryReport): QueryRefreshCollectionChanges[] {\n return COLLECTIONS.map(collection => ({\n Collection: collection,\n Added: report.added.filter(c => c.collection === collection),\n Updated: report.updated.filter(c => c.collection === collection),\n Removed: report.removed.filter(c => c.collection === collection),\n })).filter(g => g.Added.length + g.Updated.length + g.Removed.length > 0);\n}\n\n/** How a query's outcome reads in the report; a dry run says what would happen. */\nexport function QueryRefreshOutcomeLabel(report: QueryRefreshQueryReport, dryRun: boolean): string {\n switch (report.outcome) {\n case 'Refreshed': return dryRun ? 'Would change' : 'Refreshed';\n case 'Unchanged': return 'Unchanged';\n case 'NotPermitted': return 'Skipped';\n case 'Unavailable': return 'Not available';\n case 'Failed': return 'Failed';\n }\n}\n\n/** The number of queries in each outcome, for the report's summary line. */\nexport function QueryRefreshOutcomeTotals(output: QueryRefreshExtractionOutput): Record<QueryRefreshQueryReport['outcome'], number> {\n const totals: Record<QueryRefreshQueryReport['outcome'], number> = { Refreshed: 0, Unchanged: 0, NotPermitted: 0, Unavailable: 0, Failed: 0 };\n for (const report of output.reports) totals[report.outcome]++;\n return totals;\n}\n\n/** A progress fraction from 0 to 100, or `null` while the total is unknown. */\nexport function QueryRefreshPercent(processed: number | undefined, total: number | undefined): number | null {\n if (!total || total <= 0 || processed === undefined) return null;\n return Math.max(0, Math.min(100, Math.round((processed / total) * 100)));\n}\n"]}
@@ -0,0 +1,44 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import type { QueryRefreshExtractionOutput, QueryRefreshQueryReport } from '@memberjunction/core-entities';
3
+ import type { QueryDiagnosticLine } from '@memberjunction/core-entities';
4
+ import { QueryRefreshOutcomeTotals } from './query-refresh-model';
5
+ import type { QueryRefreshCollectionChanges, QueryRefreshCounts } from './query-refresh-model';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * `<mj-query-refresh-report>` — the report of a query metadata refresh: one row per query with its
9
+ * outcome, the extraction status it records and how many fields, parameters, entities and
10
+ * dependencies it adds, updates and removes. A row with details expands to list each change, the
11
+ * authored parameters the SQL no longer uses, and the run's diagnostics.
12
+ *
13
+ * Presentational: the operation's output in, `OpenQuery` out (the host decides where that goes).
14
+ * A row starts expanded when the report holds a single query.
15
+ */
16
+ export declare class QueryRefreshReportComponent {
17
+ private _output;
18
+ private expanded;
19
+ /** The refresh's output. */
20
+ set Output(value: QueryRefreshExtractionOutput | null);
21
+ get Output(): QueryRefreshExtractionOutput | null;
22
+ /** Whether a query's name is a button that emits {@link OpenQuery}. */
23
+ AllowOpenQuery: boolean;
24
+ /** The ID of a query the user asked to open. */
25
+ OpenQuery: EventEmitter<string>;
26
+ get Reports(): readonly QueryRefreshQueryReport[];
27
+ get Totals(): ReturnType<typeof QueryRefreshOutcomeTotals> | null;
28
+ KeyOf(report: QueryRefreshQueryReport, index: number): string;
29
+ CountsOf(report: QueryRefreshQueryReport): QueryRefreshCounts;
30
+ OutcomeLabel(report: QueryRefreshQueryReport): string;
31
+ /** The outcome as a CSS modifier: `refreshed`, `unchanged`, `notpermitted`, `unavailable`, `failed`. */
32
+ OutcomeClass(report: QueryRefreshQueryReport): string;
33
+ StatusClass(report: QueryRefreshQueryReport): string;
34
+ ChangesOf(report: QueryRefreshQueryReport): QueryRefreshCollectionChanges[];
35
+ DiagnosticsOf(report: QueryRefreshQueryReport): QueryDiagnosticLine[];
36
+ /** Whether a report has anything to show when expanded. */
37
+ HasDetails(report: QueryRefreshQueryReport): boolean;
38
+ IsExpanded(report: QueryRefreshQueryReport, index: number): boolean;
39
+ ToggleExpanded(report: QueryRefreshQueryReport, index: number): void;
40
+ private keyOf;
41
+ static ɵfac: i0.ɵɵFactoryDeclaration<QueryRefreshReportComponent, never>;
42
+ static ɵcmp: i0.ɵɵComponentDeclaration<QueryRefreshReportComponent, "mj-query-refresh-report", never, { "Output": { "alias": "Output"; "required": false; }; "AllowOpenQuery": { "alias": "AllowOpenQuery"; "required": false; }; }, { "OpenQuery": "OpenQuery"; }, never, never, true, never>;
43
+ }
44
+ //# sourceMappingURL=query-refresh-report.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-refresh-report.component.d.ts","sourceRoot":"","sources":["../../../src/lib/query-refresh/query-refresh-report.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,YAAY,EAAiB,MAAM,eAAe,CAAC;AAChG,OAAO,KAAK,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAE3G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAIH,yBAAyB,EAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,6BAA6B,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;;AAE/F;;;;;;;;GAQG;AACH,qBAQa,2BAA2B;IACpC,OAAO,CAAC,OAAO,CAA6C;IAC5D,OAAO,CAAC,QAAQ,CAAqB;IAErC,4BAA4B;IAC5B,IACI,MAAM,CAAC,KAAK,EAAE,4BAA4B,GAAG,IAAI,EAGpD;IACD,IAAI,MAAM,IAAI,4BAA4B,GAAG,IAAI,CAEhD;IAED,uEAAuE;IAC9D,cAAc,UAAS;IAEhC,gDAAgD;IACtC,SAAS,uBAA8B;IAEjD,IAAW,OAAO,IAAI,SAAS,uBAAuB,EAAE,CAEvD;IAED,IAAW,MAAM,IAAI,UAAU,CAAC,OAAO,yBAAyB,CAAC,GAAG,IAAI,CAEvE;IAEM,KAAK,CAAC,MAAM,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAI7D,QAAQ,CAAC,MAAM,EAAE,uBAAuB,GAAG,kBAAkB;IAI7D,YAAY,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM;IAI5D,wGAAwG;IACjG,YAAY,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM;IAIrD,WAAW,CAAC,MAAM,EAAE,uB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