Functions
This documentation covers the utility and factory functions used in the ROAR Firebase Functions backend architecture. These functions provide key functionality for service creation, data manipulation, and system initialization.
Service Creation Functions
createAdministrationService
Creates an administration service instance with repositories for managing administrative operations.
const adminService = createAdministrationService({
administrationRepository,
orgRepository,
userClaimRepository
});
createIdentityProviderService
Creates an identity provider service for handling SSO and user identity management.
const idpService = createIdentityProviderService({
identityProviderRepository,
userClaimRepository,
userRepository
});
createFirestoreImplementation
Factory function that initializes all Firestore repositories and services.
const {
administrationRepository,
identityProviderRepository,
userRepository,
// ... other repositories and services
} = createFirestoreImplementation();
Utility Functions
chunkOrgs
Splits organization lists into smaller chunks for processing.
const orgsList = {
readOrgs: ['org1', 'org2', 'org3', 'org4'],
assignedOrgs: ['org5', 'org6', 'org7', 'org8']
};
const chunkedOrgs = chunkOrgs(orgsList, 2);
// Results in smaller chunks of size 2
isEmptyOrgs
Checks if an organization list is empty.
const orgsList = {
readOrgs: [],
assignedOrgs: []
};
const isEmpty = isEmptyOrgs(orgsList); // returns true
Usage Patterns
These functions are typically used in the following ways:
Service Creation
- Used during application initialization
- Creates service instances with required dependencies
- Provides type-safe service implementations
Data Processing
- Utility functions for handling organization data
- Manages data chunks for batch processing
- Validates data structures
System Setup
- Initializes Firestore implementation
- Sets up repositories and services
- Configures system dependencies
For more details on each function, click the links above to view the individual documentation pages.