@memberjunction/actions-bizapps-lms
Version:
LMS system integration actions for MemberJunction
77 lines • 2.91 kB
TypeScript
import { ActionParam } from '@memberjunction/actions-base';
import { BaseAction } from '@memberjunction/actions';
import { UserInfo } from '@memberjunction/core';
import { CompanyIntegrationEntity } from '@memberjunction/core-entities';
/**
* Base class for all LMS-related actions.
* Provides common functionality and patterns for interacting with Learning Management Systems.
*/
export declare abstract class BaseLMSAction extends BaseAction {
/**
* The LMS provider this action is designed for (e.g., 'LearnWorlds', 'Moodle', etc.)
*/
protected abstract lmsProvider: string;
/**
* The integration name to look up in the Integration entity
*/
protected abstract integrationName: string;
/**
* Cached company integration for the current execution
*/
private _companyIntegration;
/**
* Common LMS parameters that many actions will need
*/
protected getCommonLMSParams(): ActionParam[];
/**
* Gets the company integration record for the specified company and LMS
*/
protected getCompanyIntegration(companyId: string, contextUser: UserInfo): Promise<CompanyIntegrationEntity>;
/**
* Gets credentials from environment variables
* Format: BIZAPPS_{PROVIDER}_{COMPANY_ID}_{CREDENTIAL_TYPE}
* Example: BIZAPPS_LEARNWORLDS_12345_API_KEY
*/
protected getCredentialFromEnv(companyId: string, credentialType: string): string | undefined;
/**
* Gets API credentials - first tries environment variables, then falls back to database
*/
protected getAPICredentials(integration: CompanyIntegrationEntity): Promise<{
apiKey?: string;
apiSecret?: string;
accessToken?: string;
}>;
/**
* Gets the base URL for API calls
*/
protected getAPIBaseURL(integration: CompanyIntegrationEntity): Promise<string>;
/**
* Helper to get parameter value with type safety
*/
protected getParamValue(params: ActionParam[], paramName: string): any;
/**
* Standard date format for LMS systems (ISO 8601)
*/
protected formatLMSDate(date: Date): string;
/**
* Parse date from LMS format
*/
protected parseLMSDate(dateString: string): Date;
/**
* Calculate progress percentage
*/
protected calculateProgressPercentage(completed: number, total: number): number;
/**
* Format duration in seconds to human readable format
*/
protected formatDuration(seconds: number): string;
/**
* Helper to build consistent error messages for LMS operations
*/
protected buildLMSErrorMessage(operation: string, details: string, systemError?: any): string;
/**
* Common enrollment status mapping
*/
protected mapEnrollmentStatus(status: string): 'active' | 'completed' | 'expired' | 'suspended' | 'unknown';
}
//# sourceMappingURL=base-lms.action.d.ts.map