mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-01 08:07:34 +02:00
Re-importing an edited document currently has no way to tell an updated request from a new one, because every import mints fresh model IDs. Give each imported resource a key that identifies its source element instead, so a later import can match against what it already created. `ImportResponse` gains an optional `sourceKeys` map, keyed by the resource IDs plugins already emit. A parallel map keeps `ImportResources` and the partial TS types unchanged. Bundled importers emit keys where the format carries them: Postman item IDs, Insomnia `_id`s, OpenAPI `operationId` (falling back to the route), and Yaak model IDs. curl has no identity of its own, so it emits none. Planning derives a key for anything left over, hashed from the model type, folder ancestry, and name or method+URL, prefixed `fb:` so later code can tell derived keys from importer-provided ones. These break when the source document renames or moves a resource, which is accepted. Keys land in `ImportPlan.source_keys`, keyed by minted model ID so the mapping stays lossless, ready for the commit step to persist. Nothing consumes them yet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
108 lines
2.5 KiB
JSON
108 lines
2.5 KiB
JSON
{
|
||
"resources": {
|
||
"workspaces": [
|
||
{
|
||
"model": "workspace",
|
||
"id": "GENERATE_ID::WORKSPACE_2",
|
||
"name": "New Collection",
|
||
"authenticationType": "basic",
|
||
"authentication": {
|
||
"username": "globaluser",
|
||
"password": "globalpass"
|
||
}
|
||
}
|
||
],
|
||
"environments": [
|
||
{
|
||
"model": "environment",
|
||
"id": "GENERATE_ID::ENVIRONMENT_2",
|
||
"name": "Global Variables",
|
||
"workspaceId": "GENERATE_ID::WORKSPACE_2",
|
||
"parentModel": "workspace",
|
||
"parentId": null,
|
||
"variables": [
|
||
{
|
||
"name": "COLLECTION VARIABLE",
|
||
"value": "collection variable"
|
||
}
|
||
]
|
||
}
|
||
],
|
||
"httpRequests": [
|
||
{
|
||
"model": "http_request",
|
||
"id": "GENERATE_ID::HTTP_REQUEST_13",
|
||
"workspaceId": "GENERATE_ID::WORKSPACE_2",
|
||
"folderId": null,
|
||
"name": "Form URL",
|
||
"method": "POST",
|
||
"url": "example.com/:foo/:bar",
|
||
"urlParameters": [
|
||
{
|
||
"name": "disabled",
|
||
"value": "secondvalue",
|
||
"enabled": false
|
||
},
|
||
{
|
||
"name": "q",
|
||
"value": "qqq",
|
||
"enabled": true
|
||
},
|
||
{
|
||
"name": "",
|
||
"value": "",
|
||
"enabled": true
|
||
},
|
||
{
|
||
"name": ":foo",
|
||
"value": "fff",
|
||
"enabled": true
|
||
},
|
||
{
|
||
"name": ":bar",
|
||
"value": "bbb",
|
||
"enabled": true
|
||
}
|
||
],
|
||
"body": {
|
||
"form": [
|
||
{
|
||
"enabled": true,
|
||
"contentType": "Custom/COntent",
|
||
"name": "Key",
|
||
"file": "/Users/gschier/Desktop/Screenshot 2024-05-31 at 12.05.11 PM.png"
|
||
}
|
||
]
|
||
},
|
||
"bodyType": "multipart/form-data",
|
||
"sortPriority": 0,
|
||
"headers": [
|
||
{
|
||
"name": "X-foo",
|
||
"value": "bar",
|
||
"enabled": true
|
||
},
|
||
{
|
||
"name": "Disabled",
|
||
"value": "tnroant",
|
||
"enabled": false
|
||
},
|
||
{
|
||
"name": "Content-Type",
|
||
"value": "multipart/form-data",
|
||
"enabled": true
|
||
}
|
||
],
|
||
"authenticationType": "bearer",
|
||
"authentication": {
|
||
"token": "my-token"
|
||
}
|
||
}
|
||
],
|
||
"folders": []
|
||
},
|
||
"sourceKeys": {
|
||
"GENERATE_ID::WORKSPACE_2": "collection:9e6dfada-256c-49ea-a38f-7d1b05b7ca2d"
|
||
}
|
||
}
|