@gooddata/sdk-backend-base 8.12.0-alpha.7 → 8.12.0-alpha.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c) 2020-
|
|
1
|
+
Copyright (c) 2020-2022 GoodData Corporation
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/README.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Analytical Backend SPI - infrastructure and foundations
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/@gooddata/sdk-backend-base)
|
|
4
|
+
[](https://npmcharts.com/compare/@gooddata/sdk-backend-base?minimal=true)
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
This package is a part of the [GoodData.UI SDK](https://sdk.gooddata.com/gooddata-ui/docs/about_gooddataui.html).
|
|
8
|
+
To learn more, check [the source monorepo](https://github.com/gooddata/gooddata-ui-sdk).
|
|
9
|
+
|
|
3
10
|
This package contains foundational, reusable code useful for building new or decorating existing
|
|
4
11
|
[Analytical Backend](https://www.npmjs.com/package/@gooddata/sdk-backend-spi) implementations. This is lower-level, infrastructural code which may be useful
|
|
5
12
|
when building larger, more complex applications.
|
|
@@ -24,9 +31,9 @@ is at the moment limited to the execution part of the Analytical Backend SPI.
|
|
|
24
31
|
Backend decorated with eventing can be created as follows:
|
|
25
32
|
|
|
26
33
|
```typescript
|
|
27
|
-
import {IAnalyticalBackend} from "@gooddata/sdk-backend-spi";
|
|
28
|
-
import {IExecutionDefinition, IDataView} from "@gooddata/sdk-model";
|
|
29
|
-
import {withEventing} from "@gooddata/sdk-backend-base";
|
|
34
|
+
import { IAnalyticalBackend } from "@gooddata/sdk-backend-spi";
|
|
35
|
+
import { IExecutionDefinition, IDataView } from "@gooddata/sdk-model";
|
|
36
|
+
import { withEventing } from "@gooddata/sdk-backend-base";
|
|
30
37
|
|
|
31
38
|
const realBackendImplementation = ...;
|
|
32
39
|
const enhancedBackend: IAnalyticalBackend = withEventing(realBackendImplementation, {
|
|
@@ -58,8 +65,8 @@ data structures. To the caller, all of this optimization remains transparent and
|
|
|
58
65
|
execution actually executed.
|
|
59
66
|
|
|
60
67
|
```typescript
|
|
61
|
-
import {IAnalyticalBackend} from "@gooddata/sdk-backend-spi";
|
|
62
|
-
import {withNormalization} from "@gooddata/sdk-backend-base";
|
|
68
|
+
import { IAnalyticalBackend } from "@gooddata/sdk-backend-spi";
|
|
69
|
+
import { withNormalization } from "@gooddata/sdk-backend-base";
|
|
63
70
|
|
|
64
71
|
const realBackendImplementation = ...;
|
|
65
72
|
const enhancedBackend: IAnalyticalBackend = withNormalization(realBackendImplementation);
|
|
@@ -74,8 +81,8 @@ If your app must deliver a snappy experience without too many loading indicators
|
|
|
74
81
|
critical requirement, then this decorator can speed your application immensely.
|
|
75
82
|
|
|
76
83
|
```typescript
|
|
77
|
-
import {IAnalyticalBackend} from "@gooddata/sdk-backend-spi";
|
|
78
|
-
import {withCaching, RecommendedCachingConfiguration} from "@gooddata/sdk-backend-base";
|
|
84
|
+
import { IAnalyticalBackend } from "@gooddata/sdk-backend-spi";
|
|
85
|
+
import { withCaching, RecommendedCachingConfiguration } from "@gooddata/sdk-backend-base";
|
|
79
86
|
|
|
80
87
|
const realBackendImplementation = ...;
|
|
81
88
|
const enhancedBackend: IAnalyticalBackend = withCaching(realBackendImplementation, RecommendedCachingConfiguration);
|
|
@@ -87,8 +94,8 @@ available in this package.
|
|
|
87
94
|
The caching plays well with normalization:
|
|
88
95
|
|
|
89
96
|
```typescript
|
|
90
|
-
import {IAnalyticalBackend} from "@gooddata/sdk-backend-spi";
|
|
91
|
-
import {withCaching, withNormalization, RecommendedCachingConfiguration} from "@gooddata/sdk-backend-base";
|
|
97
|
+
import { IAnalyticalBackend } from "@gooddata/sdk-backend-spi";
|
|
98
|
+
import { withCaching, withNormalization, RecommendedCachingConfiguration } from "@gooddata/sdk-backend-base";
|
|
92
99
|
|
|
93
100
|
const realBackendImplementation = ...;
|
|
94
101
|
const enhancedBackend: IAnalyticalBackend = withNormalization(withCaching(realBackendImplementation, RecommendedCachingConfiguration));
|
|
@@ -21,7 +21,7 @@ export declare class KpiWidgetBuilder extends WidgetBaseBuilder<IKpiWidget> impl
|
|
|
21
21
|
constructor(item: IKpiWidget, validator?: ((item: Partial<IKpiWidget>) => void) | undefined);
|
|
22
22
|
static for(kpiWidget: IKpiWidgetDefinition): KpiWidgetBuilder;
|
|
23
23
|
static forNew(measure: ObjRef): KpiWidgetBuilder;
|
|
24
|
-
protected setKpiWidgetProp: <K extends "comparisonType" | "
|
|
24
|
+
protected setKpiWidgetProp: <K extends "comparisonType" | "metric" | "comparisonDirection">(prop: K, valueOrUpdateCallback: ValueOrUpdateCallback<IKpi[K]>) => this;
|
|
25
25
|
drills: (valueOrUpdateCallback: ValueOrUpdateCallback<KpiDrillDefinition[]>) => this;
|
|
26
26
|
measure: (valueOrUpdateCallback: ValueOrUpdateCallback<ObjRef>) => this;
|
|
27
27
|
comparisonType: (valueOrUpdateCallback: ValueOrUpdateCallback<IKpiComparisonTypeComparison>) => this;
|
|
@@ -1358,7 +1358,7 @@ export declare class KpiWidgetBuilder extends WidgetBaseBuilder<IKpiWidget> impl
|
|
|
1358
1358
|
constructor(item: IKpiWidget, validator?: ((item: Partial<IKpiWidget>) => void) | undefined);
|
|
1359
1359
|
static for(kpiWidget: IKpiWidgetDefinition): KpiWidgetBuilder;
|
|
1360
1360
|
static forNew(measure: ObjRef): KpiWidgetBuilder;
|
|
1361
|
-
protected setKpiWidgetProp: <K extends "comparisonType" | "
|
|
1361
|
+
protected setKpiWidgetProp: <K extends "comparisonType" | "metric" | "comparisonDirection">(prop: K, valueOrUpdateCallback: ValueOrUpdateCallback<IKpi[K]>) => this;
|
|
1362
1362
|
drills: (valueOrUpdateCallback: ValueOrUpdateCallback<KpiDrillDefinition[]>) => this;
|
|
1363
1363
|
measure: (valueOrUpdateCallback: ValueOrUpdateCallback<ObjRef>) => this;
|
|
1364
1364
|
comparisonType: (valueOrUpdateCallback: ValueOrUpdateCallback<IKpiComparisonTypeComparison>) => this;
|
|
@@ -21,7 +21,7 @@ export declare class KpiWidgetBuilder extends WidgetBaseBuilder<IKpiWidget> impl
|
|
|
21
21
|
constructor(item: IKpiWidget, validator?: ((item: Partial<IKpiWidget>) => void) | undefined);
|
|
22
22
|
static for(kpiWidget: IKpiWidgetDefinition): KpiWidgetBuilder;
|
|
23
23
|
static forNew(measure: ObjRef): KpiWidgetBuilder;
|
|
24
|
-
protected setKpiWidgetProp: <K extends "comparisonType" | "
|
|
24
|
+
protected setKpiWidgetProp: <K extends "comparisonType" | "metric" | "comparisonDirection">(prop: K, valueOrUpdateCallback: ValueOrUpdateCallback<IKpi[K]>) => this;
|
|
25
25
|
drills: (valueOrUpdateCallback: ValueOrUpdateCallback<KpiDrillDefinition[]>) => this;
|
|
26
26
|
measure: (valueOrUpdateCallback: ValueOrUpdateCallback<ObjRef>) => this;
|
|
27
27
|
comparisonType: (valueOrUpdateCallback: ValueOrUpdateCallback<IKpiComparisonTypeComparison>) => this;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-backend-base",
|
|
3
|
-
"version": "8.12.0-alpha.
|
|
3
|
+
"version": "8.12.0-alpha.71",
|
|
4
4
|
"author": "GoodData",
|
|
5
5
|
"description": "GoodData.UI SDK - Base for backend implementations",
|
|
6
6
|
"repository": {
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@braintree/sanitize-url": "^6.0.0",
|
|
33
|
-
"@gooddata/sdk-backend-spi": "^8.12.0-alpha.
|
|
34
|
-
"@gooddata/sdk-model": "^8.12.0-alpha.
|
|
35
|
-
"@gooddata/util": "^8.12.0-alpha.
|
|
33
|
+
"@gooddata/sdk-backend-spi": "^8.12.0-alpha.71",
|
|
34
|
+
"@gooddata/sdk-model": "^8.12.0-alpha.71",
|
|
35
|
+
"@gooddata/util": "^8.12.0-alpha.71",
|
|
36
36
|
"json-stable-stringify": "^1.0.1",
|
|
37
37
|
"lodash": "^4.17.19",
|
|
38
38
|
"spark-md5": "^3.0.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@gooddata/eslint-config": "^2.1.0",
|
|
45
|
-
"@gooddata/reference-workspace": "^8.12.0-alpha.
|
|
45
|
+
"@gooddata/reference-workspace": "^8.12.0-alpha.71",
|
|
46
46
|
"@microsoft/api-documenter": "^7.17.0",
|
|
47
47
|
"@microsoft/api-extractor": "^7.20.0",
|
|
48
48
|
"@types/jest": "^27.0.1",
|
|
@@ -87,5 +87,6 @@
|
|
|
87
87
|
"dep-cruiser-ci": "depcruise --validate .dependency-cruiser.js --output-type err-long src/",
|
|
88
88
|
"validate": "npm run dep-cruiser && npm run eslint && npm run prettier-check",
|
|
89
89
|
"validate-ci": "npm run dep-cruiser-ci && npm run eslint-ci && npm run prettier-check"
|
|
90
|
-
}
|
|
90
|
+
},
|
|
91
|
+
"readme": "# Analytical Backend SPI - infrastructure and foundations\n\n[](https://www.npmjs.com/@gooddata/sdk-backend-base) \n[](https://npmcharts.com/compare/@gooddata/sdk-backend-base?minimal=true) \n\n\nThis package is a part of the [GoodData.UI SDK](https://sdk.gooddata.com/gooddata-ui/docs/about_gooddataui.html).\nTo learn more, check [the source monorepo](https://github.com/gooddata/gooddata-ui-sdk).\n\nThis package contains foundational, reusable code useful for building new or decorating existing\n[Analytical Backend](https://www.npmjs.com/package/@gooddata/sdk-backend-spi) implementations. This is lower-level, infrastructural code which may be useful\nwhen building larger, more complex applications.\n\nThe notable contents of this package are documented below.\n\n## Backend Decorators\n\nLow level infrastructure to build your own Analytical Backend decorators. The decorators are used\nto seamlessly enrich existing backend implementation with additional functionality - without\nthe need to touch the backend implementation itself.\n\nSee code comments in [base classes](src/decoratedBackend/index.ts) for further documentation on how\nto create your own decorators. Or additionally look at existing decorator implementations for\ninspiration.\n\n## Eventing Backend\n\nThis decorator allows you to enhance any backend implementation with support for eventing. The eventing\nis at the moment limited to the execution part of the Analytical Backend SPI.\n\nBackend decorated with eventing can be created as follows:\n\n```typescript\nimport { IAnalyticalBackend } from \"@gooddata/sdk-backend-spi\";\nimport { IExecutionDefinition, IDataView } from \"@gooddata/sdk-model\";\nimport { withEventing } from \"@gooddata/sdk-backend-base\";\n\nconst realBackendImplementation = ...;\nconst enhancedBackend: IAnalyticalBackend = withEventing(realBackendImplementation, {\n beforeExecute: (def: IExecutionDefinition) => {\n console.log(\"about to trigger execution with definition:\", def);\n },\n successfulResultReadAll: (dataView: IDataView) => {\n console.log(\"retrieved all data for backend execution\");\n }\n});\n```\n\nYou can then pass the `enhancedBackend` to the various React components offered by the SDK and be\nnotified.\n\n## Normalizing Backend\n\nThis decorator addresses the fact that two execution definitions may lead semantically same results but differ just\nin view-only details or technicalities. Before the execution is sent to the underlying backend this decorator will:\n\n- Strip alias, measure format and title from measures\n- Strip alias from attributes\n- Remove any noop filters\n- Normalize local identifiers\n\nThe normalized execution is sent to the backend and before the results and data are passed back to the caller code,\nthe decorator performs denormalization and restores the original values all in the right places in the result and\ndata structures. To the caller, all of this optimization remains transparent and everything looks like the original\nexecution actually executed.\n\n```typescript\nimport { IAnalyticalBackend } from \"@gooddata/sdk-backend-spi\";\nimport { withNormalization } from \"@gooddata/sdk-backend-base\";\n\nconst realBackendImplementation = ...;\nconst enhancedBackend: IAnalyticalBackend = withNormalization(realBackendImplementation);\n```\n\n## Caching Backend\n\nThis decorator implements a naive client-side execution result caching with bounded cache size.\nThe execution results will be evicted only if cache limits are reached using LRU policy. Browser ‘Refresh’ cleans the cache.\n\nIf your app must deliver a snappy experience without too many loading indicators AND the data freshness is not a\ncritical requirement, then this decorator can speed your application immensely.\n\n```typescript\nimport { IAnalyticalBackend } from \"@gooddata/sdk-backend-spi\";\nimport { withCaching, RecommendedCachingConfiguration } from \"@gooddata/sdk-backend-base\";\n\nconst realBackendImplementation = ...;\nconst enhancedBackend: IAnalyticalBackend = withCaching(realBackendImplementation, RecommendedCachingConfiguration);\n```\n\nThe withCaching accepts configuration which you need to use to tweak the size of the different caches. You can use RecommendedCachingConfiguration\navailable in this package.\n\nThe caching plays well with normalization:\n\n```typescript\nimport { IAnalyticalBackend } from \"@gooddata/sdk-backend-spi\";\nimport { withCaching, withNormalization, RecommendedCachingConfiguration } from \"@gooddata/sdk-backend-base\";\n\nconst realBackendImplementation = ...;\nconst enhancedBackend: IAnalyticalBackend = withNormalization(withCaching(realBackendImplementation, RecommendedCachingConfiguration));\n```\n\nThis way the normalization first wipes any differences that are unimportant for the backend, effectively dispatching\njust the really unique executions to the underlying backend - the caching decorator. This greatly increases client-side\ncache hits for applications that dynamically change view-only properties of LDM objects.\n\n## License\n\n(C) 2017-2022 GoodData Corporation\n\nThis project is under MIT License. See [LICENSE](https://github.com/gooddata/gooddata-ui-sdk/blob/master/libs/sdk-backend-base/LICENSE).\n"
|
|
91
92
|
}
|