@inploi/sdk

中文文档
2.4.0发布于 2026/11/01MITTypeScriptESM + CJS

This package contains the core functionality for the inploi SDK.

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. Plugins
  4. External dependencies
  5. Using plugins

@inploi/sdk

This package contains the core functionality for the inploi SDK.

Installation

npm install @inploi/sdk

Versions 2.0.0–2.1.4 declared the private github:inploi/talent-bank repository as a runtime dependency, so npm install failed with git ls-remote … Permission denied unless the environment could authenticate to inploi's GitHub organisation (Linear PROD-6970). Later versions bundle the Talent Bank contract and install from npm without GitHub credentials.

Usage

Initialise the SDK with initialiseSdk:

import { initialiseSdk } from '@inploi/sdk';

const sdk = initialiseSdk({
    publishableKey: 'your-publishable-key',
    env: 'sandbox',
});

Plugins

The root exports saveSearchEndpoint, JobAlertsFilters and JOB_ALERT_FREQUENCIES for the shared job-alert contract. Widgets can call saveClosedRoleJobAlerts(rpcClient, { contact, job? }) after explicit opt-in; it verifies a known job's identity, uses its available city/town/category as filters and saves weekly alerts. Lookup failures propagate to the caller. RPC responses reject non-success HTTP status codes before validating the response schema, including endpoints with a type-only response schema.

You can write custom plugins via the createPlugin function. The plugin will have two dependencies injected: a logger service and a an apiClient service, which can be used to make requests to the inploi API.

Example:

export const myCounterPlugin = createPlugin(({ logger, apiClient }) => {
    let count = 0;
    logger.info('myCounterPlugin initialised');

    return {
        add: () => {
            count++;
            logger.info(`count is now ${count}`);
        },
        getCount: () => count,
    };
});

External dependencies

If your plugin requires external dependencies, you may want to wrap the createPlugin function with whatever it takes, to then generate a function that returns a plugin:

import { createPlugin } from '@inploi/sdk';

type CounterExternalDeps = {onUpdate: (newCounter: number) => void};

export const myCounterPlugin = ({onUpdate}: CounterExternalDeps) =>
  createPlugin(({ logger, apiClient }) => {
    let count = 0;
    logger.info('myCounterPlugin initialised');

    return {
      add: () => {
        count++;
        logger.info(`count is now ${count}`);
        onUpdate(count);
      },
      getCount: () => count,
    };
  });

Using plugins

Register a plugin with sdk.register. The plugin receives its declared services and the returned object is exposed to the caller.

const sdk = initialiseSdk({
    publishableKey: 'your-publishable-key',
    env: 'sandbox',
});

const simple = sdk.register(mySimplePlugin);

const myCounterPlugin = sdk.register(myPluginWithDeps({ onUpdate: newCounter => console.log(newCounter) }));

myCounterPlugin.add();

版本与发布记录

@inploi/sdk 共发布 112 个版本,首次发布于 2023/10/10;过去 12 个月发布了 23 个版本。

版本发布日期距今
2.4.0latest2026/11/012 天前
2.3.32026/10/267 天前
2.3.22026/09/271 个月前
2.3.12026/09/251 个月前
2.3.02026/09/251 个月前
2.2.02026/09/231 个月前

关于 @inploi/sdk 的常见问题

@inploi/sdk 是什么?

这个包包含inploi SDK的核心功能。

如何安装 @inploi/sdk?

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

@inploi/sdk 支持 TypeScript 吗?

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

@inploi/sdk 支持 ESM 还是 CommonJS?

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

@inploi/sdk 可以商用吗?

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

@inploi/sdk 还在维护吗?

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