@gooddata/sdk-ui-pluggable-application 11.28.0-alpha.9 → 11.29.0-alpha.0

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.
@@ -0,0 +1,43 @@
1
+ import { type IAnalyticalBackend } from "@gooddata/sdk-backend-spi";
2
+ import { type IAuthCredentials } from "@gooddata/sdk-pluggable-application-model";
3
+ /**
4
+ * Options for {@link createBackendForModule}.
5
+ *
6
+ * @alpha
7
+ */
8
+ export interface ICreateBackendForModuleOptions {
9
+ /**
10
+ * Package name reported to the backend for telemetry.
11
+ */
12
+ packageName: string;
13
+ /**
14
+ * Package version reported to the backend for telemetry.
15
+ */
16
+ packageVersion?: string;
17
+ }
18
+ /**
19
+ * Creates an analytical backend instance from the platform context auth credentials.
20
+ *
21
+ * @remarks
22
+ * Each pluggable application module should create its own backend instance using this
23
+ * function rather than sharing the host's internal backend singleton. This ensures
24
+ * modules remain decoupled and avoids SDK version desync between independently built
25
+ * artifacts.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * import { createBackendForModule } from "@gooddata/sdk-ui-pluggable-application";
30
+ *
31
+ * function MyApp({ ctx }: { ctx: IPlatformContext }) {
32
+ * const backend = useMemo(
33
+ * () => createBackendForModule(ctx.auth, { packageName: "my-module" }),
34
+ * [ctx.auth],
35
+ * );
36
+ * // use backend...
37
+ * }
38
+ * ```
39
+ *
40
+ * @alpha
41
+ */
42
+ export declare function createBackendForModule(auth: IAuthCredentials, options: ICreateBackendForModuleOptions): IAnalyticalBackend;
43
+ //# sourceMappingURL=backend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAMpE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAElF;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC3C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,8BAA8B,GACxC,kBAAkB,CAuBpB"}
package/esm/backend.js ADDED
@@ -0,0 +1,44 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { RecommendedCachingConfiguration, withCaching } from "@gooddata/sdk-backend-base";
3
+ import { ContextDeferredAuthProvider, TigerTokenAuthProvider, tigerFactory, } from "@gooddata/sdk-backend-tiger";
4
+ /**
5
+ * Creates an analytical backend instance from the platform context auth credentials.
6
+ *
7
+ * @remarks
8
+ * Each pluggable application module should create its own backend instance using this
9
+ * function rather than sharing the host's internal backend singleton. This ensures
10
+ * modules remain decoupled and avoids SDK version desync between independently built
11
+ * artifacts.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * import { createBackendForModule } from "@gooddata/sdk-ui-pluggable-application";
16
+ *
17
+ * function MyApp({ ctx }: { ctx: IPlatformContext }) {
18
+ * const backend = useMemo(
19
+ * () => createBackendForModule(ctx.auth, { packageName: "my-module" }),
20
+ * [ctx.auth],
21
+ * );
22
+ * // use backend...
23
+ * }
24
+ * ```
25
+ *
26
+ * @alpha
27
+ */
28
+ export function createBackendForModule(auth, options) {
29
+ const base = tigerFactory(undefined, {
30
+ packageName: options.packageName,
31
+ packageVersion: options.packageVersion ?? "unknown",
32
+ });
33
+ switch (auth.type) {
34
+ case "apiToken":
35
+ case "jwt":
36
+ return withCaching(base.withAuthentication(new TigerTokenAuthProvider(auth.token)), RecommendedCachingConfiguration);
37
+ case "contextDeferred":
38
+ return withCaching(base.withAuthentication(new ContextDeferredAuthProvider()), RecommendedCachingConfiguration);
39
+ default: {
40
+ throw new Error(`[sdk-ui-pluggable-application/backend] Unsupported auth type "${String(auth.type)}".`);
41
+ }
42
+ }
43
+ }
44
+ //# sourceMappingURL=backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,+BAA+B,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE1F,OAAO,EACH,2BAA2B,EAC3B,sBAAsB,EACtB,YAAY,GACf,MAAM,6BAA6B,CAAC;AAoBrC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,sBAAsB,CAClC,IAAsB,EACtB,OAAuC,EACrB;IAClB,MAAM,IAAI,GAAG,YAAY,CAAC,SAAS,EAAE;QACjC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,SAAS;KACtD,CAAC,CAAC;IACH,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAChB,KAAK,UAAU,CAAC;QAChB,KAAK,KAAK;YACN,OAAO,WAAW,CACd,IAAI,CAAC,kBAAkB,CAAC,IAAI,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAC/D,+BAA+B,CAClC,CAAC;QACN,KAAK,iBAAiB;YAClB,OAAO,WAAW,CACd,IAAI,CAAC,kBAAkB,CAAC,IAAI,2BAA2B,EAAE,CAAC,EAC1D,+BAA+B,CAClC,CAAC;QACN,SAAS,CAAC;YACN,MAAM,IAAI,KAAK,CACX,iEAAiE,MAAM,CAAE,IAA2B,CAAC,IAAI,CAAC,IAAI,CACjH,CAAC;QACN,CAAC;IACL,CAAC;AAAA,CACJ"}
package/esm/index.d.ts CHANGED
@@ -4,4 +4,5 @@
4
4
  * @packageDocumentation
5
5
  */
6
6
  export { type IClientPlatformContext, PlatformContextProvider, type IPlatformContextProviderProps, usePlatformContext, usePlatformContextStrict, } from "./context.js";
