@sourceloop/ctrl-plane-tenant-management-service
Version:
Tenant Management microservice for SaaS control plane
35 lines (34 loc) • 1.94 kB
TypeScript
import { SubscriptionDTO, TenantWithRelations } from '../models';
import { CryptoHelperService } from './crypto-helper.service';
import { TenantRepository, WebhookSecretRepository } from '../repositories';
import { IProvisioningService } from '../types';
import { ILogger } from '@sourceloop/core';
import { EventConnector } from './event-connector';
/**
* Service for provisioning tenants.
*/
export declare class ProvisioningService<T extends SubscriptionDTO> implements IProvisioningService<T> {
private cryptoHelperService;
private eventConnector;
private webhookSecretRepo;
private tenantRepository;
private logger;
/**
* Constructs a new instance of the ProvisioningService.
* @param cryptoHelperService - Service for cryptographic operations.
* @param eventConnector - Event Connector provided by consumer to invoke publish on.
* @param webhookSecretRepo - Repository for webhook secrets.
* @param logger - Logger service for logging messages.
*/
constructor(cryptoHelperService: CryptoHelperService, eventConnector: EventConnector, webhookSecretRepo: WebhookSecretRepository, tenantRepository: TenantRepository, logger: ILogger);
/**
* The `provisionTenant` function provisions a new tenant by generating a temporary token, retrieving
* the subscription details, generating a random HMAC secret, starting a build process, and storing the
* webhook secret and build context to later verify the webhook callback.
* @param {Tenant} tenant - The `tenant` parameter is an object that represents a tenant. It likely
* contains information such as the tenant's ID, name, and other relevant details.
* @param {string} subscription - The `subscription` parameter is an object that contains
* the details of the subscription opted by the tenant.
*/
provisionTenant(tenant: TenantWithRelations, subscription: T): Promise<void>;
}