Portal Community

Recommended Package Structure

@myorg/atlas-crm-actions/
├── src/
│   ├── handlers/
│   │   ├── linkAccount.ts       // Handler for crm:link-account
│   │   ├── syncContacts.ts      // Handler for crm:sync-contacts
│   │   └── createOpportunity.ts // Handler for crm:create-opportunity
│   ├── types.ts                  // Shared types for this library
│   └── index.ts                  // Exports and register() function
├── package.json
└── tsconfig.json

index.ts Pattern

// src/index.ts
import { registerFormAction } from '@atlas-forms/control-registry-js';
import { linkAccountHandler } from './handlers/linkAccount';
import { syncContactsHandler } from './handlers/syncContacts';
import { createOpportunityHandler } from './handlers/createOpportunity';

// Convenient registration function
export function registerCrmActions(): void {
  registerFormAction('crm:link-account', linkAccountHandler);
  registerFormAction('crm:sync-contacts', syncContactsHandler);
  registerFormAction('crm:create-opportunity', createOpportunityHandler);
}

// Also export handlers individually for testing
export { linkAccountHandler, syncContactsHandler, createOpportunityHandler };

package.json Requirements

{
  "name": "@myorg/atlas-crm-actions",
  "version": "1.0.0",
  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "peerDependencies": {
    "@atlas-forms/types-js": "^1.0.0",
    "@atlas-forms/control-registry-js": "^1.0.0"
  },
  "devDependencies": {
    "@atlas-forms/types-js": "^1.0.0",
    "@atlas-forms/control-registry-js": "^1.0.0",
    "typescript": "^5.0.0",
    "vitest": "^1.0.0"
  }
}
peerDependencies, Not dependencies Always declare @atlas-forms/* packages as peerDependencies. If they are in dependencies, npm installs a separate copy and your handlers will register against a different registry instance than the app — causing lookups to fail.

Domain Grouping Strategy

PackageActionsDomain
@myorg/atlas-crm-actionslink-account, sync-contacts, create-opportunityCRM system integration
@myorg/atlas-finance-actionspost-invoice, approve-payment, generate-poFinance workflow triggers
@myorg/atlas-hr-actionscreate-employee, offboard-employee, approve-leaveHR system actions
@myorg/atlas-notification-actionssend-slack, send-email, send-smsMulti-channel notifications