Thin javascript abstraction over the GoodData REST API
gdgate Merge pull request #299 from ivan-nejezchleb/FET-174
RELATED: FET-174 Update tslint config to allow _ prefix

Reviewed-by: Martin
             https://github.com/martinmosko
Latest commit 59bc6d2 Sep 18, 2018
Permalink
Failed to load latest commit information.
docker RELATED: FET-29 Node 8.9.4 LTS Feb 16, 2018
pages BUGFIX: FET-142 Fix build warning Aug 3, 2018
src RELATED: FET-174 Update tslint config to allow _ prefix Sep 18, 2018
test FEATURE: PR-296 user.isLoggedInProject(projectId) Aug 15, 2018
tools FEATURE: RAIL-290 Add jest Sep 5, 2017
.editorconfig RELATED: RAIL-308 Add TypeScript definition file Oct 2, 2017
.eslintrc RELATED: FET-122 Use lint rules from new packages Jul 25, 2018
.gitignore RELATED: FET-53 Convert gooddata-js to TS, vol. I Apr 4, 2018
.nvmrc RELATED: RAIL-647 telemetry support for SDK Mar 12, 2018
.travis.yml RELATED: FET-53 Convert gooddata-js to TS, vol. I Apr 4, 2018
CHANGELOG.md RELATED: PR-296, PR-298: Update CHANGELOG Aug 20, 2018
Gruntfile.js BUGFIX: FET-142 Fix publishing of gooddata-js API documentation Aug 3, 2018
LICENSE RELATED: RAIL-151 Updated license Sep 26, 2017
README.md TRIVIAL: Update README with CHANGELOG reminder Aug 20, 2018
gdc-ci.yaml RELATED: FET-53 Convert gooddata-js to TS, vol. I Apr 4, 2018
jest.ci.json RELATED: FET-53 Convert gooddata-js to TS, vol. I Apr 4, 2018
jest.setup.js RELATED: FET-53 Convert gooddata-js to TS, vol. I Apr 4, 2018
package.json RELATED: FET-174 Update tslint config to allow _ prefix Sep 18, 2018
tsconfig.build.json RELATED: FET-94 Refactor tsconfig files May 9, 2018
tsconfig.json RELATED: FET-94 Refactor tsconfig files May 9, 2018
tslint.json RELATED: FET-122 Use lint rules from new packages Jul 25, 2018
webpack.config.js RELATED: FET-53 Convert gooddata-js to TS, vol. I Apr 4, 2018
yarn.lock RELATED: FET-174 Update tslint config to allow _ prefix Sep 18, 2018

README.md

npm version

GoodData JS SDK

Thin javascript abstraction over the GoodData REST API

Getting started

Usage

Using as a npm package

  1. go to your project directory and add the package:
    → with yarn: yarn add @gooddata/gooddata-js
    → with npm: npm install --save @gooddata/gooddata-js

    ❗️ WARNING: npm package renamed from gooddata to @gooddata/gooddata-js ❗️

  2. import the package's default export:
    → in transpiled browser app with ES6 modules syntax: import { factory } from '@gooddata/gooddata-js';
    → in node.js with CommonJS syntax: const factory = require('@gooddata/gooddata-js').factory;

  3. call the API:

    var gooddata = factory({ domain: 'secure.gooddata.com' });
    gooddata.user.login('john.doe@example.com', 'your-secret-password')
        .then((response) => console.log('Login OK', response))
        .catch((apiError) => console.error('Login failed', apiError, "\n\n", apiError.responseBody));
    
  4. Please note that CORS could prevent the request. Refer to your options in GoodData.UI documentation, ie. setup local proxy or ask the GoodData platform for allowing a specific domain.

Using as a standalone library

You have two options:

  • download gooddata.js or gooddata.min.js from the latest release
  • build on your own:
    git clone https://github.com/gooddata/gooddata-js.git
    cd gooddata-js
    git checkout v6.0.0 # choose a version, or omit this line to use unstable code from `master` branch
    yarn install --pure-lockfile
    yarn build
    # get gooddata.js and gooddata.min.js from /dist folder

Then you can import the library file and global variable gooddata contains all exported members:

<script type="text/javascript" src="gooddata.js"></script>
<script type="text/javascript">
    var sdk = gooddata.factory({ domain: 'secure.gooddata.com' });
    sdk.user.login('john.doe@example.com', 'your-secret-password')
</script>

Contributing ☕️

We welcome any contribution in form of issues or pull requests. These commands may come in handy while developing:

command description
yarn install --pure-lockfile first step
yarn dev build gooddata-js to /dist in watch mode
yarn test run unit tests in watch mode
yarn validate validate codestyle (tslint)
yarn build build commonjs /lib and bundle files to /dist
grunt yuidoc:compile build yui docs to /docs

Do not forget to update CHANGELOG.md when contributing.

Publishing

❗️ Only for internal gooddata developers ❗️

NPM package publishing

Package publishing is done via Jenkins Job:

https://checklist.intgdc.com/job/client-libs/job/gooddata-js-release/

SDK API documentation publishing

To publish API documentation sdk.gooddata.com/gooddata-js/api you have to prompt following commands:

command description
1. yarn build
2. grunt bump-gh-pages Publishes documentation

Changelog

License

(C) 2007-2018 GoodData Corporation

For more information, please see LICENSE