7
+ export { createBackendForModule, type ICreateBackendForModuleOptions } from "./backend.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH,OAAO,EACH,KAAK,sBAAsB,EAC3B,uBAAuB,EACvB,KAAK,6BAA6B,EAClC,kBAAkB,EAClB,wBAAwB,GAC3B,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH,OAAO,EACH,KAAK,sBAAsB,EAC3B,uBAAuB,EACvB,KAAK,6BAA6B,EAClC,kBAAkB,EAClB,wBAAwB,GAC3B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,sBAAsB,EAAE,KAAK,8BAA8B,EAAE,MAAM,cAAc,CAAC"}
package/esm/index.js CHANGED
@@ -6,4 +6,5 @@
6
6
  * @packageDocumentation
7
7
  */
8
8
  export { PlatformContextProvider, usePlatformContext, usePlatformContextStrict, } from "./context.js";
9
+ export { createBackendForModule } from "./backend.js";
9
10
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,oDAAoD;AAEpD;;;;GAIG;AAEH,OAAO,EAEH,uBAAuB,EAEvB,kBAAkB,EAClB,wBAAwB,GAC3B,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,oDAAoD;AAEpD;;;;GAIG;AAEH,OAAO,EAEH,uBAAuB,EAEvB,kBAAkB,EAClB,wBAAwB,GAC3B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,sBAAsB,EAAuC,MAAM,cAAc,CAAC"}
@@ -5,10 +5,37 @@
5
5
  */
6
6
 
7
7
  import { IAnalyticalBackend } from '@gooddata/sdk-backend-spi';
8
+ import { IAuthCredentials } from '@gooddata/sdk-pluggable-application-model';
8
9
  import { IPlatformContext } from '@gooddata/sdk-pluggable-application-model';
9
10
  import { JSX } from 'react/jsx-runtime';
10
11
  import { PropsWithChildren } from 'react';
11
12
 
13
+ /**
14
+ * Creates an analytical backend instance from the platform context auth credentials.
15
+ *
16
+ * @remarks
17
+ * Each pluggable application module should create its own backend instance using this
18
+ * function rather than sharing the host's internal backend singleton. This ensures
19
+ * modules remain decoupled and avoids SDK version desync between independently built
20
+ * artifacts.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * import { createBackendForModule } from "@gooddata/sdk-ui-pluggable-application";
25
+ *
26
+ * function MyApp({ ctx }: { ctx: IPlatformContext }) {
27
+ * const backend = useMemo(
28
+ * () => createBackendForModule(ctx.auth, { packageName: "my-module" }),
29
+ * [ctx.auth],
30
+ * );
31
+ * // use backend...
32
+ * }
33
+ * ```
34
+ *
35
+ * @alpha
36
+ */
37
+ export declare function createBackendForModule(auth: IAuthCredentials, options: ICreateBackendForModuleOptions): IAnalyticalBackend;
38
+
12
39
  /**
13
40
  * Platform context extended with a client-created backend instance.
14
41
  *
@@ -32,6 +59,22 @@ export declare interface IClientPlatformContext extends IPlatformContext {
32
59
  backend: IAnalyticalBackend;
33
60
  }
34
61
 
62
+ /**
63
+ * Options for {@link createBackendForModule}.
64
+ *
65
+ * @alpha
66
+ */
67
+ export declare interface ICreateBackendForModuleOptions {
68
+ /**
69
+ * Package name reported to the backend for telemetry.
70
+ */
71
+ packageName: string;
72
+ /**
73
+ * Package version reported to the backend for telemetry.
74
+ */
75
+ packageVersion?: string;
76
+ }
77
+
35
78
  /**
36
79
  * Props for {@link PlatformContextProvider}.
37
80
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-pluggable-application",
3
- "version": "11.28.0-alpha.9",
3
+ "version": "11.29.0-alpha.0",
4
4
  "description": "GoodData SDK React helpers for pluggable applications",
5
5
  "license": "MIT",
6
6
  "author": "GoodData Corporation",
@@ -23,8 +23,10 @@
23
23
  "dependencies": {
24
24
  "ts-invariant": "0.10.3",
25
25
  "tslib": "2.8.1",
26
- "@gooddata/sdk-backend-spi": "11.28.0-alpha.9",
27
- "@gooddata/sdk-pluggable-application-model": "11.28.0-alpha.9"
26
+ "@gooddata/sdk-backend-base": "11.29.0-alpha.0",
27
+ "@gooddata/sdk-backend-spi": "11.29.0-alpha.0",
28
+ "@gooddata/sdk-backend-tiger": "11.29.0-alpha.0",
29
+ "@gooddata/sdk-pluggable-application-model": "11.29.0-alpha.0"
28
30
  },
29
31
  "devDependencies": {
30
32
  "@microsoft/api-documenter": "^7.17.0",
@@ -56,8 +58,8 @@
56
58
  "react-dom": "19.1.1",
57
59
  "typescript": "5.9.3",
58
60
  "vitest": "4.1.0",
59
- "@gooddata/eslint-config": "11.28.0-alpha.9",
60
- "@gooddata/oxlint-config": "11.28.0-alpha.9"
61
+ "@gooddata/oxlint-config": "11.29.0-alpha.0",
62
+ "@gooddata/eslint-config": "11.29.0-alpha.0"
61
63
  },
62
64
  "peerDependencies": {
63
65
  "react": "^18.0.0 || ^19.0.0",