@gooddata/sdk-ui 10.22.0-alpha.2 → 10.22.0-alpha.20

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 (60) hide show
  1. package/esm/base/index.d.ts +3 -1
  2. package/esm/base/index.d.ts.map +1 -1
  3. package/esm/base/index.js +3 -2
  4. package/esm/base/index.js.map +1 -1
  5. package/esm/base/react/CancelablePromise.d.ts +1 -1
  6. package/esm/base/react/CancelablePromise.d.ts.map +1 -1
  7. package/esm/base/react/CancelablePromise.js +32 -18
  8. package/esm/base/react/CancelablePromise.js.map +1 -1
  9. package/esm/base/react/CorrelationContext.d.ts +70 -0
  10. package/esm/base/react/CorrelationContext.d.ts.map +1 -0
  11. package/esm/base/react/CorrelationContext.js +88 -0
  12. package/esm/base/react/CorrelationContext.js.map +1 -0
  13. package/esm/base/react/PromiseCache.js +2 -2
  14. package/esm/base/react/PromiseCache.js.map +1 -1
  15. package/esm/base/react/useCancelablePromise.d.ts +8 -1
  16. package/esm/base/react/useCancelablePromise.d.ts.map +1 -1
  17. package/esm/base/react/useCancelablePromise.js +3 -3
  18. package/esm/base/react/useCancelablePromise.js.map +1 -1
  19. package/esm/base/vis/export.d.ts +8 -1
  20. package/esm/base/vis/export.d.ts.map +1 -1
  21. package/esm/base/vis/export.js +10 -1
  22. package/esm/base/vis/export.js.map +1 -1
  23. package/esm/execution/DataViewLoader.d.ts +6 -0
  24. package/esm/execution/DataViewLoader.d.ts.map +1 -1
  25. package/esm/execution/DataViewLoader.js +13 -2
  26. package/esm/execution/DataViewLoader.js.map +1 -1
  27. package/esm/execution/Execute.d.ts +9 -0
  28. package/esm/execution/Execute.d.ts.map +1 -1
  29. package/esm/execution/Execute.js +2 -1
  30. package/esm/execution/Execute.js.map +1 -1
  31. package/esm/execution/ExecuteInsight.d.ts +9 -0
  32. package/esm/execution/ExecuteInsight.d.ts.map +1 -1
  33. package/esm/execution/ExecuteInsight.js +3 -2
  34. package/esm/execution/ExecuteInsight.js.map +1 -1
  35. package/esm/execution/RawExecute.d.ts +9 -0
  36. package/esm/execution/RawExecute.d.ts.map +1 -1
  37. package/esm/execution/RawExecute.js +2 -1
  38. package/esm/execution/RawExecute.js.map +1 -1
  39. package/esm/execution/useExecutionDataView.d.ts +9 -0
  40. package/esm/execution/useExecutionDataView.d.ts.map +1 -1
  41. package/esm/execution/useExecutionDataView.js +20 -12
  42. package/esm/execution/useExecutionDataView.js.map +1 -1
  43. package/esm/execution/useInsightDataView.d.ts +9 -0
  44. package/esm/execution/useInsightDataView.d.ts.map +1 -1
  45. package/esm/execution/useInsightDataView.js +2 -1
  46. package/esm/execution/useInsightDataView.js.map +1 -1
  47. package/esm/execution/withExecution.d.ts +9 -0
  48. package/esm/execution/withExecution.d.ts.map +1 -1
  49. package/esm/execution/withExecution.js +11 -4
  50. package/esm/execution/withExecution.js.map +1 -1
  51. package/esm/execution/withExecutionLoading.d.ts +11 -1
  52. package/esm/execution/withExecutionLoading.d.ts.map +1 -1
  53. package/esm/execution/withExecutionLoading.js +7 -4
  54. package/esm/execution/withExecutionLoading.js.map +1 -1
  55. package/esm/index.d.ts +2 -0
  56. package/esm/index.d.ts.map +1 -1
  57. package/esm/index.js +2 -1
  58. package/esm/index.js.map +1 -1
  59. package/esm/sdk-ui.d.ts +162 -3
  60. package/package.json +8 -8
