Circle V2 API Docs
    Preparing search index...

    Function validateAndBuildIntegrationCredentials

    • Validates the integration credentials against the per-type schema (already guaranteed by Zod at the tRPC input boundary) and, for Kipu, merges the server-side access_id and secret_key from environment variables so they are written to the DB without ever being exposed to the client.

      Parameters

      • integration:
            | {
                credentials: {
                    app_id: string;
                    location_id: number;
                    location_name?: string;
                };
                type: "kipu";
            }
            | {
                credentials: {
                    bearer_token: string;
                    location_ids: number[];
                    location_name?: string;
                };
                type: "lightningstep";
            }
            | {
                credentials: {
                    api_id: string;
                    api_secret: string;
                    location_name?: string;
                    realm_id: string;
                    service_facility_id: number;
                    sunwave_email: string;
                };
                type: "sunwave";
            }

      Returns
          | {
              access_id: string;
              app_id: string;
              location_id: number;
              location_name?: string;
              secret_key: string;
          }
          | { bearer_token: string; location_ids: number[]; location_name?: string }
          | {
              api_id: string;
              api_secret: string;
              location_name?: string;
              realm_id: string;
              service_facility_id: number;
              sunwave_email: string;
          }