MCPcopy
hub / github.com/CaviraOSS/OpenMemory / pm

Method pm

migrate/imp.js:42–65  ·  view source on GitHub ↗
(d)

Source from the content-addressed store, hash-verified

40 return { m: mc, f: fc, d: dur };
41 }
42 async pm(d) {
43 const payload = {
44 content: d.c,
45 tags: d.t || [],
46 metadata: {
47 ...d.meta,
48 migrated: true,
49 orig_id: d.id,
50 orig_created_at: d.ca,
51 orig_last_seen: d.ls,
52 },
53 };
54 if (d.uid && d.uid !== 'default') payload.user_id = d.uid;
55 const r = await fetch(`${this.u}/memory/add`, {
56 method: 'POST',
57 headers: this.h,
58 body: JSON.stringify(payload),
59 });
60 if (!r.ok) {
61 const txt = await r.text().catch(() => 'No response');
62 throw new Error(`API ${r.status}: ${txt}`);
63 }
64 return await r.json();
65 }
66}
67module.exports = I;

Callers 1

impMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected