@gooddata/sdk-backend-base 8.12.0-alpha.30 → 8.12.0-alpha.31

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 (1) hide show
  1. package/package.json +7 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-backend-base",
3
- "version": "8.12.0-alpha.30",
3
+ "version": "8.12.0-alpha.31",
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.30",
34
- "@gooddata/sdk-model": "^8.12.0-alpha.30",
35
- "@gooddata/util": "^8.12.0-alpha.30",
33
+ "@gooddata/sdk-backend-spi": "^8.12.0-alpha.31",
34
+ "@gooddata/sdk-model": "^8.12.0-alpha.31",
35
+ "@gooddata/util": "^8.12.0-alpha.31",
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.30",
45
+ "@gooddata/reference-workspace": "^8.12.0-alpha.31",
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[![npm version](https://img.shields.io/npm/v/@gooddata/sdk-backend-base)](https://www.npmjs.com/@gooddata/sdk-backend-base) \n[![npm monthly downloads](https://img.shields.io/npm/dm/@gooddata/sdk-backend-base)](https://npmcharts.com/compare/@gooddata/sdk-backend-base?minimal=true) \n![typescript](https://img.shields.io/badge/typescript-first-blue?logo=typescript)\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
  }