@cardstack/workflow

中文文档
0.14.38-patch.0发布于 2020/03/31MIT近 30 天下载 1.9万

The default blueprint for ember-cli addons.

原始使用文档
文档目录5 节
  1. Public API
  2. Installation
  3. Running
  4. Running Tests
  5. Building

@cardstack/workflow

The workflow package gives host apps a workflow system where each workflow can have a priority (which might change over time) and several tags.

It displays a notification counter and, when opened, a couple of panels to see the workflows grouped by priority and by tag. It allows to see at a glance which workflows need to be acted on, and then act on them.

Public API

Host apps need to render the {{cardstack-workflow}} component where they want the workflow panels to appear (preferably in the left edge of the screen).

The component accesses data through the cardstack-workflow service which also defines the following methods for the host app to use:

  • createThread(message1, message2, ...)
  • createMessageFor(cardModel, properties)

Creating a message for each card model in your application is required (the workflows work with messages under the hood) and is supported by the createMessageFor method above.

(We'll probably need a 3rd method to get the thread for a given card model).

Let's see an example.

Assume you have a rental model in your application and the corresponding card model, rental-card. To create a workflow where a new rental is offered, you'd do as follows:


workflow: inject('cardstack-workflow'),

let urgent = this.get('store').queryRecord('priority', { name: 'urgent' });
let bayArea = this.get('store').queryRecord('tag', { name: 'Bay Area' });

let rentalCard = this.get('store').createRecord('rental-card');

rentalCard.save(() => {
  let message = this.get('workflow').createMessageFor(rentalCard, {
    priority: urgent,
    tags: [ bayArea ],
  });
  return this.get('workflow').createThread(message);
});

In your app you define your models and then use the above methods to create a workflow around them.

For a detailed example, see the dummy app in this package.

Installation

  • git clone <repository-url> this repository
  • cd @cardstack/workflow
  • yarn install

Running

Running Tests

Run tests locally:

  • ember test --server

TravisCI runs the tests for each ember version listed in .travis.yml.

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.

版本与发布记录

@cardstack/workflow 共发布 229 个版本,首次发布于 2017/09/22;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.14.38-patch.0latest2020/03/316 年前
0.14.24-patch.12020/03/246 年前
0.14.492019/11/196 年前
0.14.482019/11/196 年前
0.14.472019/11/156 年前
0.14.462019/11/136 年前

其他发布通道:dotbc → 0.2.12-dotbc.0。

关于 @cardstack/workflow 的常见问题

@cardstack/workflow 是什么?

The default blueprint for ember-cli addons.

如何安装 @cardstack/workflow?

在项目目录运行 npm install @cardstack/workflow,或使用 pnpm add / yarn add / bun add。

@cardstack/workflow 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/cardstack__workflow 是否存在。

@cardstack/workflow 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js 6.* || 8.* || >= 10.*。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cardstack/workflow 可以商用吗?

@cardstack/workflow 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cardstack/workflow 的下载量有多少?

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

@cardstack/workflow 还在维护吗?

最新版本 0.14.38-patch.0 发布于 2020/03/31(6 年前);至今共发布 229 个版本,其中过去 12 个月发布了 0 个;首次发布于 2017/09/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。