@cfxlabsinc/b2b-services
    Preparing search index...

    Reconciles a customer's AWS API Gateway usage-plan key links to their customer_api_plan grant set. The grant set (deletedAt IS NULL) is the source of truth.

    Gateway-only: each of the customer's API keys must be linked to the stage's usage plan iff the stage is granted. Drift is repaired with CreateUsagePlanKey / DeleteUsagePlanKey. Linking self-heals a key off a conflicting legacy usage plan (one that shares an apiId:stage with the target) before creating the new link, since AWS rejects a second key link on an already-associated apiId:stage.

    Admin-only — the operator sync page in admin-dashboard is the sole consumer, so it lives here rather than in a shared domain package.

    Index

    Constructors

    Methods

    • Reconciles every manageable stage for the customer. Per stage, links/unlinks usage-plan keys so the gateway matches the grant. One stage's failure (try/catch per stage) doesn't abort the rest. Idempotent: re-running is a no-op once converged. Ineligible stages are skipped.

      Parameters

      • __namedParameters: { customerId: string }

      Returns Promise<{ ok: true; value: { results: ApiStageSyncResult[] } }>