@gooddata/sdk-backend-spi
Advanced tools
Comparing version 8.0.0-alpha.34 to 8.0.0-alpha.35
import { IExecutionDefinition } from "@gooddata/sdk-model"; | ||
import { IElementQueryFactory } from "../workspace/elements"; | ||
import { IExecutionFactory, IPreparedExecution } from "../workspace/execution"; | ||
import { IWorkspaceSettingsService } from "../workspace/settings"; | ||
import { IWorkspaceMetadata } from "../workspace/insights"; | ||
import { IWorkspaceStylingService } from "../workspace/styling"; | ||
import { IWorkspaceCatalogFactory } from "../workspace/ldm/catalog"; | ||
import { IWorkspaceDatasetsService } from "../workspace/ldm/datasets"; | ||
import { IWorkspaceQueryFactory } from "../workspace"; | ||
import { IWorkspacePermissionsFactory } from "../workspace/permissions"; | ||
import { IUserSettingsService } from "../user/settings"; | ||
import { IPreparedExecution } from "../workspace/execution"; | ||
import { IWorkspaceQueryFactory, IAnalyticalWorkspace } from "../workspace"; | ||
import { IAuthenticationProvider, AuthenticatedPrincipal } from "../auth"; | ||
import { IUserService } from "../user"; | ||
/** | ||
@@ -124,58 +118,2 @@ * Specifies platform agnostic configuration of an analytical backend. Only config items that make sense for | ||
/** | ||
* Represents an analytical workspace hosted on a backend. It is an entry point to various services that can be | ||
* used to inspect and modify the workspace and run executions to obtain analytics for the workspace. | ||
* | ||
* @public | ||
*/ | ||
export interface IAnalyticalWorkspace { | ||
readonly workspace: string; | ||
/** | ||
* Returns execution factory - which is an entry point to triggering executions and thus obtaining | ||
* analytics from the workspace. | ||
*/ | ||
execution(): IExecutionFactory; | ||
/** | ||
* Returns service that can be used to perform read and write operations on subset of workspace's metadata. | ||
*/ | ||
metadata(): IWorkspaceMetadata; | ||
/** | ||
* Returns service that can be used to obtain workspace styling settings. These settings specify for instance | ||
* what colors should be used in the charts. | ||
*/ | ||
styling(): IWorkspaceStylingService; | ||
/** | ||
* Returns service that can be used to query attribute elements for attributes defined in this workspace. For | ||
* instance if workspace has data set Employee with attribute Name, then this service can be used to retrieve | ||
* names of all employees. | ||
*/ | ||
elements(): IElementQueryFactory; | ||
/** | ||
* Returns service that can be used to obtain settings that are currently in effect for the workspace. | ||
*/ | ||
settings(): IWorkspaceSettingsService; | ||
/** | ||
* Returns service that can be used to query workspace catalog items - attributes, measures, facts and date data sets | ||
*/ | ||
catalog(): IWorkspaceCatalogFactory; | ||
/** | ||
* Returns service that can be used to query data sets defined in this workspace. | ||
*/ | ||
dataSets(): IWorkspaceDatasetsService; | ||
/** | ||
* Returns service that can be used to query workspace permissions | ||
*/ | ||
permissions(): IWorkspacePermissionsFactory; | ||
} | ||
/** | ||
* Represents a user. It is an entry point to various services that can be used to inspect and modify the user. | ||
* | ||
* @public | ||
*/ | ||
export interface IUserService { | ||
/** | ||
* Returns service that can be used to obtain settings that are currently in effect for the user. | ||
*/ | ||
settings(): IUserSettingsService; | ||
} | ||
/** | ||
* Analytical Backend communicates its capabilities via objects of this type. In return, the capabilities | ||
@@ -229,58 +167,2 @@ * can then be used by applications to enable / disable particular features. | ||
/** | ||
* Defines authentication provider to use when instance of IAnalyticalBackend discovers that | ||
* the current session is not authentication. | ||
* | ||
* @public | ||
*/ | ||
export interface IAuthenticationProvider { | ||
/** | ||
* Perform authentication. | ||
* | ||
* @param context - context in which the authentication is done | ||
*/ | ||
authenticate(context: AuthenticationContext): Promise<AuthenticatedPrincipal>; | ||
/** | ||
* Returns the currently authenticated principal, or undefined if not authenticated. | ||
* Does not trigger authentication if no principal is available. | ||
*/ | ||
getCurrentPrincipal(context: AuthenticationContext): Promise<AuthenticatedPrincipal | undefined>; | ||
/** | ||
* Clear existing authentication. | ||
* | ||
* @param context - context in which the authentication is done | ||
*/ | ||
deauthenticate(context: AuthenticationContext): Promise<void>; | ||
} | ||
/** | ||
* Describes context in which the authentication is done. To cater for custom authentication schemes. | ||
* the API client of the underlying backend IS exposed anonymously to the provider - the provider SHOULD use | ||
* the provided API client to exercise any backend-specific authentication mechanisms. | ||
* | ||
* @public | ||
*/ | ||
export declare type AuthenticationContext = { | ||
/** | ||
* API client used to communicate with the backend - this can be used to perform any backend-specific, | ||
* non-standard authentication. | ||
*/ | ||
client: any; | ||
}; | ||
/** | ||
* Describes user, which is currently authenticated to the backend. | ||
* | ||
* @public | ||
*/ | ||
export declare type AuthenticatedPrincipal = { | ||
/** | ||
* Unique identifier of the authenticated user. The identifier semantics MAY differ between backend | ||
* implementations. The client code SHOULD NOT make assumptions on the content (such as userId being | ||
* valid email and so on). | ||
*/ | ||
userId: string; | ||
/** | ||
* Backend-specific user metadata. | ||
*/ | ||
userMeta?: any; | ||
}; | ||
/** | ||
* Prepares execution of the provided definition against a backend. | ||
@@ -287,0 +169,0 @@ * |
@@ -104,2 +104,8 @@ import { IDataView } from "../workspace/execution"; | ||
/** | ||
* Error converter | ||
* | ||
* @public | ||
*/ | ||
export declare type ErrorConverter = (e: any) => AnalyticalBackendError; | ||
/** | ||
* Type guard checking whether input is an instance of {@link AnalyticalBackendError} | ||
@@ -106,0 +112,0 @@ * |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// (C) 2019 GoodData Corporation | ||
// (C) 2019-2020 GoodData Corporation | ||
var isEmpty = require("lodash/isEmpty"); | ||
@@ -19,0 +19,0 @@ /** |
@@ -1,3 +0,5 @@ | ||
export { IAnalyticalBackend, IAnalyticalWorkspace, BackendCapabilities, AnalyticalBackendConfig, AnalyticalBackendFactory, prepareExecution, IAuthenticationProvider, AuthenticationContext, AuthenticatedPrincipal, IUserService, } from "./backend"; | ||
export { IAnalyticalBackend, BackendCapabilities, AnalyticalBackendConfig, AnalyticalBackendFactory, prepareExecution, } from "./backend"; | ||
export { AuthenticatedAsyncCall, AuthenticatedCallGuard, IAuthenticatedAsyncCallContext, AuthProviderCallGuard, AuthenticatedPrincipal, AuthenticationContext, IAuthProviderCallGuard, IAuthenticationProvider, NoopAuthProvider, } from "./auth"; | ||
export { ISettings, SettingCatalog } from "./common/settings"; | ||
export { IUserService } from "./user"; | ||
export { IUserSettingsService, IUserSettings } from "./user/settings"; | ||
@@ -8,11 +10,12 @@ export { IExecutionFactory, AbstractExecutionFactory, IPreparedExecution, IExecutionResult, IDataView, } from "./workspace/execution"; | ||
export { IWorkspaceSettingsService, IWorkspaceSettings } from "./workspace/settings"; | ||
export { IWorkspaceMetadata, InsightOrdering, IInsightQueryOptions, IInsightQueryResult, } from "./workspace/insights"; | ||
export { IWorkspaceInsights, InsightOrdering, IInsightQueryOptions, IInsightQueryResult, } from "./workspace/insights"; | ||
export { IWorkspaceMetadata } from "./workspace/metadata"; | ||
export { IWorkspaceCatalogFactory, IWorkspaceCatalogAvailableItemsFactory, IWorkspaceCatalog, IWorkspaceCatalogFactoryOptions, IWorkspaceCatalogWithAvailableItems, IWorkspaceCatalogWithAvailableItemsFactoryOptions, IWorkspaceCatalogFactoryMethods, IWorkspaceCatalogMethods, } from "./workspace/ldm/catalog"; | ||
export { IWorkspaceDatasetsService } from "./workspace/ldm/datasets"; | ||
export { IElementQueryFactory, IElementQueryResult, IElementQuery, IElementQueryOptions, } from "./workspace/elements"; | ||
export { IExportConfig, IExportResult } from "./workspace/execution/export"; | ||
export { IWorkspaceStylingService } from "./workspace/styling"; | ||
export { AnalyticalBackendError, NoDataError, DataTooLargeError, ProtectedDataError, UnexpectedResponseError, UnexpectedError, NotSupported, NotImplemented, NotAuthenticated, isAnalyticalBackendError, isNoDataError, isDataTooLargeError, isProtectedDataError, isUnexpectedResponseError, isUnexpectedError, isNotSupported, isNotImplemented, isNotAuthenticated, AnalyticalBackendErrorTypes, } from "./errors"; | ||
export { AnalyticalBackendError, NoDataError, DataTooLargeError, ProtectedDataError, UnexpectedResponseError, UnexpectedError, NotSupported, NotImplemented, NotAuthenticated, ErrorConverter, isAnalyticalBackendError, isNoDataError, isDataTooLargeError, isProtectedDataError, isUnexpectedResponseError, isUnexpectedError, isNotSupported, isNotImplemented, isNotAuthenticated, AnalyticalBackendErrorTypes, } from "./errors"; | ||
export { IPagedResource } from "./common/paging"; | ||
export { IWorkspaceDatasetsService } from "./workspace/ldm/datasets"; | ||
export { IWorkspaceQuery, IWorkspaceQueryFactory, IWorkspaceQueryResult } from "./workspace"; | ||
export { IAnalyticalWorkspace, IWorkspaceQuery, IWorkspaceQueryFactory, IWorkspaceQueryResult, } from "./workspace"; | ||
export { IWorkspacePermissionsFactory, IWorkspaceUserPermissions } from "./workspace/permissions"; |
@@ -6,2 +6,5 @@ "use strict"; | ||
exports.prepareExecution = backend_1.prepareExecution; | ||
var auth_1 = require("./auth"); | ||
exports.AuthProviderCallGuard = auth_1.AuthProviderCallGuard; | ||
exports.NoopAuthProvider = auth_1.NoopAuthProvider; | ||
var settings_1 = require("./common/settings"); | ||
@@ -8,0 +11,0 @@ exports.SettingCatalog = settings_1.SettingCatalog; |
@@ -6,3 +6,3 @@ import { AttributeOrMeasure } from '@gooddata/sdk-model'; | ||
import { IAttribute } from '@gooddata/sdk-model'; | ||
import { IAttributeDisplayForm } from '@gooddata/sdk-model'; | ||
import { IAttributeDisplayFormMetadataObject } from '@gooddata/sdk-model'; | ||
import { IAttributeElement } from '@gooddata/sdk-model'; | ||
@@ -24,5 +24,6 @@ import { IBucket } from '@gooddata/sdk-model'; | ||
import { IMeasureExpressionToken } from '@gooddata/sdk-model'; | ||
import { IObjectMeta } from '@gooddata/sdk-model'; | ||
import { IMetadataObject } from '@gooddata/sdk-model'; | ||
import { IVisualizationClass } from '@gooddata/sdk-model'; | ||
import { IWorkspace } from '@gooddata/sdk-model'; | ||
import { IWorkspacePermissions } from '@gooddata/sdk-model'; | ||
import { ObjRef } from '@gooddata/sdk-model'; | ||
@@ -119,2 +120,16 @@ import { SortDirection } from '@gooddata/sdk-model'; | ||
/** | ||
* Authenticated async call | ||
* | ||
* @public | ||
*/ | ||
export declare type AuthenticatedAsyncCall<TSdk, TReturn> = (sdk: TSdk, context: IAuthenticatedAsyncCallContext) => Promise<TReturn>; | ||
/** | ||
* Authenticated call guard | ||
* | ||
* @public | ||
*/ | ||
export declare type AuthenticatedCallGuard<TSdk = any> = <TReturn>(call: AuthenticatedAsyncCall<TSdk, TReturn>, errorConverter?: ErrorConverter) => Promise<TReturn>; | ||
/** | ||
* Describes user, which is currently authenticated to the backend. | ||
@@ -153,2 +168,26 @@ * | ||
/** | ||
* This implementation of auth provider ensures, that the auth provider is called exactly once in the happy path | ||
* execution where provider successfully authenticates a principal. | ||
* | ||
* If underlying provider fails, subsequent calls that need authentication will land in the provider. | ||
* | ||
* This class encapsulates the stateful nature of interaction of the provider across multiple different instances | ||
* of the bear backend, all of which are set with the same provider. All instances of the backend should be | ||
* subject to the same authentication flow AND the call to the authentication provider should be synchronized | ||
* through this scoped instance. | ||
* | ||
* @internal | ||
*/ | ||
export declare class AuthProviderCallGuard implements IAuthProviderCallGuard { | ||
private readonly realProvider; | ||
private inflightRequest; | ||
private principal; | ||
constructor(realProvider: IAuthenticationProvider); | ||
reset: () => void; | ||
authenticate: (context: AuthenticationContext) => Promise<AuthenticatedPrincipal>; | ||
getCurrentPrincipal(context: AuthenticationContext): Promise<AuthenticatedPrincipal | undefined>; | ||
deauthenticate(context: AuthenticationContext): Promise<void>; | ||
} | ||
/** | ||
* Analytical Backend communicates its capabilities via objects of this type. In return, the capabilities | ||
@@ -426,2 +465,9 @@ * can then be used by applications to enable / disable particular features. | ||
/** | ||
* Error converter | ||
* | ||
* @public | ||
*/ | ||
export declare type ErrorConverter = (e: any) => AnalyticalBackendError; | ||
/** | ||
* This is the root of the Analytical Backend SPI. It allows configuration related to communication with the backend | ||
@@ -530,2 +576,6 @@ * and access to analytical workspaces. | ||
/** | ||
* Returns service that can be used to query and update insights | ||
*/ | ||
insights(): IWorkspaceInsights; | ||
/** | ||
* Returns service that can be used to perform read and write operations on subset of workspace's metadata. | ||
@@ -584,2 +634,11 @@ */ | ||
/** | ||
* Authenticated async call context | ||
* | ||
* @public | ||
*/ | ||
export declare interface IAuthenticatedAsyncCallContext { | ||
principal: AuthenticatedPrincipal; | ||
} | ||
/** | ||
* Defines authentication provider to use when instance of IAnalyticalBackend discovers that | ||
@@ -611,2 +670,10 @@ * the current session is not authentication. | ||
/** | ||
* see AuthProviderCallGuard | ||
* @internal | ||
*/ | ||
export declare interface IAuthProviderCallGuard extends IAuthenticationProvider { | ||
reset(): void; | ||
} | ||
/** | ||
* A view on the calculated data. | ||
@@ -1384,6 +1451,6 @@ * | ||
export declare interface IWorkspaceCatalogFactoryMethods<T, TOptions> { | ||
forDataset(datasets: string): T; | ||
forDataset(dataset: ObjRef): T; | ||
forTypes(types: CatalogItemType[]): T; | ||
includeTags(tags: string[]): T; | ||
excludeTags(tags: string[]): T; | ||
includeTags(tags: ObjRef[]): T; | ||
excludeTags(tags: ObjRef[]): T; | ||
withOptions(options: TOptions): T; | ||
@@ -1398,6 +1465,6 @@ } | ||
export declare interface IWorkspaceCatalogFactoryOptions { | ||
dataset?: string; | ||
dataset?: ObjRef; | ||
types: CatalogItemType[]; | ||
includeTags: string[]; | ||
excludeTags: string[]; | ||
includeTags: ObjRef[]; | ||
excludeTags: ObjRef[]; | ||
production: boolean; | ||
@@ -1456,3 +1523,3 @@ } | ||
*/ | ||
export declare interface IWorkspaceMetadata { | ||
export declare interface IWorkspaceInsights { | ||
getVisualizationClass(ref: ObjRef): Promise<IVisualizationClass>; | ||
@@ -1471,2 +1538,10 @@ getVisualizationClasses(): Promise<IVisualizationClass[]>; | ||
deleteInsight(ref: ObjRef): Promise<void>; | ||
} | ||
/** | ||
* TODO: SDK8: add public doc | ||
* | ||
* @public | ||
*/ | ||
export declare interface IWorkspaceMetadata { | ||
/** | ||
@@ -1477,3 +1552,3 @@ * Gets the attribute display form with the provided identifier. | ||
*/ | ||
getAttributeDisplayForm(ref: ObjRef): Promise<IAttributeDisplayForm>; | ||
getAttributeDisplayForm(ref: ObjRef): Promise<IAttributeDisplayFormMetadataObject>; | ||
/** | ||
@@ -1488,3 +1563,3 @@ * Get measure expression tokens for provided measure identifier | ||
*/ | ||
getFactDatasetMeta(ref: ObjRef): Promise<IObjectMeta>; | ||
getFactDatasetMeta(ref: ObjRef): Promise<IMetadataObject>; | ||
} | ||
@@ -1605,2 +1680,6 @@ | ||
/** | ||
* Get all user permissions in current workspace | ||
*/ | ||
allPermissions(): IWorkspacePermissions; | ||
/** | ||
* Checks if user has provided permission in current workspace | ||
@@ -1626,2 +1705,14 @@ */ | ||
/** | ||
* This implementation serves as a Null object for IAuthProviderCallGuard. | ||
* | ||
* @internal | ||
*/ | ||
export declare class NoopAuthProvider implements IAuthProviderCallGuard { | ||
authenticate(_context: AuthenticationContext): Promise<AuthenticatedPrincipal>; | ||
getCurrentPrincipal(_context: AuthenticationContext): Promise<AuthenticatedPrincipal | undefined>; | ||
deauthenticate(_context: AuthenticationContext): Promise<void>; | ||
reset(): void; | ||
} | ||
/** | ||
* This exception is thrown when client code triggers an operation which requires authentication but the client | ||
@@ -1628,0 +1719,0 @@ * code did not provide credentials or the credentials are invalid. |
import { IWorkspace } from "@gooddata/sdk-model"; | ||
import { IPagedResource } from "../common/paging"; | ||
import { IExecutionFactory } from "./execution"; | ||
import { IWorkspaceInsights } from "./insights"; | ||
import { IWorkspaceStylingService } from "./styling"; | ||
import { IElementQueryFactory } from "./elements"; | ||
import { IWorkspaceSettingsService } from "./settings"; | ||
import { IWorkspaceCatalogFactory } from "./ldm/catalog"; | ||
import { IWorkspaceDatasetsService } from "./ldm/datasets"; | ||
import { IWorkspacePermissionsFactory } from "./permissions"; | ||
import { IWorkspaceMetadata } from "./metadata"; | ||
/** | ||
* Represents an analytical workspace hosted on a backend. It is an entry point to various services that can be | ||
* used to inspect and modify the workspace and run executions to obtain analytics for the workspace. | ||
* | ||
* @public | ||
*/ | ||
export interface IAnalyticalWorkspace { | ||
readonly workspace: string; | ||
/** | ||
* Returns execution factory - which is an entry point to triggering executions and thus obtaining | ||
* analytics from the workspace. | ||
*/ | ||
execution(): IExecutionFactory; | ||
/** | ||
* Returns service that can be used to query and update insights | ||
*/ | ||
insights(): IWorkspaceInsights; | ||
/** | ||
* Returns service that can be used to perform read and write operations on subset of workspace's metadata. | ||
*/ | ||
metadata(): IWorkspaceMetadata; | ||
/** | ||
* Returns service that can be used to obtain workspace styling settings. These settings specify for instance | ||
* what colors should be used in the charts. | ||
*/ | ||
styling(): IWorkspaceStylingService; | ||
/** | ||
* Returns service that can be used to query attribute elements for attributes defined in this workspace. For | ||
* instance if workspace has data set Employee with attribute Name, then this service can be used to retrieve | ||
* names of all employees. | ||
*/ | ||
elements(): IElementQueryFactory; | ||
/** | ||
* Returns service that can be used to obtain settings that are currently in effect for the workspace. | ||
*/ | ||
settings(): IWorkspaceSettingsService; | ||
/** | ||
* Returns service that can be used to query workspace catalog items - attributes, measures, facts and date data sets | ||
*/ | ||
catalog(): IWorkspaceCatalogFactory; | ||
/** | ||
* Returns service that can be used to query data sets defined in this workspace. | ||
*/ | ||
dataSets(): IWorkspaceDatasetsService; | ||
/** | ||
* Returns service that can be used to query workspace permissions | ||
*/ | ||
permissions(): IWorkspacePermissionsFactory; | ||
} | ||
/** | ||
* Factory providing creating queries used to get available workspaces. | ||
@@ -5,0 +63,0 @@ * |
@@ -1,2 +0,2 @@ | ||
import { IVisualizationClass, IInsight, IAttributeDisplayForm, IMeasureExpressionToken, IInsightDefinition, ObjRef, IObjectMeta } from "@gooddata/sdk-model"; | ||
import { IVisualizationClass, IInsight, IInsightDefinition, ObjRef } from "@gooddata/sdk-model"; | ||
import { IPagedResource } from "../../common/paging"; | ||
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
export interface IWorkspaceMetadata { | ||
export interface IWorkspaceInsights { | ||
getVisualizationClass(ref: ObjRef): Promise<IVisualizationClass>; | ||
@@ -23,18 +23,2 @@ getVisualizationClasses(): Promise<IVisualizationClass[]>; | ||
deleteInsight(ref: ObjRef): Promise<void>; | ||
/** | ||
* Gets the attribute display form with the provided identifier. | ||
* @param ref - ref of the attribute display form to retrieve | ||
* @public | ||
*/ | ||
getAttributeDisplayForm(ref: ObjRef): Promise<IAttributeDisplayForm>; | ||
/** | ||
* Get measure expression tokens for provided measure identifier | ||
* @param ref - ref of the measure | ||
*/ | ||
getMeasureExpressionTokens(ref: ObjRef): Promise<IMeasureExpressionToken[]>; | ||
/** | ||
* Get information about the given fact's dataset | ||
* @param ref - ref of the fact | ||
*/ | ||
getFactDatasetMeta(ref: ObjRef): Promise<IObjectMeta>; | ||
} | ||
@@ -41,0 +25,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { CatalogItemType, CatalogItem, ICatalogGroup, ICatalogAttribute, ICatalogMeasure, ICatalogFact, AttributeOrMeasure, ICatalogDateDataset, IInsightDefinition } from "@gooddata/sdk-model"; | ||
import { CatalogItemType, CatalogItem, ICatalogGroup, ICatalogAttribute, ICatalogMeasure, ICatalogFact, AttributeOrMeasure, ICatalogDateDataset, IInsightDefinition, ObjRef } from "@gooddata/sdk-model"; | ||
/** | ||
@@ -8,6 +8,6 @@ * TODO: SDK8: add public doc | ||
export interface IWorkspaceCatalogFactoryOptions { | ||
dataset?: string; | ||
dataset?: ObjRef; | ||
types: CatalogItemType[]; | ||
includeTags: string[]; | ||
excludeTags: string[]; | ||
includeTags: ObjRef[]; | ||
excludeTags: ObjRef[]; | ||
production: boolean; | ||
@@ -67,6 +67,6 @@ } | ||
export interface IWorkspaceCatalogFactoryMethods<T, TOptions> { | ||
forDataset(datasets: string): T; | ||
forDataset(dataset: ObjRef): T; | ||
forTypes(types: CatalogItemType[]): T; | ||
includeTags(tags: string[]): T; | ||
excludeTags(tags: string[]): T; | ||
includeTags(tags: ObjRef[]): T; | ||
excludeTags(tags: ObjRef[]): T; | ||
withOptions(options: TOptions): T; | ||
@@ -73,0 +73,0 @@ } |
"use strict"; | ||
// (C) 2019-2020 GoodData Corporation | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -1,2 +0,2 @@ | ||
import { WorkspacePermission } from "@gooddata/sdk-model"; | ||
import { WorkspacePermission, IWorkspacePermissions } from "@gooddata/sdk-model"; | ||
/** | ||
@@ -15,2 +15,6 @@ * | ||
/** | ||
* Get all user permissions in current workspace | ||
*/ | ||
allPermissions(): IWorkspacePermissions; | ||
/** | ||
* Checks if user has provided permission in current workspace | ||
@@ -17,0 +21,0 @@ */ |
{ | ||
"name": "@gooddata/sdk-backend-spi", | ||
"version": "8.0.0-alpha.34", | ||
"version": "8.0.0-alpha.35", | ||
"author": "GoodData", | ||
@@ -33,3 +33,3 @@ "description": "GoodData Backend SPI abstraction interfaces", | ||
"dependencies": { | ||
"@gooddata/sdk-model": "^8.0.0-alpha.34", | ||
"@gooddata/sdk-model": "^8.0.0-alpha.35", | ||
"lodash": "^4.17.15", | ||
@@ -36,0 +36,0 @@ "spark-md5": "^3.0.0", |
// (C) 2019-2020 GoodData Corporation | ||
import { IExecutionDefinition } from "@gooddata/sdk-model"; | ||
import { IElementQueryFactory } from "../workspace/elements"; | ||
import { IExecutionFactory, IPreparedExecution } from "../workspace/execution"; | ||
import { IWorkspaceSettingsService } from "../workspace/settings"; | ||
import { IWorkspaceMetadata } from "../workspace/insights"; | ||
import { IWorkspaceStylingService } from "../workspace/styling"; | ||
import { IWorkspaceCatalogFactory } from "../workspace/ldm/catalog"; | ||
import { IWorkspaceDatasetsService } from "../workspace/ldm/datasets"; | ||
import { IWorkspaceQueryFactory } from "../workspace"; | ||
import { IWorkspacePermissionsFactory } from "../workspace/permissions"; | ||
import { IUserSettingsService } from "../user/settings"; | ||
import { IPreparedExecution } from "../workspace/execution"; | ||
import { IWorkspaceQueryFactory, IAnalyticalWorkspace } from "../workspace"; | ||
import { IAuthenticationProvider, AuthenticatedPrincipal } from "../auth"; | ||
import { IUserService } from "../user"; | ||
@@ -143,68 +137,2 @@ /** | ||
/** | ||
* Represents an analytical workspace hosted on a backend. It is an entry point to various services that can be | ||
* used to inspect and modify the workspace and run executions to obtain analytics for the workspace. | ||
* | ||
* @public | ||
*/ | ||
export interface IAnalyticalWorkspace { | ||
readonly workspace: string; | ||
/** | ||
* Returns execution factory - which is an entry point to triggering executions and thus obtaining | ||
* analytics from the workspace. | ||
*/ | ||
execution(): IExecutionFactory; | ||
/** | ||
* Returns service that can be used to perform read and write operations on subset of workspace's metadata. | ||
*/ | ||
metadata(): IWorkspaceMetadata; | ||
/** | ||
* Returns service that can be used to obtain workspace styling settings. These settings specify for instance | ||
* what colors should be used in the charts. | ||
*/ | ||
styling(): IWorkspaceStylingService; | ||
/** | ||
* Returns service that can be used to query attribute elements for attributes defined in this workspace. For | ||
* instance if workspace has data set Employee with attribute Name, then this service can be used to retrieve | ||
* names of all employees. | ||
*/ | ||
elements(): IElementQueryFactory; | ||
/** | ||
* Returns service that can be used to obtain settings that are currently in effect for the workspace. | ||
*/ | ||
settings(): IWorkspaceSettingsService; | ||
/** | ||
* Returns service that can be used to query workspace catalog items - attributes, measures, facts and date data sets | ||
*/ | ||
catalog(): IWorkspaceCatalogFactory; | ||
/** | ||
* Returns service that can be used to query data sets defined in this workspace. | ||
*/ | ||
dataSets(): IWorkspaceDatasetsService; | ||
/** | ||
* Returns service that can be used to query workspace permissions | ||
*/ | ||
permissions(): IWorkspacePermissionsFactory; | ||
} | ||
/** | ||
* Represents a user. It is an entry point to various services that can be used to inspect and modify the user. | ||
* | ||
* @public | ||
*/ | ||
export interface IUserService { | ||
/** | ||
* Returns service that can be used to obtain settings that are currently in effect for the user. | ||
*/ | ||
settings(): IUserSettingsService; | ||
} | ||
/** | ||
* Analytical Backend communicates its capabilities via objects of this type. In return, the capabilities | ||
@@ -267,64 +195,2 @@ * can then be used by applications to enable / disable particular features. | ||
/** | ||
* Defines authentication provider to use when instance of IAnalyticalBackend discovers that | ||
* the current session is not authentication. | ||
* | ||
* @public | ||
*/ | ||
export interface IAuthenticationProvider { | ||
/** | ||
* Perform authentication. | ||
* | ||
* @param context - context in which the authentication is done | ||
*/ | ||
authenticate(context: AuthenticationContext): Promise<AuthenticatedPrincipal>; | ||
/** | ||
* Returns the currently authenticated principal, or undefined if not authenticated. | ||
* Does not trigger authentication if no principal is available. | ||
*/ | ||
getCurrentPrincipal(context: AuthenticationContext): Promise<AuthenticatedPrincipal | undefined>; | ||
/** | ||
* Clear existing authentication. | ||
* | ||
* @param context - context in which the authentication is done | ||
*/ | ||
deauthenticate(context: AuthenticationContext): Promise<void>; | ||
} | ||
/** | ||
* Describes context in which the authentication is done. To cater for custom authentication schemes. | ||
* the API client of the underlying backend IS exposed anonymously to the provider - the provider SHOULD use | ||
* the provided API client to exercise any backend-specific authentication mechanisms. | ||
* | ||
* @public | ||
*/ | ||
export type AuthenticationContext = { | ||
/** | ||
* API client used to communicate with the backend - this can be used to perform any backend-specific, | ||
* non-standard authentication. | ||
*/ | ||
client: any; | ||
}; | ||
/** | ||
* Describes user, which is currently authenticated to the backend. | ||
* | ||
* @public | ||
*/ | ||
export type AuthenticatedPrincipal = { | ||
/** | ||
* Unique identifier of the authenticated user. The identifier semantics MAY differ between backend | ||
* implementations. The client code SHOULD NOT make assumptions on the content (such as userId being | ||
* valid email and so on). | ||
*/ | ||
userId: string; | ||
/** | ||
* Backend-specific user metadata. | ||
*/ | ||
userMeta?: any; | ||
}; | ||
// | ||
@@ -331,0 +197,0 @@ // Supporting / convenience functions |
@@ -1,2 +0,2 @@ | ||
// (C) 2019 GoodData Corporation | ||
// (C) 2019-2020 GoodData Corporation | ||
import isEmpty = require("lodash/isEmpty"); | ||
@@ -140,2 +140,9 @@ import { IDataView } from "../workspace/execution"; | ||
/** | ||
* Error converter | ||
* | ||
* @public | ||
*/ | ||
export type ErrorConverter = (e: any) => AnalyticalBackendError; | ||
/** | ||
* Type guard checking whether input is an instance of {@link AnalyticalBackendError} | ||
@@ -142,0 +149,0 @@ * |
@@ -5,3 +5,2 @@ // (C) 2019-2020 GoodData Corporation | ||
IAnalyticalBackend, | ||
IAnalyticalWorkspace, | ||
BackendCapabilities, | ||
@@ -11,10 +10,19 @@ AnalyticalBackendConfig, | ||
prepareExecution, | ||
IAuthenticationProvider, | ||
AuthenticationContext, | ||
AuthenticatedPrincipal, | ||
IUserService, | ||
} from "./backend"; | ||
export { | ||
AuthenticatedAsyncCall, | ||
AuthenticatedCallGuard, | ||
IAuthenticatedAsyncCallContext, | ||
AuthProviderCallGuard, | ||
AuthenticatedPrincipal, | ||
AuthenticationContext, | ||
IAuthProviderCallGuard, | ||
IAuthenticationProvider, | ||
NoopAuthProvider, | ||
} from "./auth"; | ||
export { ISettings, SettingCatalog } from "./common/settings"; | ||
export { IUserService } from "./user"; | ||
export { IUserSettingsService, IUserSettings } from "./user/settings"; | ||
@@ -59,3 +67,3 @@ | ||
export { | ||
IWorkspaceMetadata, | ||
IWorkspaceInsights, | ||
InsightOrdering, | ||
@@ -66,2 +74,4 @@ IInsightQueryOptions, | ||
export { IWorkspaceMetadata } from "./workspace/metadata"; | ||
export { | ||
@@ -78,2 +88,4 @@ IWorkspaceCatalogFactory, | ||
export { IWorkspaceDatasetsService } from "./workspace/ldm/datasets"; | ||
export { | ||
@@ -100,2 +112,3 @@ IElementQueryFactory, | ||
NotAuthenticated, | ||
ErrorConverter, | ||
isAnalyticalBackendError, | ||
@@ -115,6 +128,9 @@ isNoDataError, | ||
export { IWorkspaceDatasetsService } from "./workspace/ldm/datasets"; | ||
export { | ||
IAnalyticalWorkspace, | ||
IWorkspaceQuery, | ||
IWorkspaceQueryFactory, | ||
IWorkspaceQueryResult, | ||
} from "./workspace"; | ||
export { IWorkspaceQuery, IWorkspaceQueryFactory, IWorkspaceQueryResult } from "./workspace"; | ||
export { IWorkspacePermissionsFactory, IWorkspaceUserPermissions } from "./workspace/permissions"; |
// (C) 2019-2020 GoodData Corporation | ||
import { IWorkspace } from "@gooddata/sdk-model"; | ||
import { IPagedResource } from "../common/paging"; | ||
import { IExecutionFactory } from "./execution"; | ||
import { IWorkspaceInsights } from "./insights"; | ||
import { IWorkspaceStylingService } from "./styling"; | ||
import { IElementQueryFactory } from "./elements"; | ||
import { IWorkspaceSettingsService } from "./settings"; | ||
import { IWorkspaceCatalogFactory } from "./ldm/catalog"; | ||
import { IWorkspaceDatasetsService } from "./ldm/datasets"; | ||
import { IWorkspacePermissionsFactory } from "./permissions"; | ||
import { IWorkspaceMetadata } from "./metadata"; | ||
/** | ||
* Represents an analytical workspace hosted on a backend. It is an entry point to various services that can be | ||
* used to inspect and modify the workspace and run executions to obtain analytics for the workspace. | ||
* | ||
* @public | ||
*/ | ||
export interface IAnalyticalWorkspace { | ||
readonly workspace: string; | ||
/** | ||
* Returns execution factory - which is an entry point to triggering executions and thus obtaining | ||
* analytics from the workspace. | ||
*/ | ||
execution(): IExecutionFactory; | ||
/** | ||
* Returns service that can be used to query and update insights | ||
*/ | ||
insights(): IWorkspaceInsights; | ||
/** | ||
* Returns service that can be used to perform read and write operations on subset of workspace's metadata. | ||
*/ | ||
metadata(): IWorkspaceMetadata; | ||
/** | ||
* Returns service that can be used to obtain workspace styling settings. These settings specify for instance | ||
* what colors should be used in the charts. | ||
*/ | ||
styling(): IWorkspaceStylingService; | ||
/** | ||
* Returns service that can be used to query attribute elements for attributes defined in this workspace. For | ||
* instance if workspace has data set Employee with attribute Name, then this service can be used to retrieve | ||
* names of all employees. | ||
*/ | ||
elements(): IElementQueryFactory; | ||
/** | ||
* Returns service that can be used to obtain settings that are currently in effect for the workspace. | ||
*/ | ||
settings(): IWorkspaceSettingsService; | ||
/** | ||
* Returns service that can be used to query workspace catalog items - attributes, measures, facts and date data sets | ||
*/ | ||
catalog(): IWorkspaceCatalogFactory; | ||
/** | ||
* Returns service that can be used to query data sets defined in this workspace. | ||
*/ | ||
dataSets(): IWorkspaceDatasetsService; | ||
/** | ||
* Returns service that can be used to query workspace permissions | ||
*/ | ||
permissions(): IWorkspacePermissionsFactory; | ||
} | ||
/** | ||
* Factory providing creating queries used to get available workspaces. | ||
@@ -7,0 +75,0 @@ * |
// (C) 2019-2020 GoodData Corporation | ||
import { | ||
IVisualizationClass, | ||
IInsight, | ||
IAttributeDisplayForm, | ||
IMeasureExpressionToken, | ||
IInsightDefinition, | ||
ObjRef, | ||
IObjectMeta, | ||
} from "@gooddata/sdk-model"; | ||
import { IVisualizationClass, IInsight, IInsightDefinition, ObjRef } from "@gooddata/sdk-model"; | ||
import { IPagedResource } from "../../common/paging"; | ||
@@ -19,3 +11,3 @@ | ||
*/ | ||
export interface IWorkspaceMetadata { | ||
export interface IWorkspaceInsights { | ||
getVisualizationClass(ref: ObjRef): Promise<IVisualizationClass>; | ||
@@ -38,21 +30,2 @@ getVisualizationClasses(): Promise<IVisualizationClass[]>; | ||
deleteInsight(ref: ObjRef): Promise<void>; | ||
/** | ||
* Gets the attribute display form with the provided identifier. | ||
* @param ref - ref of the attribute display form to retrieve | ||
* @public | ||
*/ | ||
getAttributeDisplayForm(ref: ObjRef): Promise<IAttributeDisplayForm>; | ||
/** | ||
* Get measure expression tokens for provided measure identifier | ||
* @param ref - ref of the measure | ||
*/ | ||
getMeasureExpressionTokens(ref: ObjRef): Promise<IMeasureExpressionToken[]>; | ||
/** | ||
* Get information about the given fact's dataset | ||
* @param ref - ref of the fact | ||
*/ | ||
getFactDatasetMeta(ref: ObjRef): Promise<IObjectMeta>; | ||
} | ||
@@ -59,0 +32,0 @@ |
@@ -12,2 +12,3 @@ // (C) 2019-2020 GoodData Corporation | ||
IInsightDefinition, | ||
ObjRef, | ||
} from "@gooddata/sdk-model"; | ||
@@ -21,6 +22,6 @@ | ||
export interface IWorkspaceCatalogFactoryOptions { | ||
dataset?: string; | ||
dataset?: ObjRef; | ||
types: CatalogItemType[]; | ||
includeTags: string[]; | ||
excludeTags: string[]; | ||
includeTags: ObjRef[]; | ||
excludeTags: ObjRef[]; | ||
production: boolean; | ||
@@ -91,6 +92,6 @@ } | ||
export interface IWorkspaceCatalogFactoryMethods<T, TOptions> { | ||
forDataset(datasets: string): T; | ||
forDataset(dataset: ObjRef): T; | ||
forTypes(types: CatalogItemType[]): T; | ||
includeTags(tags: string[]): T; | ||
excludeTags(tags: string[]): T; | ||
includeTags(tags: ObjRef[]): T; | ||
excludeTags(tags: ObjRef[]): T; | ||
withOptions(options: TOptions): T; | ||
@@ -97,0 +98,0 @@ } |
@@ -1,2 +0,3 @@ | ||
// (C) 2019 GoodData Corporation | ||
// (C) 2019-2020 GoodData Corporation | ||
import { IDataset } from "@gooddata/sdk-model"; | ||
@@ -3,0 +4,0 @@ |
@@ -1,3 +0,3 @@ | ||
// (C) 2019 GoodData Corporation | ||
import { WorkspacePermission } from "@gooddata/sdk-model"; | ||
// (C) 2019-2020 GoodData Corporation | ||
import { WorkspacePermission, IWorkspacePermissions } from "@gooddata/sdk-model"; | ||
@@ -18,2 +18,7 @@ /** | ||
/** | ||
* Get all user permissions in current workspace | ||
*/ | ||
allPermissions(): IWorkspacePermissions; | ||
/** | ||
* Checks if user has provided permission in current workspace | ||
@@ -20,0 +25,0 @@ */ |
262008
69
6922