@flipdish/orgmanagement

中文文档
2.0.1发布于 2026/11/13UnlicenseTypeScriptESM + CJS零依赖近 30 天下载 2535

APIs for managing Flipdish client organisations, brands, properties, and sales channels.

原始使用文档
文档目录3 节
  1. @flipdish/orgmanagement
  2. Example code
  3. Client identity

@flipdish/orgmanagement

This package provides a TypeScript/JavaScript client for Flipdish's Organisation Management APIs over HTTP.

It is generated with Hey API and uses the native fetch API, so it has no runtime dependencies. It works in Node.js 18+, Bun, Deno and browsers, and ships both ES modules and CommonJS.

Example code

import { createFlipdishClient, SDK_INFO } from "@flipdish/orgmanagement";
import { describe, expect, test } from "@jest/globals";

const orgManagement = createFlipdishClient({
  baseUrl: "https://api-prod-staging.flipdishdev.com",
  // to get the API key, you should follow these docs:
  // https://developers.flipdish.com/docs/getting-started
  accessToken: process.env.FLIPDISH_BEARER_TOKEN,
  // optional: identifies your app in the X-Flipdish-Client header,
  // and in User-Agent outside browsers. Defaults to env vars such as DD_SERVICE.
  clientName: "sdk-test-app",
});

describe("Org Management Tests", () => {
  describe("Orgs", () => {
    // test("Get org by id", async () => {
    //   const { data, error } = await orgManagement.getOrgById({
    //     path: { orgId: "org12345" },
    //   });
    //   expect(error).toBeUndefined();
    //   expect(data?.data.orgId).toBe("org12345");
    // });

    test("client is created", () => {
      expect(orgManagement.getAllOrgs).toBeInstanceOf(Function);
    });
  });

  describe("Client identity", () => {
    test("sends User-Agent and X-Flipdish-Client in Node", async () => {
      let sent: Request | undefined;
      const sdk = createFlipdishClient({
        clientName: "sdk-test-app",
        clientVersion: "1.2.3",
        fetch: async (input) => {
          sent = input as Request;
          return new Response(JSON.stringify({ data: [] }), {
            headers: { "content-type": "application/json" },
          });
        },
      });

      await sdk.getAllOrgs();

      const expected = `Flipdish-orgmanagement-ts/${SDK_INFO.version} sdk-test-app/1.2.3`;
      expect(sent?.headers.get("user-agent")).toMatch(
        new RegExp(`^${expected.replace(/[.+]/g, "\\$&")} `),
      );
      expect(sent?.headers.get("x-flipdish-client")).toBe(
        sent?.headers.get("user-agent"),
      );
    });
  });
});

Client identity

Every request carries an X-Flipdish-Client header identifying the SDK and the app using it. Outside browsers the same value is also sent as User-Agent, for example:

Flipdish-orgmanagement-ts/2.0.1 menu-service/2.3.1 env/production node/22.18.0

Each part can be set in code or with an environment variable. The first one that is set wins, with the option checked first:

PartOptionEnvironment variables
App nameclientNameFLIPDISH_CLIENT_NAME, DD_SERVICE, AWS_LAMBDA_FUNCTION_NAME, npm_package_name
App versionclientVersionFLIPDISH_CLIENT_VERSION, DD_VERSION, npm_package_version
EnvironmentclientEnvironmentFLIPDISH_CLIENT_ENVIRONMENT, DD_ENV, NODE_ENV
RuntimeruntimeFLIPDISH_CLIENT_RUNTIME, then the detected Node.js, Bun or Deno version
SuffixuserAgentSuffixFLIPDISH_CLIENT_USER_AGENT_SUFFIX

Pass the options to createFlipdishClient, or call configureClientIdentity to set them on the default client:

import { configureClientIdentity } from "@flipdish/orgmanagement";

configureClientIdentity({ clientName: "menu-service", clientVersion: "2.3.1", clientEnvironment: "production" });

Browsers have no environment variables, so set at least clientName in code there. Anything passed in headers overrides these values.

版本与发布记录

@flipdish/orgmanagement 共发布 366 个版本,首次发布于 2024/08/28;过去 12 个月发布了 104 个版本。

版本发布日期距今
2.0.1latest2026/11/132 天前
2.0.1-rc.1794581463next2026/11/132 天前
2.0.02026/11/132 天前
2.0.0-rc.17945799652026/11/132 天前
0.0.0-preview.183.g0a86e1epreview2026/11/123 天前
1.1.772026/10/2917 天前

关于 @flipdish/orgmanagement 的常见问题

@flipdish/orgmanagement 是什么?

APIs for managing Flipdish client organisations, brands, properties, and sales channels.

如何安装 @flipdish/orgmanagement?

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

@flipdish/orgmanagement 支持 TypeScript 吗?

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

@flipdish/orgmanagement 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@flipdish/orgmanagement 需要什么版本的 Node.js?

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

@flipdish/orgmanagement 可以商用吗?

@flipdish/orgmanagement 使用 Unlicense 许可。作者将代码贡献到公共领域,可不受限制地使用。以上为概括,不构成法律意见,请以许可原文为准。

@flipdish/orgmanagement 的下载量有多少?

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

@flipdish/orgmanagement 还在维护吗?

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