mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-09 19:31:57 +02:00
Yaak now remembers, per item of a linked import source, whether the user wants it. A mapping row that still points at a model means wanted, so re-imports merge into it; a row with no model behind it means not wanted, so re-imports leave it alone. Wanted-ness is structural rather than a flag: deleting the model locally, or turning the item down in the preview, is what makes it not wanted. - import_source_resources drops `snapshot` for a nullable `content_hash` and lets `model_id` be NULL. The migration keeps every beta row's key to model mapping and starts hashes empty; until a hash is recorded, a difference can't be attributed to either side, so the item is offered once as a conflict that keeps local changes. - comparable() ignores sortPriority. Importers number it from source order, so inserting one operation used to plan a fake update for everything after it. The trade is that pure reorders don't propagate. - Keys the user turned down come back as unchecked "not imported" rows instead of being re-offered as new resources or resurrected. Checking one imports it under the same source key and pulls in the folders it needs. - An imported resource the source moves into a folder that isn't imported is offered as a deletion, with a tooltip pointing at the folder. - Plan-time source resolution binds by source-key overlap instead of by path, so a renamed or moved file merges into what it created and heals the stored origin. Several sources sharing keys never guess-merge: the plan says so and imports everything as new. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
99 lines
2.4 KiB
TypeScript
Generated
99 lines
2.4 KiB
TypeScript
Generated
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
import type {
|
|
Environment,
|
|
Folder,
|
|
GrpcRequest,
|
|
HttpRequest,
|
|
WebsocketRequest,
|
|
Workspace,
|
|
} from "./gen_models";
|
|
|
|
export type BatchUpsertResult = {
|
|
workspaces: Array<Workspace>;
|
|
environments: Array<Environment>;
|
|
folders: Array<Folder>;
|
|
httpRequests: Array<HttpRequest>;
|
|
grpcRequests: Array<GrpcRequest>;
|
|
websocketRequests: Array<WebsocketRequest>;
|
|
};
|
|
|
|
export type ImportConflictResolution = "keep_mine" | "take_source";
|
|
|
|
/**
|
|
* Where a staged import will be committed.
|
|
*
|
|
* The destination workspace and optional folder IDs are captured in the plan so the preview describes
|
|
* the exact destination that confirmation will use.
|
|
*/
|
|
export type ImportDestination =
|
|
| { type: "new_workspace" }
|
|
| { type: "existing_workspace"; workspaceId: string; folderId?: string };
|
|
|
|
/**
|
|
* Where an import's contents came from, used to link the committed workspace back to it.
|
|
*/
|
|
export type ImportOrigin = {
|
|
/**
|
|
* The absolute file path or URL the contents were read from.
|
|
*/
|
|
origin: string;
|
|
label: string;
|
|
};
|
|
|
|
export type ImportPlan = {
|
|
importer: string;
|
|
destination: ImportDestination;
|
|
resources: BatchUpsertResult;
|
|
warnings: Array<ImportPlanWarning>;
|
|
/**
|
|
* Stable source key for every model in `resources`, keyed by its planned ID.
|
|
*/
|
|
sourceKeys: { [key in string]?: string };
|
|
/**
|
|
* One entry per plannable resource; commit applies only the selected ones.
|
|
*/
|
|
items: Array<ImportPlanItem>;
|
|
origin?: ImportOrigin;
|
|
};
|
|
|
|
export type ImportPlanAction =
|
|
| "create"
|
|
| "update"
|
|
| "delete"
|
|
| "unchanged"
|
|
| "keep_local"
|
|
| "conflict"
|
|
| "not_imported";
|
|
|
|
export type ImportPlanItem = {
|
|
action: ImportPlanAction;
|
|
model: ImportResourceType;
|
|
modelId: string;
|
|
name: string;
|
|
/**
|
|
* Planned parent folder ID for incoming resources; current parent for deletions.
|
|
*/
|
|
parentId?: string;
|
|
selected: boolean;
|
|
resolution?: ImportConflictResolution;
|
|
reason?: ImportPlanReason;
|
|
};
|
|
|
|
/**
|
|
* Extra context for an action that would otherwise be indistinguishable from its plain form.
|
|
*/
|
|
export type ImportPlanReason = "moved_into_not_imported_folder";
|
|
|
|
export type ImportPlanWarning = { title: string; detail: string };
|
|
|
|
/**
|
|
* The model types an import plan can contain.
|
|
*/
|
|
export type ImportResourceType =
|
|
| "environment"
|
|
| "folder"
|
|
| "grpc_request"
|
|
| "http_request"
|
|
| "websocket_request"
|
|
| "workspace";
|