4.9 KiB
Providers
This project has evolved over several years, and during a major refactoring
to begin using ECMAScript properly, + await
, async
, and TypeScript, it
has grown.
The providers
was started during the "transition" to more modern practices by
providing a central place to ideally hang interfaces to useful services that
can be made available throughout the app to easily drop in new capabilities and
connect to services.
Ideally, a provider uses an interface, even if there is only a single implementation, to try and encourage some separation, enable testing, and plugging in other tech.
It is an implementation detail whether to "require" a provider be present, or thrown or ignore if it is null; feature flags or configuration can help.
The original providers cover very basic things:
app
: the Express app instancebasedir
: the base directory for the appconfig
: the configuration graph for the app. This is currently untyped.github
: the smart cache layer on top of OctokitlinkProvider
: create, delete, update links between third-party users and corporate usersoperations
: the main brain of the app allowing for strongly-typed trusted corporate GitHub operationsviewServices
: a few helpers for Pug templates to use such asmoment
Sources of truth:
repositoryMetadataProvider
: stores corporate metadata about who creates/configures a repoorganizationSettingsProvider
: stores configuration for GitHub organizations (if not using static config)userSettingsProvider
: stores user settings nearly completely unused, storing user state is badtokenProvider
: personal access token optional for API consumers
Supporting providers:
insights
: Application Insights mock for basic events and metrics, or just console output if not configuredkeyEncryptionKeyResolver
: supports retrieval and generation of encryption keys, only needed if using the legacy encrypted sessions or data stores (candidate for future removal)mailProvider
: supports sending an e-mailmailAddressProvider
: resolves e-mail addresses from corporate identities
Hosting, cache and database environment providers:
healthCheck
: web server health probespostgresPool
: provides access to a Postgres pool (this probably should not be so central and accessible to avoid coupling)sessionRedisClient
: Redis client for use in sessions, if using Redis for session statecacheProvider
: an abstracted cache - can use Redis or Cosmos DB and/or Azure storageredis
: deprecated a Redis helper connected to the main Redis instanceredisClient
: deprecated a primary Redis client instancesession
: access to session store
Fast indexes of key entities and memberships on GitHub:
queryCache
: the main query cache providerorganizationMemberCacheProvider
: entities: members of orgsrepositoryCacheProvider
: entities: cache of reposrepositoryCollaboratorCacheProvider
: entities: cache of repository collaborators this is key to performance over the GitHub APIteamCacheProvider
: entities: cache of teamsteamMemberCacheProvider
: entities: cache of team membersrepositoryTeamCacheProvider
: entities: cache of repo team permissions
Providers built on top of entity metadata provider:
approvalProvider
: team join request approvalsauditLogRecordProvider
: store org webhook events as a simple audit log recordeventRecordProvider
: contribution data on public GitHub (this provider needs a rename)
Related to processing near real-time (NRT) streams from Webhook events:
webhookQueueProcessor
: pulls messages from a queue
Other capabilities have included:
campaign
: a poorly-named provider to enable event records for campaigns, redirecting to entities (likely no longer in use)campaignStateProvider
: state related to mail campaigns and notices to allow for tracking sending at-most-once, plus opt-out capabilitiesgraphProvider
: essentially the Microsoft Graph: given a person, who is their manager? Their management chain?
Special providers that help this remain an open source project while building Microsoft-specific use cases:
applicationProfile
: allows for hosting a separate set of routes replacing the main appcorporateAdministrationProfile
: adds new sections and routes to the administration UIcorporateViews
: a set of additional views that can be included in Pug templatescorporateContactProvider
: a Microsoft-specific provider to retrieve information such as the open source attorney a given employee has, their business reviewer for open source, etc.
Special providers for gold plated features:
localExtensionKeyProvider
: generates special keys for use in local encryption for link dataelectionProvider
: supports FOSS Fund electionselectionVoteProvider
: supports FOSS Fund electionselectionNominationProvider
: supports FOSS Fund electionselectionNominationCommentProvider
: supports FOSS Fund elections