# jsm-orgs-lambda-dev

Synchronizes configured sandbox organizations, clusters, and Lakes from the
internal `jsm-syncer` API into the development snapshot tables.

Organization targets are maintained in `config.js`, matching the configuration
style of the production Lambda. Cluster and Lake synchronization use internal
organization-scoped endpoints and do not require a user email. Secrets and
endpoints remain Lambda environment settings: `DATABASE_URL`,
`JSM_SYNCER_BASE_URL`, and `JSM_SYNCER_API_TOKEN`.

The deployment package intentionally excludes dependencies. `mysql2` is supplied by
the shared sandbox Lambda layer and HTTP requests use the Node.js 24 built-in `fetch`.

`add-cluster-search-indexes.sql` records the non-unique indexes used by the Slack
external cluster selector for active ID/name prefix searches.

`create-lake-snapshot-table.sql` creates the development Lake snapshot table. It
stores the complete Jira field payload together with searchable Lake metadata and
uses the same per-organization generation/soft-delete model as cluster snapshots.

Lake synchronization calls `/orgs/:tidbcloud_org_id/lakes` and validates that the
response and every Lake payload belong to the requested organization.
