mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-09 19:31:57 +02:00
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:
co-authored by
Claude Opus 5
parent
e63a87718c
commit
81a2a5d955
+12
-1
@@ -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, };
|
||||
|
||||
|
||||
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user