@flatfile/blueprint

中文文档
0.0.15发布于 2025/06/30TypeScriptESM + CJS近 30 天下载 2.2万

The universal DDL for defining data structures across Flatfile.

原始使用文档
文档目录13 节
  1. Objectives
  2. Term Considerations
  3. Example Configuration
  4. string 🧵 (default)
  5. Configuration Options
  6. number #️⃣
  7. Configuration Options
  8. reference 🔗
  9. Configuration Options
  10. enum
  11. Configuration Options
  12. boolean
  13. date

Blueprint

@flatfile/blueprint is the point of reference for working with customer-defined data structures in Flatfile. We have a lot of different data problems to solve for across different systems such as the DAL, Pipelines, Workbooks, Turntable, and the SDK.

Objectives

  • Describe any reasonable structure of data as defined by external systems
  • Inform underlying databases engines on how best to store and retrieve data
  • Inform rendering engines (such as tables or forms) on how best to render data points
  • Inform matching or AI systems of ontological classifications of data
  • Provide guidance to end-users that is specific to the data structure
  • Provide configuration for database driven validations
  • Report for analytics or future optimization purposes, what user or system defined hooks are running

Term Considerations

  • Property — Describes an attribute of the entity (eg. name, email) and how it should behave.

Example Configuration

{
  "properties": [
    {
      "key": "code",
      "label": "Product Code",
      "type": "string",
      "description": "Unique identifier defining an individual product.",
      "constraints": [
        {
          "type": "unique",
          "config": {
            "caseSensitive": false
          }
        }
      ],
      "config": {
        "size": "tiny"
      }
    },
    {
      "key": "description",
      "type": "string"
    },
    {
      "key": "price",
      "type": "number",
      "config": {
        "decimalPlaces": 2
      }
    },
    {
      "key": "category",
      "label": "Product Category",
      "type": "enum",
      "multi": true,
      "config": {
        "allowCustom": false,
        "options": [
          {
            "value": 9,
            "label": "Kitchenware",
            "icon": "pots-and-pans",
            "color": "#f00000",
            "meta": {
              "product_code_prefix": "KI-"
            }
          },

          {
            "value": 9,
            "label": "Clothing",
            "meta": {
              "product_code_prefix": "CL-"
            }
          }
        ]
      }
    }
  ]
}

Core Properties

All properties have the following options. If a property type ends with [] (such as string[]) it should be stored, retrieved, and presented as an array of unlimited size.

OptionDescriptionDefaultRequired?
keyThe system name of this field. Primarily informs JSON and egress structures.✅
typeOne of string, number, boolean, date, enum, reference. Defines the handling of this property.✅
labelA user-facing descriptive label designed to be displayed in the UI such as a table header.key
descriptionA long form description of the property intended to be displayed to an end user.
constraintsAn array of system level Validation Rules meant to be applied after hooks are run.[]
configConfiguration relevant to the type of column. See property documentation below.{}Sometimes
multiWill allow multiple values and store / provide the values in an array if set. Not all field types support arrays.false
metaArbitrary object of values to pass through to hooks and egress{}

string 🧵 (default)

Defines a property that should be stored and read as a basic string. Database engines should expect any length of text to be provided here unless explicitly defined in the config.

Configuration Options

  • size: enum(tiny, normal, medium, long) — How much text should be storeable in this field?
    • tiny = up to 255 characters
    • ➡normal = 64kb (default)
    • medium = 16mb
    • long = 4gb

number #️⃣

Defines a property that should be stored and read as either an integer or floating point number. Database engines should look at the configuration to determine ideal storage format.

Configuration Options

OptionDescriptionDefault
decimalPlacesThe number of decimal places to preserve accuracy to. Overages should be automatically rounded with a warning. A hook can pre-format to accomplish floor or ceil.0

reference 🔗

Warning

This is not comparable to a foreign key. There should be no specification of which column to reference by as it is multi-variate. A user may establish a relationship in mapping with a soft reference like a company name, once stored in our system we will reference by our internal IDs, and on egress we provide the known system_id if available.

Defines a reference to another sheet. Links should be established automatically by the matching engine or similar upon an evaluation of unique or similar columns between datasets.

Configuration Options

OptionDescriptionRequired?
refFull path reference to another sheet/table configuration. Must be in the same workbook.✅
relationshipThe type of relationship this defines. Can be one of has-many or has-one✅

enum

Defines an enumerated list of options for the user to select from. Matching tooling attempts to resolve incoming data assigment to a valid option. The maximum number of options for this list is 100. For larger lists, users should use the reference or future lookup types.

Configuration Options

OptionDescriptionDefaultRequired?
allowCustomPermit the user to create new options for this specific field.false
options[]A list of valid options the user can select from✅
valueThe value or ID of this option. This value will be sent in egress✅
labelA visual label for this option, defaults to value if not provided
colorAn optional color to assign this option
iconA reference pointer to a previously registered icon
metaAn arbitrary JSON object to be associated with this option and made available to hooks

boolean

A true or false value type. Matching engines should attempt to resolve all common ways of representing this value and it should usually be displayed as a checkbox.

OptionDescriptionDefault
allowIndeterminateAllow an indeterminate (null) option that is neither selected or unselected.true

date

Store a field as a GMT date. Data hooks must convert this value into a YYYY-MM-DD format in order for it to be considered a valid value. Datetime should be a separate and future supported value as it must consider timezone.

Future Types

  1. Linked Property — Populate this property with a value or values from a referenced table - data hooks can further transform. Should support filters.
    • Example 1: Show a readonly value on a contact based on the country of a linked company
  2. Rollup — Use a datahook to sum or compute all the referenced values. Should support filtering.
    • Example 1: The sum() of all items.price * items.quty linked to an invoice
    • Example 2: The count of deals with status: lost linked to a salesperson
  3. Groups/Sets — An arbitrarily named group of records that can either be merely grouped under a namespace or repeated similar to a relational set.
    • Example 1: List of contact_methods with a type, value, and priority.
    • Example 2: address group with street, city, ...
  4. Remote Lookup — a type of field that relies on a datahook to return valid options instead of an enum list or a reference table.
    • Example 1: This field must be a valid flight number for the provided city and date. Users should be able to select from a list of valid flights when interacting with the cell.
    • Example 2: Global autocomplete for address entry. As you type, a set of suggestions appear in a dropdown.

版本与发布记录

@flatfile/blueprint 共发布 14 个版本,首次发布于 2022/08/17;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.0.15latest2025/06/301.4 年前
0.0.142024/04/262 年前
0.0.132024/04/042 年前
0.0.122024/03/282 年前
0.0.102023/12/142 年前
0.0.92023/05/203 年前

关于 @flatfile/blueprint 的常见问题

@flatfile/blueprint 是什么?

The universal DDL for defining data structures across Flatfile.

如何安装 @flatfile/blueprint?

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

@flatfile/blueprint 支持 TypeScript 吗?

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

@flatfile/blueprint 支持 ESM 还是 CommonJS?

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

@flatfile/blueprint 需要什么版本的 Node.js?

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

@flatfile/blueprint 可以商用吗?

@flatfile/blueprint 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@flatfile/blueprint 的下载量有多少?

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

@flatfile/blueprint 还在维护吗?

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