package/esm/sdk-ui.d.ts CHANGED
@@ -56,6 +56,7 @@ import { IPositiveAttributeFilter } from '@gooddata/sdk-model';
56
56
  import { IPreparedExecution } from '@gooddata/sdk-backend-spi';
57
57
  import { IRankingFilter } from '@gooddata/sdk-model';
58
58
  import { IRelativeDateFilter } from '@gooddata/sdk-model';
59
+ import { IRequestCorrelationMetadata } from '@gooddata/sdk-backend-spi';
59
60
  import { IResultAttributeHeader } from '@gooddata/sdk-model';
60
61
  import { IResultAttributeHeaderItem } from '@gooddata/sdk-model';
61
62
  import { IResultHeader } from '@gooddata/sdk-model';
@@ -209,6 +210,15 @@ export declare type AttributesOrPlaceholders = ValuesOrPlaceholders<IAttribute>;
209
210
  */
210
211
  export declare const BackendProvider: React_2.FC<IBackendProviderProps>;
211
212
 
213
+ /**
214
+ * Combined provider for both backend and correlation metadata.
215
+ * This is a convenience component that wraps BackendProvider and CorrelationProvider
216
+ * to provide both a backend instance and correlation metadata to components.
217
+ *
218
+ * @public
219
+ */
220
+ export declare const BackendProviderWithCorrelation: React_2.FC<IBackendProviderWithCorrelationProps>;
221
+
212
222
  /**
213
223
  * This error means that server could not understand the request due to invalid syntax.
214
224
  *
@@ -369,6 +379,14 @@ export declare function convertDrillableItemsToPredicates(drillableItems: Explic
369
379
  */
370
380
  export declare function convertError(error: unknown): GoodDataSdkError;
371
381
 
382
+ /**
383
+ * CorrelationProvider provides request correlation metadata to components.
384
+ * When nested, correlation metadata from ancestor providers is merged with the current provider.
385
+ *
386
+ * @public
387
+ */
388
+ export declare const CorrelationProvider: React_2.FC<ICorrelationProviderProps>;
389
+
372
390
  /**
373
391
  * Creates function that should be passed to onExportReady in the event that the backend execution
374
392
  * fails and export is not possible.
@@ -388,6 +406,14 @@ export declare function createExportErrorFunction(error: GoodDataSdkError): IExp
388
406
  */
389
407
  export declare function createExportFunction(result: IExecutionResult, exportTitle?: string): IExportFunction;
390
408
 
409
+ /**
410
+ * Creates function to export Raw data in the provided result.
411
+ *
412
+ * @param result - data view that will be exported
413
+ * @internal
414
+ */
415
+ export declare function createExportRawFunction(result: IExecutionResult, filename: string): Promise<IExportResult>;
416
+
391
417
  /**
392
418
  * @internal
393
419
  */
@@ -761,6 +787,12 @@ export declare class DataViewLoader {
761
787
  * @alpha
762
788
  */
763
789
  withTotals: (...totals: ITotal[]) => DataViewLoader;
790
+ /**
791
+ * Runs execution with the provided AbortSignal.
792
+ *
793
+ * @alpha
794
+ */
795
+ withSignal: (signal: AbortSignal) => DataViewLoader;
764
796
  /**
765
797
  * Loads subset of the result data and wraps them in {@link DataViewFacade}.
766
798
  *
@@ -1263,6 +1295,26 @@ export declare interface IBackendProviderProps {
1263
1295
  children?: React_2.ReactNode;
1264
1296
  }
1265
1297
 
1298
+ /**
1299
+ * Combined provider for both backend and correlation metadata.
1300
+ *
1301
+ * @public
1302
+ */
1303
+ export declare interface IBackendProviderWithCorrelationProps {
1304
+ /**
1305
+ * Backend instance to use or enhance with correlation
1306
+ */
1307
+ backend?: IAnalyticalBackend;
1308
+ /**
1309
+ * Key-value pairs of correlation metadata to be used for telemetry
1310
+ */
1311
+ correlationData: IRequestCorrelationMetadata;
1312
+ /**
1313
+ * React children
1314
+ */
1315
+ children?: React_2.ReactNode;
1316
+ }
1317
+
1266
1318
  /**
1267
1319
  * @internal
1268
1320
  */
@@ -1402,6 +1454,21 @@ export declare interface IComposedPlaceholder<TReturn, TValue extends any[], TCo
1402
1454
  use: IUseComposedPlaceholderHook<IComposedPlaceholder<TReturn, TValue, TContext>>;
1403
1455
  }
