feat(import): add stable per-resource source keys to the importer contract (#614)

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Gregory Schier
2026-09-01 08:11:54 -07:00
committed by GitHub
co-authored by Claude Opus 5
parent e63a87718c
commit 81a2a5d955
28 changed files with 785 additions and 49 deletions
+12 -1
View File
@@ -474,7 +474,18 @@ export type ImportRequest = { content: string, };
export type ImportResources = { workspaces: Array<Workspace>, environments: Array<Environment>, folders: Array<Folder>, httpRequests: Array<HttpRequest>, grpcRequests: Array<GrpcRequest>, websocketRequests: Array<WebsocketRequest>, };
export type ImportResponse = { importer: string, resources: ImportResources, };
export type ImportResponse = {
/**
* Display name of the importer that recognized the input.
*/
importer: string, resources: ImportResources,
/**
* Identifies the same source element across re-parses, keyed by the IDs in `resources`.
*
* Must come from the document, never from anything the user can rename in Yaak. Only set
* for formats that carry their own identifiers; the host derives the rest.
*/
sourceKeys?: { [key in string]?: string }, };
export type InternalEvent = { id: string, pluginRefId: string, pluginName: string, replyId: string | null, context: PluginContext, payload: InternalEventPayload, };
+8 -1
View File
@@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::collections::{BTreeMap, HashMap};
use ts_rs::TS;
use yaak_models::models::{
AnyModel, Environment, Folder, GrpcRequest, HttpRequest, HttpResponse, WebsocketRequest,
@@ -250,6 +250,13 @@ pub struct ImportResponse {
/// Display name of the importer that recognized the input.
pub importer: String,
pub resources: ImportResources,
/// Identifies the same source element across re-parses, keyed by the IDs in `resources`.
///
/// Must come from the document, never from anything the user can rename in Yaak. Only set
/// for formats that carry their own identifiers; the host derives the rest.
#[ts(optional)]
pub source_keys: Option<BTreeMap<String, String>>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, TS)]