npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

huozige-app-integration

v0.1.5

Published

TypeScript SDK for Huozige WebAPI server commands.

Readme

huozige-app-integration

用于调用活字格服务端命令及相关 WebAPI 接口的 TypeScript SDK。

安装

npm install huozige-app-integration

导出内容

  • invoke
  • callServerCommandWithCookie
  • callGetTableDataWithOffsetWithCookie
  • callGetComboBindingOptionsWithCookie
  • callCalcBindingDataSourceWithCookie
  • HuozigeWebApiSdk

用法

调用服务端命令

import { invoke } from "huozige-app-integration";

await invoke(
  "POST",
  "https://example.com/playground",
  "demoCommand",
  JSON.stringify({ hello: "world" }),
  "your-client-id",
  "your-client-secret",
  (httpCode, responseInJSON, errorMessage) => {
    console.log(httpCode, responseInJSON, errorMessage);
  }
);

使用 Cookie 调用服务端命令

import { callServerCommandWithCookie } from "huozige-app-integration";

await callServerCommandWithCookie(
  "GET",
  "https://example.com/playground",
  "demoCommand",
  JSON.stringify({ hello: "world" }),
  "ForguncyServer=9mfghtL3fR2S...",
  (httpCode, responseInJSON, errorMessage) => {
    console.log(httpCode, responseInJSON, errorMessage);
  }
);

获取表格数据

import { callGetTableDataWithOffsetWithCookie } from "huozige-app-integration";

await callGetTableDataWithOffsetWithCookie(
  "https://example.com/playground",
  {
    columns: [
      {
        "column-name": "文本",
        guid: "38bc1902-7dea-421d-a10e-4cec1c7ab95e"
      },
      {
        "column-name": "整数",
        guid: "c93f6c99-4cdb-45de-b174-b3196a61cb7e"
      }
    ],
    "table-name": "数据表1",
    "view-name": "测试页面表格1",
    "list-view-location": "测试页面|表格1",
    "page-name": "测试页面",
    "target-page": 1,
    "page-limit-row-count": 0
  },
  "ForguncyServer=9mfghtL3fR2S...",
  (httpCode, responseInJSON, errorMessage) => {
    console.log(httpCode, responseInJSON, errorMessage);
  }
);

获取下拉选项

import { callGetComboBindingOptionsWithCookie } from "huozige-app-integration";

await callGetComboBindingOptionsWithCookie(
  "https://example.com/playground",
  {
    "id-column": {
      "column-name": "整数",
      guid: "9e5cf221-9fbd-4ded-aeb5-bb02449e819d"
    },
    "text-column": {
      "column-name": "文本",
      guid: "7135e363-d135-4c05-91b2-c162a85f050c"
    },
    "table-name": "数据表1",
    "page-name": "测试页面"
  },
  "ForguncyServer=9mfghtL3fR2S...",
  (httpCode, responseInJSON, errorMessage) => {
    console.log(httpCode, responseInJSON, errorMessage);
  }
);

获取 Calc 绑定数据源

import { callCalcBindingDataSourceWithCookie } from "huozige-app-integration";

await callCalcBindingDataSourceWithCookie(
  "https://example.com/playground",
  {
    "page-name": "Calendar 日历",
    "cell-location": "102,2",
    "table-name": "日程表",
    columns: [
      {
        "response-name": "date",
        "table-name": "日程表",
        "column-name": "日期"
      },
      {
        "response-name": "text",
        "table-name": "日程表",
        "column-name": "详情"
      }
    ]
  },
  "ForguncyServer=9mfghtL3fR2S...",
  (httpCode, responseInJSON, errorMessage) => {
    console.log(httpCode, responseInJSON, errorMessage);
  }
);

该接口会先通过 GetMetadata2 使用 page-name + cell-location 定位运行态绑定 GUID,再调用 CalcBindingDataSource。返回结果会按 columns 将 Calc 响应中的 response-name 字段映射为数据表 column-name

如果绑定存在可传入的查询参数,传入 query-paramsparams。SDK 会按顺序把 query-params 中的 表名.列名 映射到运行态 bindingOptions.Params 中的公式参数名;如果运行态元数据没有暴露 Params,SDK 会返回错误,不会发送一个服务端会忽略的无效 Params

设计态元数据里的同页公式参数需要先归一成运行态参数名:例如当前页是 出入库单填写 时,=出入库单填写!Container1.Text 应按 =Container1.Text 传入。若要贴近前端请求,可显式传入 options: { distinct: true }

源码结构

  • src/server-command.ts:服务端命令调用,包括 OAuth 和 Cookie 两种入口。
  • src/table-binding.tsGetTableDataWithOffset 表格数据绑定。
  • src/candidate-binding.tsGetComboBindingOptions 候选项/下拉绑定。
  • src/datasource-binding.tsGetMetadata2 + CalcBindingDataSource 数据源绑定。
  • src/client.ts:兼容旧内部入口,仅重新导出上述模块。

脚本

npm run build
npm test

详细规格见 docs/spec.md