@useairfoil/producer-salesforce

中文文档
0.0.3发布于 2026/11/03TypeScriptES Module构建来源已验证

Syncs Salesforce records from one org: standard objects, custom objects, field history, and field definitions. It backfills each table, then polls business objects every 10 minutes and setup objects every hour. Salesforce has no signed webhooks, so there

原始使用文档
文档目录6 节
  1. Config
  2. Setup
  3. API version
  4. Data
  5. Demo data
  6. Limits

Salesforce producer

Syncs Salesforce records from one org: standard objects, custom objects, field history, and field definitions. It backfills each table, then polls business objects every 10 minutes and setup objects every hour. Salesforce has no signed webhooks, so there are none.

ResourceWhat
accounts, account_contact_relations, account_team_members, contacts, leads, opportunities, opportunity_line_items, opportunity_contact_roles, opportunity_competitors, opportunity_team_members, opportunity_splits, partners, forecasting_quotasSales
quotes, quote_line_items, contracts, contract_contact_roles, orders, order_itemsQuotes and orders
products, pricebooks, pricebook_entries, assets, asset_relationshipsCatalog and assets
campaigns, campaign_members, campaign_member_statuses, individuals, contact_point_emails, contact_point_phonesMarketing
cases, case_comments, case_contact_roles, case_team_members, entitlements, service_contracts, contract_line_items, solutions, email_messages, email_message_relations, live_chat_transcripts, messaging_sessions, macros, quick_textsService
work_orders, work_order_line_items, service_appointments, service_resources, service_territories, assigned_resources, resource_absences, locations, product_itemsField Service
tasks, task_relations, events, event_relations, notes, attachments, feed_items, feed_comments, topics, topic_assignmentsActivities
account_history, contact_history, lead_history, case_history, opportunity_history, opportunity_field_historyField history
users, user_roles, profiles, permission_sets, permission_set_assignments, groups, group_members, collaboration_groups, collaboration_group_members, record_types, business_hours, holidays, periods, organization, folders, documentsUsers and setup
duplicate_record_sets, duplicate_record_itemsDuplicate rules
custom_objectsRecords of every custom object (*__c)
object_fieldsField definitions, to name fields keys

Config

VariableRequiredDefault
SALESFORCE_DOMAINyesnone
SALESFORCE_CLIENT_IDyesnone
SALESFORCE_CLIENT_SECRETyesnone

SALESFORCE_DOMAIN is the org's My Domain host, such as acme.my.salesforce.com. Sandboxes work too.

Setup

  1. Pick the user the connector runs as. A user with the Salesforce Integration license works. Give it API Enabled, read access to the synced objects, and View All Data. Without View All Data, records outside its sharing are missed.
  2. In Setup, open External Client App Manager → New External Client App. Turn on OAuth with the api scope and Enable Client Credentials Flow. The callback URL isn't used.
  3. In the app's Policies → OAuth Policies, turn on the client credentials flow and set Run As to the user from step 1.
  4. Under Settings → OAuth Settings → Consumer Key and Secret, copy the key and secret to SALESFORCE_CLIENT_ID and SALESFORCE_CLIENT_SECRET.

One app and domain read one org, so run one connector per org.

API version

The connector uses REST API v68.0 (Winter '27).

Data

  • Object tables keep every non-null field the user can read in fields, by API name, as strings: text as is, numbers and booleans as JSON text, and dates as Salesforce sends them. New custom fields show up on their own. object_fields has each field's label, type, and picklist values.
  • Address and location fields are left out, because their parts (such as BillingCity) are fields too. So are binary fields, such as attachment bodies.
  • created_at is CreatedDate and updated_at is SystemModstamp. Both are null on objects without them, such as history objects.
  • custom_objects holds every custom object. object says which, such as Invoice__c.
  • A deleted or merged-away record gets _deleted. A restored record comes back.
  • Contacts, leads, users, individuals, contact points, cases, emails, chat and messaging transcripts, feed items, notes, tasks, and events hold names, emails, phone numbers, addresses, and message bodies. Treat them as customer data.

Demo data

pnpm demo --size 128MiB writes made-up Salesforce data without Salesforce credentials. See the Connector Kit README for the flags and the variables it needs.

Each account has contacts, opportunities with products, quotes, history, and splits, and, once won, a contract, an order, assets, a service contract with entitlements, an install visit, and an onboarding project in custom_objects. Customers open cases with comments, emails, and chats. Accounts also get tasks, events, notes, Chatter posts, and a lead. The org setup is written once and doesn't grow with the size: users, roles, profiles, permissions, groups, the catalog and price book, campaigns, service resources, and object_fields.

Limits

  • Salesforce lists changes for the last 30 days and deletes for the last 15. A connector stopped for more than 15 days fails, and those tables need a new backfill.
  • Formula fields that read other records only change in a row when the record itself changes.
  • permission_sets, permission_set_assignments, and collaboration_groups can't be replicated, so they're read in full every hour, and removed rows stay.
  • An org without a feature, such as Quotes or Field Service, or a user without access, leaves that table in error. The other tables keep syncing.
  • Every table costs at least 2 API calls per poll. With every table on, that's about 23,000 calls a day. A Developer Edition org has 15,000, so turn on only the tables you need there.

版本与发布记录

@useairfoil/producer-salesforce 共发布 4 个版本,首次发布于 2026/10/29;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.0.3latest2026/11/03今天
0.0.22026/10/295 天前
0.0.12026/10/295 天前
0.0.0-stage2026/10/295 天前

关于 @useairfoil/producer-salesforce 的常见问题

@useairfoil/producer-salesforce 是什么?

从一个组织同步Salesforce记录:标准对象、自定义对象、字段历史和字段定义。它回填每个表,然后每10分钟轮询业务对象,每小时设置对象。Salesforce没有签名的webhook,所以

如何安装 @useairfoil/producer-salesforce?

在项目目录运行 npm install @useairfoil/producer-salesforce,或使用 pnpm add / yarn add / bun add。

@useairfoil/producer-salesforce 支持 TypeScript 吗?

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

@useairfoil/producer-salesforce 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@useairfoil/producer-salesforce 可以商用吗?

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

@useairfoil/producer-salesforce 还在维护吗?

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