Files
calendar/packages/app-store/salesforce
Benny JooGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
96bec9f7b9 refactor: Move repositories from @calcom/lib to @calcom/features domain folders (#27570)
* refactor: move repositories from lib to features domain folders

- Move HolidayRepository to features/holidays/repositories
- Move PrismaTrackingRepository to features/bookings/repositories
- Move PrismaBookingPaymentRepository to features/bookings/repositories
- Move PrismaRoutingFormResponseRepository to features/routing-forms/repositories
- Move PrismaAssignmentReasonRepository to features/assignment-reason/repositories
- Move VerificationTokenRepository to features/auth/repositories
- Move WorkspacePlatformRepository to features/workspace-platform/repositories
- Move DTO files to their respective feature domains
- Merge lib DestinationCalendarRepository into features version
- Merge lib SelectedCalendarRepository into features version
- Update all import paths across the codebase

This follows the vertical slice architecture pattern by organizing
repositories by domain rather than by technical layer.

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>

* fix: update VerificationTokenService import path to new location

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>

* fix: update test file imports to use new repository locations

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>

* mv

* fix structure

* fix

* refactor: merge unit tests for SelectedCalendarRepository into single file

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-02-09 08:41:04 -03:00
..
2022-11-22 20:10:31 -03:00

Creating a Salesforce test org

You must have the Salesforce CLI installed to create a test org. Once installed, you can create a test org using the following command yarn scratch-org:create

This will create a scratch org with the configuration specified in the project-scratch-def.json file.

To open a browser tab to the org, run yarn scratch-org:start

Working With GraphQL

This package utilizes GraphQL Codegen to generate types and queries from the Salesforce schema.

Generating GraphQL Schema

Currently v63 of the Salesforce graphql endpoint throws an error when trying to generate files. This is due to the Setup__JoinInput type not generating any fields. To work around this, the schema.json file comes from the Salesforce graphql introspection query. This file is then converted to a SDL file using the graphql-introspection-json-to-sdl package. You can generate the SDL file by running yarn generate:schema.

Generating Queries

When working with graphql files ensure that yarn codegen:watch is running in the background. This will generate the types and queries from the SDL file.

Developing the SFDC package

The SFDC package is written using Apex. To develop this package, you need to have the Salesforce CLI installed. Then you can run yarn sfdc:deploy:preview to see what changes will be deployed to the scratch org. Running yarn sfdc:deploy will deploy the changes to the scratch org.

Note that if you want to call your local development instances you need to change the "Named Credential" on the scratch org settings to point the CalCom_Development credential to the local instance.

Publishing the SFDC Package

All commands should be run from the sfdc-package directory:

cd packages/app-store/salesforce/sfdc-package

Initial Setup (One-time)

If the package doesn't exist yet in the Dev Hub, create it:

sf package create \
  --name "calcom-sfdc-package" \
  --package-type Unlocked \
  --path force-app \
  --target-dev-hub team@cal.com

This registers the package and updates sfdx-project.json with the package ID.

Creating a New Package Version

Each time you want to release changes, create a new version:

sf package version create \
  --package "calcom-sfdc-package" \
  --installation-key-bypass \
  --wait 20 \
  --target-dev-hub team@cal.com

Options:

  • --installation-key-bypass: Allows installation without a password
  • --wait 20: Waits up to 20 minutes for completion
  • --code-coverage: Add this flag when ready to promote (requires 75% Apex test coverage)

Viewing Packages and Installation URLs

List all package versions:

sf package version list --target-dev-hub team@cal.com

The installation URL format is:

https://login.salesforce.com/packaging/installPackage.apexp?p0=<04t_SUBSCRIBER_PACKAGE_VERSION_ID>

Promoting for Production

Beta versions can only be installed in sandboxes/scratch orgs. To allow installation in production orgs, promote the version:

sf package version promote \
  --package "calcom-sfdc-package@X.X.X-X" \
  --target-dev-hub team@cal.com

Replace X.X.X-X with the version number (e.g., 0.1.0-1).

Running Tests

To run Apex tests and check code coverage:

sf project deploy start --target-org <org-alias>
sf apex run test --test-level RunLocalTests --wait 10 --target-org <org-alias>