Skip to content

Commit

Permalink
Revert "Revert "RELATED: RAIL-657 Added factory method for multiple i…
Browse files Browse the repository at this point in the history
…nstances""

This reverts commit c48e4f5.
  • Loading branch information
vaclavbohac committed Mar 6, 2018
1 parent 5a9e636 commit ebcebe5
Show file tree
Hide file tree
Showing 49 changed files with 2,790 additions and 2,368 deletions.
3 changes: 0 additions & 3 deletions .bowerrc

This file was deleted.

5 changes: 1 addition & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": ["gooddata"],
"rules": {
"jest/valid-expect": 0
}
"extends": ["gooddata"]
}
42 changes: 24 additions & 18 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,6 @@ module.exports = (grunt) => {

license: grunt.file.read('tools/license.tmpl'),

eslint: {
options: {
config: '.eslintrc',
format: grunt.option('ci') && 'checkstyle',
outputFile: grunt.option('ci') && 'ci/results/eslint-results.xml'
},
all: {
src: [
'./*.js',
'{src,test,tools}/**/*.js',
'!tools/yuidoc/**/*'
]
}
},
copy: {
examples: {
src: 'dist/gooddata.js',
Expand All @@ -37,6 +23,24 @@ module.exports = (grunt) => {
'run',
'test:ci'
]
},
eslint: {
cmd: 'yarn',
args: [
'validate'
]
},
eslintCi: {
cmd: 'yarn',
args: [
'validate:ci'
]
},
typings: {
cmd: 'yarn',
args: [
'test:typings'
]
}
},
grizzly: {
Expand Down Expand Up @@ -125,22 +129,24 @@ module.exports = (grunt) => {
grunt.loadNpmTasks('grunt-grizzly');
grunt.loadNpmTasks('grunt-contrib-yuidoc');
grunt.loadNpmTasks('grunt-gh-pages');
grunt.loadNpmTasks('gruntify-eslint');
grunt.loadNpmTasks('grunt-run');

grunt.registerTask('default', ['dist']);
grunt.registerTask('dist', [
'getGitInfo',
'eslint',
'run:eslint',
'webpack:build-dev',
'webpack:build',
'copy'
]);

grunt.registerTask('bump-gh-pages', ['yuidoc:gh_pages', 'gh-pages-clean', 'gh-pages']);

grunt.registerTask('test', ['eslint', 'run:jest']);
grunt.registerTask('test', [
'run:eslintCi',
'run:jest',
'run:typings'
]);
grunt.registerTask('dev', ['grizzly', 'watch:js']);
grunt.registerTask('doc', ['yuidoc']);
grunt.registerTask('validate', ['eslint']);
};
4 changes: 2 additions & 2 deletions gdc-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# defaults - https://github.com/gooddata/gdc-ci/blob/develop/components/client/gdc-ci.yaml
pull-request:
- ci-run-validation
- echo "Running unit tests..." && grunt test
- yarn validate:ci
- grunt test
130 changes: 73 additions & 57 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ export interface IAccountInfo {
profileUri: string;
}

export module user {
export function isLoggedIn(): Promise<boolean>;
export interface IUser {
isLoggedIn(): Promise<boolean>;

export function login(username: string, password: string): Promise<any>;
login(username: string, password: string): Promise<any>;

export function logout(): Promise<void>;
logout(): Promise<void>;

export function updateProfileSettings(profileId: string, profileSettings: any): Promise<any>;
updateProfileSettings(profileId: string, profileSettings: any): Promise<any>;

export function getAccountInfo(): Promise<IAccountInfo>;
getAccountInfo(): Promise<IAccountInfo>;

export function getFeatureFlags(): Promise<any>;
getFeatureFlags(): Promise<any>;
}

export interface IIdentifierUriPair {
Expand Down Expand Up @@ -67,60 +67,60 @@ export interface IValidElementsResponse {
}
}

export module md {
export function getObjects<T>(projectId: string, objectUris: string[]): Promise<T>;
export interface IMetadata {
getObjects<T>(projectId: string, objectUris: string[]): Promise<T>;

export function getObjectsByQuery<T>(projectId: string, options: { category?: string, mode?: string, author?: string, limit?: number }): Promise<T>;
getObjectsByQuery<T>(projectId: string, options: { category?: string, mode?: string, author?: string, limit?: number }): Promise<T>;

export function getObjectUsing<T>(projectId: string, uri: string, options?: { types?: string[], nearest?: boolean }): T;
getObjectUsing<T>(projectId: string, uri: string, options?: { types?: string[], nearest?: boolean }): T;

export function getObjectUsingMany<T>(projectId: string, uris: string[], options?: { types?: string[], nearest?: boolean }): T;
getObjectUsingMany<T>(projectId: string, uris: string[], options?: { types?: string[], nearest?: boolean }): T;

export function getAttribute(projectId: string): Promise<any>;
getAttribute(projectId: string): Promise<any>;

export function getVisualizations(projectId: string): Promise<any>;
getVisualizations(projectId: string): Promise<any>;

export function getDimensions(projectId: string): Promise<any>;
getDimensions(projectId: string): Promise<any>;

export function getFacts(projectId: string): Promise<any>;
getFacts(projectId: string): Promise<any>;

export function getMetrics(projectId: string): Promise<any>;
getMetrics(projectId: string): Promise<any>;

export function getFolders(projectId: string, type: string): Promise<any>;
getFolders(projectId: string, type: string): Promise<any>;

export function getAvailableMetrics(projectId: string, attributes: string[]): Promise<any>;
getAvailableMetrics(projectId: string, attributes: string[]): Promise<any>;

export function getAvailableAttributes(projectId: string, metrics: string[]): Promise<any>;
getAvailableAttributes(projectId: string, metrics: string[]): Promise<any>;

export function getAvailableFacts(projectId: string, items: string[]): Promise<any>;
getAvailableFacts(projectId: string, items: string[]): Promise<any>;

export function getObjectDetails<T>(uri: string): Promise<T>;
getObjectDetails<T>(uri: string): Promise<T>;

export function getFoldersWithItems(projectId: string, type: string): Promise<any>;
getFoldersWithItems(projectId: string, type: string): Promise<any>;

export function getObjectIdentifier(uri: string): Promise<string>;
getObjectIdentifier(uri: string): Promise<string>;

export function getObjectUri(projectId: string, identifier: string): Promise<string>;
getObjectUri(projectId: string, identifier: string): Promise<string>;

export function getUrisFromIdentifiers(projectId: string, identifiers: string[]): Promise<IIdentifierUriPair[]>;
getUrisFromIdentifiers(projectId: string, identifiers: string[]): Promise<IIdentifierUriPair[]>;

export function getIdentifiersFromUris(projectId: string, uris: string[]): Promise<IIdentifierUriPair[]>;
getIdentifiersFromUris(projectId: string, uris: string[]): Promise<IIdentifierUriPair[]>;

export function translateElementLabelsToUris(projectId: string, labelUri: string, patterns: string[], mode: 'EXACT' | 'WILD'): Promise<any>
translateElementLabelsToUris(projectId: string, labelUri: string, patterns: string[], mode: 'EXACT' | 'WILD'): Promise<any>

export function getValidElements(projectId: string, id: string, options: IValidElementsOptions): Promise<IValidElementsResponse>;
getValidElements(projectId: string, id: string, options: IValidElementsOptions): Promise<IValidElementsResponse>;

export function deleteObject(uri: string): Promise<any>;
deleteObject(uri: string): Promise<any>;

export function createObject<T>(projectId: string, obj: T): Promise<T>;
createObject<T>(projectId: string, obj: T): Promise<T>;

export function ldmManage(projectId: string, maql: string, options: { maxAttempts?: number, pollStep?: number }): Promise<any>;
ldmManage(projectId: string, maql: string, options: { maxAttempts?: number, pollStep?: number }): Promise<any>;

export function etlPull(projectId: string, uploadsDir: string, options: { maxAttempts?: number, pollStep?: number }): Promise<any>;
etlPull(projectId: string, uploadsDir: string, options: { maxAttempts?: number, pollStep?: number }): Promise<any>;
}

export module config {
export function setCustomDomain(d: string): void;
export interface IConfig {
setCustomDomain(d: string): void;
}

export interface ILoadCatalogOptions {
Expand All @@ -146,10 +146,10 @@ export interface ILoadDateDataSetOptions {
returnAllRelatedDateDataSets?: boolean;
}

export module catalogue {
export function loadItems(projectId: string, options: ILoadCatalogOptions): Promise<any>;
export interface ICatalogue {
loadItems(projectId: string, options: ILoadCatalogOptions): Promise<any>;

export function loadDateDataSets(projectId: string, options: ILoadDateDataSetOptions): Promise<any>;
loadDateDataSets(projectId: string, options: ILoadDateDataSetOptions): Promise<any>;
}

export interface ISort {
Expand Down Expand Up @@ -338,12 +338,12 @@ export interface IVisualizationObject {
}
}

export module execution {
export function getDataForVis(projectId: string, mdObj: IVisualizationObjectContent, settings: any): Promise<ISimpleExecutorResult>;
export interface IExecution {
getDataForVis(projectId: string, mdObj: IVisualizationObjectContent, settings: any): Promise<ISimpleExecutorResult>;

export function getData(projectId: string, columns: string[], executionConfiguration: IExecutionConfiguration, settings: any): Promise<ISimpleExecutorResult>;
getData(projectId: string, columns: string[], executionConfiguration: IExecutionConfiguration, settings: any): Promise<ISimpleExecutorResult>;

export function executeAfm(projectId: string, execution: AFM.IExecution): Promise<Execution.IExecutionResponses>;
executeAfm(projectId: string, execution: AFM.IExecution): Promise<Execution.IExecutionResponses>;
}

export interface IColor {
Expand All @@ -352,34 +352,50 @@ export interface IColor {
b: number;
}

export module project {
export function getCurrentProjectId(): Promise<string>;
export interface IProject {
getCurrentProjectId(): Promise<string>;

export function getProjects(profileId: string): Promise<string>;
getProjects(profileId: string): Promise<string>;

export function getDatasets(projectId: string): Promise<any>;
getDatasets(projectId: string): Promise<any>;

export function getColorPalette(projectId: string): Promise<IColor[]>;
getColorPalette(projectId: string): Promise<IColor[]>;

export function setColorPalette(projectId: string, colors: IColor[]): Promise<void>;
setColorPalette(projectId: string, colors: IColor[]): Promise<void>;

export function getTimezone(projectId: string): Promise<string>;
getTimezone(projectId: string): Promise<string>;

export function setTimezone(projectId: string, timezone: string): Promise<void>;
setTimezone(projectId: string, timezone: string): Promise<void>;

export function createProject(title: string, authorizationToken: string, options?: object): Promise<any>;
createProject(title: string, authorizationToken: string, options?: object): Promise<any>;

export function deleteProject(projectId: string): Promise<void>;
deleteProject(projectId: string): Promise<void>;
}

export interface IXhrSettings {
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD';
data?: any;
}

export module xhr {
export function get<T>(uri: string, settings?: IXhrSettings): Promise<T>;
export function post<T>(uri: string, settings?: IXhrSettings): Promise<T>;
export function put<T>(uri: string, settings?: IXhrSettings): Promise<T>;
export function ajax<T>(uri: string, settings?: IXhrSettings): Promise<T>;
export interface IXhr {
get<T>(uri: string, settings?: IXhrSettings): Promise<T>;
post<T>(uri: string, settings?: IXhrSettings): Promise<T>;
put<T>(uri: string, settings?: IXhrSettings): Promise<T>;
ajax<T>(uri: string, settings?: IXhrSettings): Promise<T>;
}

export interface ISdk {
xhr: IXhr;
project: IProject;
execution: IExecution;
catalogue: ICatalogue;
config: IConfig;
md: IMetadata;
user: IUser;
}

export interface ISdkOptions {
domain?: string;
}

export declare function factory(options?: ISdkOptions): ISdk;
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,31 @@
"build:dist": "rm -rf dist && grunt dist",
"prepublish": "npm run build",
"test": "jest --watch",
"validate": "eslint --ext .js,.jsx src test",
"validate:ci": "yarn validate -f checkstyle -o ci/results/eslint-results.xml",
"test:typings": "tsc --noEmit index.d.ts",
"test:ci": "JEST_JUNIT_OUTPUT=./ci/results/test-results.xml jest --config jest.ci.json"
},
"repository": {
"type": "git",
"url": "git@github.com:gooddata/gooddata-js.git"
},
"jest": {
"transform": {
".(js|jsx)": "babel-jest"
}
},
"devDependencies": {
"async": "2.1.5",
"babel-cli": "6.23.0",
"babel-core": "6.23.1",
"babel-jest": "22.2.2",
"babel-loader": "6.3.2",
"babel-plugin-lodash": "3.2.11",
"babel-preset-es2015": "6.22.0",
"babel-preset-stage-0": "6.22.0",
"babel-register": "6.23.0",
"eslint-config-gooddata": "0.0.13",
"eslint-config-gooddata": "0.0.17",
"exports-loader": "0.6.3",
"fast-levenshtein": "2.0.6",
"fetch-mock": "5.12.2",
Expand All @@ -48,14 +57,14 @@
"grunt-grizzly": "0.12.0",
"grunt-run": "0.8.0",
"grunt-webpack": "1.0.14",
"gruntify-eslint": "3.1.0",
"imports-loader": "0.7.0",
"istanbul-instrumenter-loader": "0.2.0",
"jest": "21.0.0",
"jest-junit": "3.0.0",
"js-object-pretty-print": "0.2.0",
"json-loader": "0.5.4",
"lodash-webpack-plugin": "0.11.0",
"typescript": "2.7.2",
"webpack": "1.13.2",
"webpack-dev-server": "1.16.1"
},
Expand Down
Loading

0 comments on commit ebcebe5

Please sign in to comment.