1404
1456
 
1457
+ /**
1458
+ * Props of the {@link CorrelationProvider} component.
1459
+ * @public
1460
+ */
1461
+ export declare interface ICorrelationProviderProps {
1462
+ /**
1463
+ * Key-value pairs of correlation metadata to be used for telemetry
1464
+ */
1465
+ correlationData: Record<string, string>;
1466
+ /**
1467
+ * React children
1468
+ */
1469
+ children?: React_2.ReactNode;
1470
+ }
1471
+
1405
1472
  /**
1406
1473
  * Defines methods to access data in the data view.
1407
1474
  *
@@ -1934,6 +2001,15 @@ export declare interface IExecuteInsightProps extends IWithLoadingEvents<IExecut
1934
2001
  * this mode.
1935
2002
  */
1936
2003
  executeByReference?: boolean;
2004
+ /**
2005
+ * Optionally enable real execution cancellation.
2006
+ *
2007
+ * This means that if the execution request is not yet finished and the execution changes,
2008
+ * the request will be cancelled and the new execution will be started.
2009
+ *
2010
+ * Default: false
2011
+ */
2012
+ enableExecutionCancelling?: boolean;
1937
2013
  /**
1938
2014
  * Child component to which rendering is delegated.
1939
2015
  *
@@ -2053,6 +2129,15 @@ export declare interface IExecuteProps extends IWithLoadingEvents<IExecuteProps>
2053
2129
  * If not specified, all data will be loaded.
2054
2130
  */
2055
2131
  window?: DataViewWindow;
2132
+ /**
2133
+ * Optionally enable real execution cancellation.
2134
+ *
2135
+ * This means that if the execution request is not yet finished and the execution changes,
2136
+ * the request will be cancelled and the new execution will be started.
2137
+ *
2138
+ * Default: false
2139
+ */
2140
+ enableExecutionCancelling?: boolean;
2056
2141
  /**
2057
2142
  * Child component to which rendering is delegated.
2058
2143
  *
@@ -2556,6 +2641,15 @@ export declare interface IRawExecuteProps extends IWithLoadingEvents<IRawExecute
2556
2641
  * to trigger the execution and loading.
2557
2642
  */
2558
2643
  loadOnMount?: boolean;
2644
+ /**
2645
+ * Optionally enable real execution cancellation.
2646
+ *
2647
+ * This means that if the execution request is not yet finished and the execution changes,
2648
+ * the request will be cancelled and the new execution will be started.
2649
+ *
2650
+ * Default: false
2651
+ */
2652
+ enableExecutionCancelling?: boolean;
2559
2653
  /**
2560
2654
  * Child component to which rendering is delegated.
2561
2655
  *
@@ -3068,6 +3162,15 @@ export declare interface IUseExecutionDataViewConfig {
3068
3162
  * workspace here, then the executor MUST be rendered within an existing WorkspaceContext.
3069
3163
  */
3070
3164
  workspace?: string;
3165
+ /**
3166
+ * Optionally enable real execution cancellation.
3167
+ *
3168
+ * This means that if the execution request is not yet finished and the execution changes,
3169
+ * the request will be cancelled and the new execution will be started.
3170
+ *
3171
+ * Default: false
3172
+ */
3173
+ enableExecutionCancelling?: boolean;
3071
3174
  }
3072
3175
 
3073
3176
  /**
@@ -3139,6 +3242,15 @@ export declare interface IUseInsightDataViewConfig {
3139
3242
  * workspace here, then the executor MUST be rendered within an existing WorkspaceContext.
3140
3243
  */
