@domoinc/ryuu-proxy

中文文档
5.1.2发布于 2026/08/25MITTypeScriptES Module近 30 天下载 5944

a middleware that provides a proxy for local domo app development

原始使用文档
文档目录17 节
  1. Table of Contents
  2. Features
  3. Requirements
  4. Installation
  5. Usage
  6. Configuration
  7. With Express / Connect
  8. With Other Frameworks
  9. Error Handling
  10. HTTP Proxy Support
  11. Getting a proxyId (Advanced)
  12. Related Packages
  13. Contributing
  14. Workflow
  15. Scripts
  16. Versioning
  17. License

@domoinc/ryuu-proxy

npm version install size npm downloads types license Known Vulnerabilities

Middleware for local Domo App development. It intercepts calls to Domo data/API endpoints and proxies authenticated requests to your Domo instance, so you can develop against real data from your local dev server.

Table of Contents

Features

  • Intercepts and proxies Domo API traffic: /data/v{d}, /sql/v{d}, /dql/v{d}, /domo/.../v{d}, /api/...
  • Drop-in Express / Connect middleware via proxy.express()
  • Framework-agnostic proxy.stream(req) for Koa, Node http, Fastify, etc.
  • Handles multipart/form-data uploads (file streams via busboy)
  • Injects OAuth access/refresh tokens for apps using DQL, writeback, or OAuth features
  • Reads auth from your existing Domo CLI login session — no extra config
  • Ships with TypeScript types
  • ESM package

Requirements

  • Node.js 18+
  • An active Domo CLI session (domo login) — see @ryuu
  • A project manifest.json that has been published at least once (domo publish)
  • Peer: express ^4.17.0 || ^5.0.0 (only required if you use proxy.express())

Installation

pnpm add -D @domoinc/ryuu-proxy
# or
npm install --save-dev @domoinc/ryuu-proxy
# or
yarn add -D @domoinc/ryuu-proxy

Usage

This library leverages the last login session from your Domo CLI. If that session is no longer active or doesn't exist, the proxy won't work. Log in before starting your dev server:

domo login

Configuration

import { Proxy } from '@domoinc/ryuu-proxy';
import manifest from './path/to/app/manifest.json' with { type: 'json' };

const proxy = new Proxy({ manifest });

The Proxy constructor accepts a config object.

Required

  • manifest — parsed contents of your project's manifest.json. domo publish must have been run at least once so the manifest has an id.

Optional

  • manifest.proxyId — required for apps using DQL, writebacks, or OAuth. If you're unsure, you probably don't need it. See Getting a proxyId.

With Express / Connect

import express from 'express';

const app = express();
app.use(proxy.express());

With Other Frameworks

For other frameworks, stream() returns a readable stream you can pipe back to your response. It accepts a standard Node IncomingMessage, which most frameworks extend.

// koa
app.use(async (ctx, next) => {
  await proxy
    .stream(ctx.req)
    .then((data) => (ctx.body = ctx.req.pipe(data)))
    .catch(next);
});
// express
app.use((req, res, next) => {
  proxy
    .stream(req)
    .then((stream) => stream.pipe(res))
    .catch(() => next());
});
// node http
import http from 'node:http';

const server = http.createServer((req, res) => {
  if (req.url === '/') {
    loadHomePage(res);
  } else {
    proxy.stream(req).then((stream) => stream.pipe(res));
  }
});

Error Handling

Ignoring errors causes the proxy to fail silently and the request returns 404. To expose errors, catch DomoException and forward the status:

// koa
app.use(async (ctx, next) => {
  await proxy
    .stream(ctx.req)
    .then((data) => (ctx.body = ctx.req.pipe(data)))
    .catch((err) => {
      if (err.name === 'DomoException') {
        ctx.status = err.status || err.statusCode || 500;
        ctx.body = err;
      } else {
        next();
      }
    });
});
// express / connect
app.use((req, res, next) => {
  proxy
    .stream(req)
    .then((stream) => stream.pipe(res))
    .catch((err) => {
      if (err.name === 'DomoException') {
        res.status(err.status || err.statusCode || 500).json(err);
      } else {
        next();
      }
    });
});
// node http
const server = http.createServer((req, res) => {
  if (req.url === '/') {
    loadHomePage();
  } else {
    proxy
      .stream(req)
      .then((stream) => stream.pipe(res))
      .catch((err) => {
        if (err.name === 'DomoException') {
          res.writeHead(err.status || err.statusCode || 500);
          res.end(JSON.stringify(err));
        }
      });
  }
});

