/** * `qfg migrate --from flagsmith` — the MigrationSource implementation. * * Wires the Flagsmith fetcher (`flagsmith/api.ts` + `flagsmith/types.ts`) and * converter (`flagsmith/translate.ts`) into the source-agnostic migration * framework. Epic 1 implemented the read side (validateAuth, listEnvironments, * fetchChanges yielding LegacyChange[] carrying raw Flagsmith JSON); Epic 3 * adds the translate() side — `translateFeature` and `translateSegment` * dispatched by `raw.kind` (see `FlagsmithRaw` below). Report accumulators * (`getSkippedConfigs`, `getCoercedSentinels`, `getConversionNotes`) thread * the per-source notes into MIGRATION_REPORT.md. * * Design is frozen in `project/plans/migrator-flagsmith.md`. Notable choices * for this epic — the contract Epic 3 will consume: * * - `LegacyChange.raw` is a discriminated union over `{kind: 'feature' | 'segment'}`. * Features carry the full per-feature stitched bundle (env-default + * segment-overrides + identity-overrides + feature-segment priority + * inline MV options sorted by id asc). Segments are emitted separately * (project-scoped, referenced from multiple features). * * - Tags are NOT separate LegacyChanges — they're inline `feature.tags[]` as * integer IDs, plus a project-wide tag pool stashed in the source state for * the converter to resolve id → label. * * - Edge identities are NOT separate LegacyChanges. Identity overrides are * bundled inside the feature payload (`identity_overrides`); the identity * `identifier` is already on each override row. Traits are runtime context * the SDK sends — no server-side artifact to migrate (plan §5.5, D-F6). * * - Project metadata (`use_edge_identities`, `only_allow_lower_case_feature_names`, * …) is captured during `validateAuth` and stashed in source state. The * converter can read it via `getProjectMetadata()` (a Flagsmith-specific * getter, not part of the MigrationSource interface). */ import { ConversionReport } from '../quonfig-target/report.js'; import { type MigrationSource } from '../source.js'; import type { FlagsmithFeatureWithStates, FlagsmithProject, FlagsmithSegment, FlagsmithTag } from './flagsmith/types.js'; /** * Raw payload carried on each LegacyChange — discriminated by `kind`. Epic 3's * `translate()` switches on this to dispatch to the right shape converter. */ export type FlagsmithRaw = { data: FlagsmithFeatureWithStates; kind: 'feature'; } | { data: FlagsmithSegment; kind: 'segment'; }; /** * Override the Flagsmith project ID for this run. Called by `qfg migrate` from * its `--project` flag (or the `FLAGSMITH_PROJECT_ID` env var) — mirrors * `setLaunchDarklyProjectKey`. Flagsmith projects are numeric, but we accept * either a number or a numeric-string and convert at the API boundary. */ export declare function setFlagsmithProjectId(projectId: number | string): void; /** The project metadata captured by validateAuth, or null if we haven't authed yet. */ export declare function getFlagsmithProject(): FlagsmithProject | null; /** The tag pool from the last snapshot — Epic 3's converter resolves `feature.tags[]` IDs to labels via this. */ export declare function getFlagsmithTagPool(): FlagsmithTag[]; /** The full conversion report — every skip/drop/coerce note from this run. */ export declare function getConversionReport(): ConversionReport; export declare const flagsmithSource: MigrationSource; export declare function __resetFlagsmithSourceForTests(): void;