3141
3244
  workspace?: string;
3245
+ /**
3246
+ * Optionally enable real execution cancellation.
3247
+ *
3248
+ * This means that if the execution request is not yet finished and the execution changes,
3249
+ * the request will be cancelled and the new execution will be started.
3250
+ *
3251
+ * Default: false
3252
+ */
3253
+ enableExecutionCancelling?: boolean;
3142
3254
  }
3143
3255
 
3144
3256
  /**
@@ -3270,6 +3382,15 @@ export declare interface IWithExecution<T> {
3270
3382
  * Specify event callbacks which the HOC will trigger in different situations.
3271
3383
  */
3272
3384
  events?: IWithLoadingEvents<T> | ((props: T) => IWithLoadingEvents<T>);
3385
+ /**
3386
+ * Optionally enable real execution cancellation.
3387
+ *
3388
+ * This means that if the execution request is not yet finished and the execution changes,
3389
+ * the request will be cancelled and the new execution will be started.
3390
+ *
3391
+ * Default: false
3392
+ */
3393
+ enableExecutionCancelling?: boolean | ((props: T) => boolean);
3273
3394
  /**
3274
3395
  * Customize, whether execution & data loading should start as soon as component is mounted.
3275
3396
  *
@@ -3315,8 +3436,9 @@ export declare interface IWithExecutionLoading<TProps> {
3315
3436
  *
3316
3437
  * @param props - wrapped component props
3317
3438
  * @param window - data view window to retrieve, not specified in case all data should be retrieved
3439
+ * @param signal - abort signal, will be used to cancel the execution
3318
3440
  */
3319
- promiseFactory: (props: TProps, window?: DataViewWindow) => Promise<DataViewFacade>;
3441
+ promiseFactory: (props: TProps, window?: DataViewWindow, signal?: AbortSignal) => Promise<DataViewFacade>;
3320
3442
  /**
3321
3443
  * Specify data view window to retrieve from backend.
3322
3444
  *
@@ -3343,6 +3465,15 @@ export declare interface IWithExecutionLoading<TProps> {
3343
3465
  * @param nextProps - next props
3344
3466
  */
3345
3467
  shouldRefetch?: (prevProps: TProps, nextProps: TProps) => boolean;
3468
+ /**
3469
+ * Optionally enable real execution cancellation.
3470
+ *
3471
+ * This means that if the execution request is not yet finished and the execution changes,
3472
+ * the request will be cancelled and the new execution will be started.
3473
+ *
3474
+ * Default: false
3475
+ */
3476
+ enableExecutionCancelling?: boolean | ((props: TProps) => boolean);
3346
3477
  }
3347
3478
 
3348
3479
  /**
@@ -3455,7 +3586,7 @@ export declare function localIdentifierMatch(localIdOrMeasure: string | IMeasure
3455
3586
  *
3456
3587
  * @internal
3457
3588
  */
3458
- export declare function makeCancelable<T>(promise: Promise<T>): ICancelablePromise<T>;
3589
+ export declare function makeCancelable<T>(promise: (signal: AbortSignal) => Promise<T>, enableAbortController?: boolean): ICancelablePromise<T>;
3459
3590
 
3460
3591
  /**
3461
3592
  * Generate union of measures from union of measure definitions.
@@ -4017,6 +4148,20 @@ export declare const useBackend: (backend?: IAnalyticalBackend) => IAnalyticalBa
4017
4148
  */
4018
4149
  export declare const useBackendStrict: (backend?: IAnalyticalBackend, context?: string) => IAnalyticalBackend;
4019
4150
 
