@conduit-client/bindings-utils

中文文档
3.35.0发布于 2026/11/12SEE LICENSE IN LICENSE.txtTypeScriptESM + CJS近 30 天下载 2039

Conduit utils for building bindings consistently

原始使用文档
文档目录9 节
  1. Overview
  2. Key Features
  3. API Reference
  4. Error Handling Utilities
  5. Command Types
  6. Usage Examples
  7. Error Handling
  8. Command Type Usage
  9. Dependencies

@conduit-client/bindings-utils

Utility functions and types for building Conduit bindings consistently across different environments.

Overview

This package provides core utilities for error handling, command type definitions, and common patterns used in both LWC and imperative binding implementations. It serves as a foundational layer for building robust data bindings in the Conduit ecosystem.

Key Features

  • Error Handling: Comprehensive error detection and handling utilities
  • Command Types: Type definitions for different command result patterns
  • Logging Utilities: Standardized error logging and transformation

API Reference

Error Handling Utilities

isInternalError(error: unknown): boolean

Determines if an error is an internal system error.

isUserVisibleError(error: unknown): boolean

Checks if an error should be shown to end users.

getErrorResponse(error: unknown)

Transforms errors into standardized response format.

logError(error: unknown, logger?: Logger)

Logs errors with appropriate context and formatting.

Command Types

ResultCommand<R>

Command that returns a direct result.

SubscribableResultCommand<R>

Command that returns a subscribable result for reactive updates.

MaybeSubscribableResultCommand<R>

Command that can return either a direct or subscribable result.

ResultOrSubscribableResult<R>

Union type for result flexibility.

Usage Examples

Error Handling

import { isInternalError, isUserVisibleError, logError } from '@conduit-client/bindings-utils/v1';

try {
  // Your code here
} catch (error) {
  if (isInternalError(error)) {
    // Handle internal error
    logError(error);
  } else if (isUserVisibleError(error)) {
    // Show error to user
    showUserNotification(error);
  }
}

Command Type Usage

import type { ResultCommand, SubscribableResultCommand } from '@conduit-client/bindings-utils/v1';

// Direct result command
const fetchData: ResultCommand<UserData> = {
  execute: () => Promise.resolve(userData),
};

// Subscribable command for reactive data
const subscribeToData: SubscribableResultCommand<UserData> = {
  execute: () => ({
    subscribe: (callback) => {
      // Subscribe logic
      return unsubscribe;
    },
  }),
};

Dependencies

  • @conduit-client/utils: Core utility functions
  • @conduit-client/command-base: Base command interfaces

版本与发布记录

@conduit-client/bindings-utils 共发布 72 个版本,首次发布于 2025/11/15;过去 12 个月发布了 72 个版本。

版本发布日期距今
3.35.0latest2026/11/122 天前
3.34.02026/11/059 天前
3.33.02026/10/2916 天前
3.32.12026/10/2223 天前
3.32.02026/10/1530 天前
3.31.02026/10/091 个月前

其他发布通道:patch → 3.26.1-dev3。

关于 @conduit-client/bindings-utils 的常见问题

@conduit-client/bindings-utils 是什么?

Conduit utils for building bindings consistently

如何安装 @conduit-client/bindings-utils?

在项目目录运行 npm install @conduit-client/bindings-utils,或使用 pnpm add / yarn add / bun add。

@conduit-client/bindings-utils 支持 TypeScript 吗?

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

@conduit-client/bindings-utils 支持 ESM 还是 CommonJS?

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

@conduit-client/bindings-utils 可以商用吗?

@conduit-client/bindings-utils 使用 SEE LICENSE IN LICENSE.txt 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@conduit-client/bindings-utils 的下载量有多少?

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

@conduit-client/bindings-utils 还在维护吗?

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