import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api'; import { LoggerService } from '@backstage/backend-plugin-api'; import { UserTransformer, GroupTransformer, OrganizationTransformer, ProviderConfigTransformer, MicrosoftGraphClient, MicrosoftGraphProviderConfig } from '@backstage/plugin-catalog-backend-module-msgraph'; import { Config } from '@backstage/config'; import { IncrementalEntityProvider, EntityIteratorResult } from '@backstage/plugin-catalog-backend-module-incremental-ingestion'; /** * Interface for * {@link microsoftGraphIncrementalEntityProviderTransformExtensionPoint}. * * @public */ interface MicrosoftGraphIncrementalEntityProviderTransformsExtensionPoint { /** * Set the function that transforms a user entry in msgraph to an entity. * Optionally, you can pass separate transformers per provider ID. */ setUserTransformer(transformer: UserTransformer | Record): void; /** * Set the function that transforms a group entry in msgraph to an entity. * Optionally, you can pass separate transformers per provider ID. */ setGroupTransformer(transformer: GroupTransformer | Record): void; /** * Set the function that transforms an organization entry in msgraph to an * entity. Optionally, you can pass separate transformers per provider ID. */ setOrganizationTransformer(transformer: OrganizationTransformer | Record): void; /** * Set the function that transforms provider config dynamically. * Optionally, you can pass separate transformers per provider ID. */ setProviderConfigTransformer(transformer: ProviderConfigTransformer | Record): void; } /** * Extension point used to customize the transforms applied by the incremental * module. * * @public */ declare const microsoftGraphIncrementalEntityProviderTransformExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint; /** * Registers {@link MicrosoftGraphIncrementalEntityProvider} instances with the * catalog's incremental ingestion extension point. * * This module requires `catalogModuleIncrementalIngestionEntityProvider` to * also be installed in the backend. * * @example * ```ts * // packages/backend/src/index.ts * backend.add(import('@backstage/plugin-catalog-backend-module-incremental-ingestion')); * backend.add(import('@backstage/plugin-catalog-backend-module-msgraph-incremental')); * ``` * * @public */ declare const catalogModuleMicrosoftGraphIncrementalEntityProvider: _backstage_backend_plugin_api.BackendFeature; /** * Pagination cursor used by {@link MicrosoftGraphIncrementalEntityProvider}. * * The `nextLink` field holds the `@odata.nextLink` URL returned by the * Microsoft Graph API, which encodes all state needed to resume a paged * request. An absent value means the current phase is starting fresh. * * @public */ type MSGraphCursor = { phase: 'users' | 'groups'; nextLink?: string; }; /** * Context passed to each burst of {@link MicrosoftGraphIncrementalEntityProvider}. * * @public */ type MSGraphContext = { client: MicrosoftGraphClient; provider: MicrosoftGraphProviderConfig; }; /** * Options for {@link MicrosoftGraphIncrementalEntityProvider}. * * @public */ interface MicrosoftGraphIncrementalEntityProviderOptions { /** * The logger to use. */ logger: LoggerService; /** * The function that transforms a user entry in msgraph to an entity. * Optionally, you can pass separate transformers per provider ID. */ userTransformer?: UserTransformer | Record; /** * The function that transforms a group entry in msgraph to an entity. * Optionally, you can pass separate transformers per provider ID. */ groupTransformer?: GroupTransformer | Record; /** * The function that transforms an organization entry in msgraph to an entity. * Optionally, you can pass separate transformers per provider ID. */ organizationTransformer?: OrganizationTransformer | Record; /** * The function that transforms provider config dynamically before each sync. * Optionally, you can pass separate transformers per provider ID. */ providerConfigTransformer?: ProviderConfigTransformer | Record; } /** * Incrementally reads user and group entries out of Microsoft Graph, one page * at a time, and provides them as User and Group entities for the catalog. * * Unlike `MicrosoftGraphOrgEntityProvider`, this provider never holds the full * dataset in memory at once. Each burst processes a single page (up to 999 * users or 100 groups). This makes it suitable for very large tenants and * avoids the memory pressure and long-running task issues of the full-scan * provider. * * The Microsoft Graph `@odata.nextLink` URL is stored as the cursor, so a pod * restart during ingestion resumes from the last completed page. * * Group membership (`spec.members`) is resolved inline during the groups phase * by fetching the direct members of each group. The catalog's built-in relation * stitching derives `spec.memberOf` on users from these group membership lists. * * @remarks * `userGroupMemberFilter`, `userGroupMemberSearch`, `userGroupMemberPath`, and * `groupIncludeSubGroups` are not supported. Use `userFilter` / `userPath` to * restrict which users are ingested, and `groupFilter` / `groupSearch` to * restrict which groups. Switch to `MicrosoftGraphOrgEntityProvider` if you * require any of these options. * * @public */ declare class MicrosoftGraphIncrementalEntityProvider implements IncrementalEntityProvider { /** * Create one provider instance per provider entry in * `catalog.providers.microsoftGraphOrg`. */ static fromConfig(configRoot: Config, options: MicrosoftGraphIncrementalEntityProviderOptions): MicrosoftGraphIncrementalEntityProvider[]; private readonly options; constructor(options: { id: string; provider: MicrosoftGraphProviderConfig; logger: LoggerService; userTransformer?: UserTransformer; groupTransformer?: GroupTransformer; organizationTransformer?: OrganizationTransformer; providerConfigTransformer?: ProviderConfigTransformer; }); /** {@inheritdoc @backstage/plugin-catalog-backend-module-incremental-ingestion#IncrementalEntityProvider.getProviderName} */ getProviderName(): string; /** * Sets up the Microsoft Graph client for the duration of a full ingestion * cycle. The optional `providerConfigTransformer` is applied here so that * dynamic config changes (e.g., rotating credentials) take effect at the * start of each cycle rather than mid-way through. */ around(burst: (context: MSGraphContext) => Promise): Promise; /** {@inheritdoc @backstage/plugin-catalog-backend-module-incremental-ingestion#IncrementalEntityProvider.next} */ next({ client, provider }: MSGraphContext, cursor?: MSGraphCursor): Promise>; private readUsersPage; private readGroupsPage; } export { MicrosoftGraphIncrementalEntityProvider, catalogModuleMicrosoftGraphIncrementalEntityProvider, catalogModuleMicrosoftGraphIncrementalEntityProvider as default, microsoftGraphIncrementalEntityProviderTransformExtensionPoint }; export type { MSGraphContext, MSGraphCursor, MicrosoftGraphIncrementalEntityProviderOptions, MicrosoftGraphIncrementalEntityProviderTransformsExtensionPoint };