4151
+ /**
4152
+ * Hook to get a backend instance with correlation metadata from context,
4153
+ * and optionally merge them with additional correlation metadata provided as a parameter.
4154
+ *
4155
+ * @remarks
4156
+ * This hook enhances the backend from useBackend() with correlation metadata
4157
+ * from the nearest CorrelationProvider.
4158
+ *
4159
+ * @param backend - optional backend override
4160
+ * @param correlationMetadata - optional correlation metadata to merge with the context data
4161
+ * @public
4162
+ */
4163
+ export declare const useBackendWithCorrelation: (backend?: IAnalyticalBackend, correlationMetadata?: IRequestCorrelationMetadata) => IAnalyticalBackend | undefined;
4164
+
4020
4165
  /**
4021
4166
  * This hook provides easy way to work with Promises in React components.
4022
4167
  *
@@ -4088,7 +4233,14 @@ export declare type UseCancelablePromiseLoadingState = {
4088
4233
  * @public
4089
4234
  */
4090
4235
  export declare type UseCancelablePromiseOptions<TResult, TError> = UseCancelablePromiseCallbacks<TResult, TError> & {
4091
- promise: (() => Promise<TResult>) | undefined | null;
4236
+ promise: ((signal: AbortSignal) => Promise<TResult>) | undefined | null;
4237
+ /**
4238
+ * Optionally enable the AbortController that will be aborted when the dependency list changes, if the promise is still running.
4239
+ *
4240
+ * Note that the provided promise implementation must support cancellation by handling
4241
+ * the AbortSignal parameter.
4242
+ */
4243
+ enableAbortController?: boolean;
4092
4244
  };
4093
4245
 
4094
4246
  /**
@@ -4159,6 +4311,13 @@ export declare const useClientWorkspaceStatus: () => UseCancelablePromiseStatus;
4159
4311
  */
4160
4312
  export declare function useComposedPlaceholder<TContext, TPlaceholder extends IComposedPlaceholder<any, any, TContext>>(placeholder: TPlaceholder, resolutionContext?: TContext): PlaceholderResolvedValue<TPlaceholder>;
4161
4313
 
4314
+ /**
4315
+ * Hook to get correlation metadata from the nearest correlation provider.
4316
+ *
4317
+ * @public
4318
+ */
4319
+ export declare const useCorrelationData: () => Record<string, string>;
4320
+
4162
4321
  /**
4163
4322
  * This hook provides easy way to export data in your preferred format (csv/xlsx/raw) for the provided {@link @gooddata/sdk-backend-spi#IPreparedExecution}.
4164
4323
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui",
3
- "version": "10.22.0-alpha.2",
3
+ "version": "10.22.0-alpha.20",
4
4
  "description": "GoodData.UI SDK - Core",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,9 +41,9 @@
41
41
  "ts-invariant": "^0.7.5",
42
42
  "tslib": "^2.5.0",
43
43
  "uuid": "^8.3.2",
44
- "@gooddata/sdk-backend-spi": "10.22.0-alpha.2",
45
- "@gooddata/sdk-model": "10.22.0-alpha.2",
46
- "@gooddata/util": "10.22.0-alpha.2"
44
+ "@gooddata/sdk-backend-spi": "10.22.0-alpha.20",
45
+ "@gooddata/sdk-model": "10.22.0-alpha.20",
46
+ "@gooddata/util": "10.22.0-alpha.20"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "react": "^16.10.0 || ^17.0.0 || ^18.0.0",
@@ -94,10 +94,10 @@
94
94
  "typescript": "5.3.3",
95
95
  "vitest": "1.0.4",
96
96
  "vitest-dom": "0.1.1",
97
- "@gooddata/i18n-toolkit": "10.22.0-alpha.2",
98
- "@gooddata/reference-workspace": "10.22.0-alpha.2",
99
- "@gooddata/sdk-backend-base": "10.22.0-alpha.2",
100
- "@gooddata/sdk-backend-mockingbird": "10.22.0-alpha.2"
97
+ "@gooddata/i18n-toolkit": "10.22.0-alpha.20",
98
+ "@gooddata/reference-workspace": "10.22.0-alpha.20",
99
+ "@gooddata/sdk-backend-mockingbird": "10.22.0-alpha.20",
100
+ "@gooddata/sdk-backend-base": "10.22.0-alpha.20"
101
101
  },
102
102
  "scripts": {
103
103
  "clean": "rm -rf ci dist esm coverage *.log tsconfig.tsbuildinfo",