mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-12 12:51:59 +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
@@ -15,6 +15,21 @@ export function convertId(id: string): string {
|
||||
return `GENERATE_ID::${id}`;
|
||||
}
|
||||
|
||||
export function createSourceKeys() {
|
||||
const keys: Record<string, string> = {};
|
||||
return {
|
||||
/** Convert a resource's own document ID, keeping it as that resource's source key. */
|
||||
own(id: string): string {
|
||||
const converted = convertId(id);
|
||||
keys[converted] = id;
|
||||
return converted;
|
||||
},
|
||||
all: (): Record<string, string> => keys,
|
||||
};
|
||||
}
|
||||
|
||||
export type SourceKeys = ReturnType<typeof createSourceKeys>;
|
||||
|
||||
export function importHttpBodyAndHeaders(obj: any) {
|
||||
const { headers } = importHeaders(obj);
|
||||
const { body, bodyType } = importHttpBody(obj.body);
|
||||
|
||||
Reference in New Issue
Block a user