@gooddata/gooddata-js

中文文档
13.5.0发布于 2021/02/11BSD-3-ClauseTypeScriptCommonJS近 30 天下载 2.5万

GoodData JavaScript SDK

此软件包已被标记为弃用

@gooddata/gooddata-js reached End of Support on March 31, 2022. Please upgrade (see https://sdk.gooddata.com/gooddata-ui/docs/migration_guide_8.html for more information).

原始使用文档
文档目录10 节
  1. Getting started
  2. Usage
  3. Using as a npm package
  4. Using as a standalone library
  5. Contributing :coffee:
  6. Publishing
  7. NPM package publishing
  8. SDK API documentation publishing
  9. Changelog
  10. License

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

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

  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('[email protected]', '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('[email protected]', 'your-secret-password')
</script>

Contributing :coffee:

We welcome any contribution in form of issues or pull requests.

Install Node.js (node 12.16.1, npm v6.13.4) and Yarn 1.22.4.

These commands may come in handy while developing:

commanddescription
yarn install --frozen-lockfilefirst step
yarn devbuild gooddata-js to /dist in watch mode
yarn testrun unit tests in watch mode
yarn validatevalidate codestyle (tslint)
yarn buildbuild commonjs /lib and bundle files to /dist
grunt yuidoc:compilebuild yui docs to /docs

Do not forget to update CHANGELOG.md when contributing.

Publishing

:heavy_exclamation_mark: Only for internal gooddata developers :heavy_exclamation_mark:

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:

commanddescription
1. yarn build
2. grunt bump-gh-pagesPublishes documentation

Changelog

License

(C) 2007-2018 GoodData Corporation

For more information, please see LICENSE

版本与发布记录

@gooddata/gooddata-js 共发布 380 个版本,首次发布于 2018/04/13;过去 12 个月发布了 0 个版本。

版本发布日期距今
13.5.0latest2021/02/115 年前
13.4.02021/01/085 年前
13.3.02020/12/185 年前
13.2.0-alpha-no23reason-dho-rail-todo-locked-flag-2020-12-18T10-37-12-195Zalpha2020/12/185 年前
13.2.0-alpha-no23reason-dho-rail-todo-locked-flag-2020-12-18T09-53-31-997Z2020/12/185 年前
13.2.02020/11/235 年前

其他发布通道:beta → 12.5.3-lanhuynh-HEAD-2020-04-20T09-19-16-342Z,alpha → 13.2.0-alpha-no23reason-dho-rail-todo-locked-flag-2020-12-18T10-37-12-195Z。

关于 @gooddata/gooddata-js 的常见问题

@gooddata/gooddata-js 是什么?

GoodData JavaScript SDK注意:该包已被作者标记为弃用——@gooddata/gooddata-js reached End of Support on March 31, 2022. Please upgrade (see https://sdk.gooddata.com/gooddata-ui/docs/migration_guide_8.html for more information).

如何安装 @gooddata/gooddata-js?

在项目目录运行 npm install @gooddata/gooddata-js,或使用 pnpm add / yarn add / bun add。

@gooddata/gooddata-js 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gooddata/gooddata-js 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@gooddata/gooddata-js 可以商用吗?

@gooddata/gooddata-js 使用 BSD-3-Clause 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。另外不得用原作者名义为衍生产品背书。以上为概括,不构成法律意见,请以许可原文为准。

@gooddata/gooddata-js 的下载量有多少?

根据 npm 官方下载统计,@gooddata/gooddata-js 在 2026/10/17 – 2026/11/15 这 30 天内被下载 25,432 次,日均约 848 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gooddata/gooddata-js 还在维护吗?

最新版本 13.5.0 发布于 2021/02/11(5 年前);至今共发布 380 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/04/13。作者已将其标记为弃用,新项目建议寻找替代方案。