import type { PickerPropsStore } from '../picker-props-store'; import type { IdasResyncStoreApi } from './createIdasResyncStore'; type ControllerUser = PickerPropsStore['currentUser']; export type IdasResyncControllerInputs = { assetId: number | null; currentUser: ControllerUser; loadExternalOffsets: () => Promise; }; export type IdasResyncController = { activate: () => void; deactivate: () => void; update: (inputs: IdasResyncControllerInputs) => void; }; /** * Drives the IDAS re-sync state machine for a subject asset and writes its * state into `IdasResyncStore`. Consumers (e.g. `HeaderActions`, * `PickerModalActions`, `OffsetWellPickerV5`) subscribe via * `useIdasResyncStore` instead of having props drilled through the tree. * * Flow: subscribe → POST task → resolve via subscription event * ({ status, message }). The task-app response is used only for dual-track * failure detection (state === 'failed'); the underlying app's outcome is * carried by the subscription message. * * The socket is wired manually via `subscribeToIdasResync` rather than * `useSubscriptionsV2` because we want no historical fetch and explicit * single-shot teardown. See `subscribeToIdasResync.ts` for the rationale. * * We do NOT gate the POST on a socket ack: the upstream `_emit` * mis-routes the ack callback so it would never fire. The theoretical * race window (local listener attached but channel not yet registered * server-side) is dwarfed by worker latency. * * KNOWN LIMITATION: the subscription payload has no correlation/request id, * so a delayed event from a previous same-asset run — or another user's * same-asset run — could resolve the current run with the wrong outcome. * Tracked separately; backend needs to attach a request_id to the payload. * * Construction is side-effect-free. `activate()` installs `triggerResync` * into the store and arms the controller; `deactivate()` aborts any in-flight * resync and resets the store's `triggerResync` back to a noop. The pair is * idempotent so it survives React 18 StrictMode setup→cleanup→setup replay. */ export declare const createIdasResyncController: (storeApi: IdasResyncStoreApi) => IdasResyncController; export {}; //# sourceMappingURL=createIdasResyncController.d.ts.map