DomoException shape:

FieldDescription
nameAlways "DomoException"
status / statusCodeHTTP status code
statusMessageError description

HTTP Proxy Support

If you sit behind a corporate HTTP proxy, set any of the following environment variables. REACT_APP_-prefixed variants are also honored for Create React App projects.

VariablePurpose
PROXY_HOST / REACT_APP_PROXY_HOSTProxy hostname
PROXY_PORT / REACT_APP_PROXY_PORTProxy port
PROXY_USERNAME / REACT_APP_PROXY_USERNAMEBasic auth username (optional)
PROXY_PASSWORD / REACT_APP_PROXY_PASSWORDBasic auth password (optional)

Getting a proxyId (Advanced)

Apps using DQL, writeback, or OAuth features must supply a proxyId in the proxy configuration so the proxy can route requests correctly. A proxyId is of the form XXXXXXXX-XXXX-4XXX-XXXX-XXXXXXXXXXXX. To find it:

  1. Ensure the app has been published at least once with domo publish.
  2. Publish a new card from your app design, or open an existing card built from it.
  3. Right-click the card and choose Inspect element.
  4. Find the <iframe> containing your app. Its URL looks like //{HASH}.domoapps.prodX.domo.com?userId=....
  5. Copy the hash between // and .domoapps — that is your proxyId.

proxyIds tie apps to cards. If you delete the card you pulled the ID from, you'll need a new one from another card created from the same app design.

  • ryuu — the Domo CLI (domo login, domo publish, etc.)
  • ryuu-client — underlying Domo API client

Contributing

Workflow

  1. Create a branch (e.g. DOMO-XXXXXX)
  2. Make and commit changes
  3. Test — optionally publish an alpha/beta for integration testing
  4. Open a pull request
  5. After merge to master, bump the version and release to npm

Scripts

ScriptDescription
pnpm run buildCompile TypeScript to dist/
pnpm testRun the test suite (vitest)
pnpm run test:watchRun vitest in watch mode
pnpm run test:coverageRun tests with coverage
pnpm run formatFormat source with Prettier
pnpm run release:productionBuild and publish to npm
pnpm run release:betaBuild and publish under the beta tag
pnpm run release:alphaBuild and publish under the alpha tag

Versioning

This project uses standard-version with conventional commits to determine version bumps.

License

MIT

版本与发布记录

@domoinc/ryuu-proxy 共发布 71 个版本,首次发布于 2017/07/28;过去 12 个月发布了 6 个版本。

版本发布日期距今
5.1.2latest2026/08/252 个月前
5.1.2-beta.0beta2026/08/252 个月前
5.1.12026/08/182 个月前
5.1.02026/08/133 个月前
5.1.0-beta.12026/04/216 个月前
5.0.22026/02/218 个月前

其他发布通道:alpha → 4.3.2-alpha.0,beta → 5.1.2-beta.0。

关于 @domoinc/ryuu-proxy 的常见问题

@domoinc/ryuu-proxy 是什么?

a middleware that provides a proxy for local domo app development

如何安装 @domoinc/ryuu-proxy?

在项目目录运行 npm install @domoinc/ryuu-proxy,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:express(^4.17.0 || ^5.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@domoinc/ryuu-proxy 支持 TypeScript 吗?

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

@domoinc/ryuu-proxy 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@domoinc/ryuu-proxy 可以商用吗?

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

@domoinc/ryuu-proxy 的下载量有多少?

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

@domoinc/ryuu-proxy 还在维护吗?

最新版本 5.1.2 发布于 2026/08/25(2 个月前);至今共发布 71 个版本,其中过去 12 个月发布了 6 个;首次发布于 2017/07/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。