@flatfile/plugin-automap

中文文档
0.8.2发布于 2025/06/26ISCTypeScriptESM + CJS近 30 天下载 4060

A plugin to provide automapping imported files for headless workflows.

原始使用文档
文档目录3 节
  1. Parameters
  2. API Calls
  3. Usage

The @flatfile/plugin-automap plugin listens for and responds to file extraction jobs and then creates a mapping job for automation. Currently, every field in the Job Execution plan must meet the minimum confidence level specified by the accuracy config prop.

When embedding Flatfile, this plugin should be deployed in a server-side listener. Learn more

Parameters

accuracy - 'confident' | 'exact' - (required)

The accuracy parameter match columns either by 'confident' (> 90% match) or 'exact' (100% match).

debug - boolean

The debug parameter lets you toggle on/off helpful debugging messages for development purposes.

defaultTargetSheet - 'string' | '(fileName: string) => string | Promise'

The defaultTargetSheet parameter takes the exact sheet slug or a callback function that resolves to the exact sheet slug to import data to.

matchFilename - RegExp

The matchFilename parameter takes a regular expression to match specific files to perform automapping on.

onFailure - (event: FlatfileEvent) => void | Promise<void>

The onFailure parameter takes a callback function to be executed when plugin bails. The callback can be synchronous or asynchronous.

targetWorkbook - string

The targetWorkbook parameter specifies destination Workbook id or name.

API Calls

  • api.files.get
  • api.files.update
  • api.jobs.create
  • api.jobs.execute
  • api.jobs.getExecutionPlan
  • api.workbooks.list
  • api.workbooks.get

Usage

For automation workflows, upload a file using the files endpoint. For testing, you import via the Files area in the UI and use the debug config property.

Install

npm i @flatfile/plugin-automap

Import

import { automap } from "@flatfile/plugin-automap";

listener.ts

listener.use(
  automap({
    accuracy: "confident",
    defaultTargetSheet: "Contact",
    matchFilename: /test.csv$/g,
    onFailure: async (event: FlatfileEvent) => {
      // send an SMS, an email, post to an endpoint, etc.
      console.error(
        `Please visit https://spaces.flatfile.com/space/${event.context.spaceId}/files?mode=import to manually import file.`
      );
    },
  })
);

版本与发布记录

@flatfile/plugin-automap 共发布 27 个版本,首次发布于 2023/07/01;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.8.2latest2025/06/261.4 年前
0.8.12024/12/111.9 年前
0.8.02024/11/082 年前
0.7.02024/10/302 年前
0.6.02024/10/232 年前
0.5.22024/10/092 年前

关于 @flatfile/plugin-automap 的常见问题

@flatfile/plugin-automap 是什么?

A plugin to provide automapping imported files for headless workflows.

如何安装 @flatfile/plugin-automap?

在项目目录运行 npm install @flatfile/plugin-automap,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@flatfile/api(^1.9.19)、@flatfile/listener(^1.1.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@flatfile/plugin-automap 支持 TypeScript 吗?

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

@flatfile/plugin-automap 支持 ESM 还是 CommonJS?

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

@flatfile/plugin-automap 需要什么版本的 Node.js?

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

@flatfile/plugin-automap 可以商用吗?

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

@flatfile/plugin-automap 的下载量有多少?

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

@flatfile/plugin-automap 还在维护吗?

最新版本 0.8.2 发布于 2025/06/26(1.4 年前);至今共发布 27 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/07/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。