|
| 1 | +import type { |
| 2 | + LocalConceptDataInput, |
| 3 | + LocalContentDataInput, |
| 4 | +} from "../inputTypes"; |
| 5 | +import { |
| 6 | + FULL_CONTENT_FORMAT, |
| 7 | + type CrossAppNode, |
| 8 | +} from "../crossAppNodeContract"; |
| 9 | +import { spaceUriAndLocalIdToRid } from "../lib/rid"; |
| 10 | + |
| 11 | +/** |
| 12 | + * Reference fixtures for the cross-app node content contract (ENG-1847). |
| 13 | + * |
| 14 | + * Each fixture pairs the contract-level `CrossAppNode` with the existing |
| 15 | + * `LocalConceptDataInput` + `LocalContentDataInput[]` it persists as — showing |
| 16 | + * downstream Roam/Obsidian tickets exactly how the contract maps onto |
| 17 | + * `upsert_concepts` / `upsert_content` without redefining the payload. The |
| 18 | + * fixtures use the `space_url` / `author_local_id` string keys so they stay |
| 19 | + * portable; the live source apps pass their resolved numeric `space_id` / |
| 20 | + * `author_id` from `SupabaseContext` instead. |
| 21 | + */ |
| 22 | +export type CrossAppNodeFixture = { |
| 23 | + node: CrossAppNode; |
| 24 | + concept: LocalConceptDataInput; |
| 25 | + contents: LocalContentDataInput[]; |
| 26 | +}; |
| 27 | + |
| 28 | +// --- Roam-origin node: a Claim shared from a Roam graph --------------------- |
| 29 | + |
| 30 | +const ROAM_SPACE_URL = "https://roamresearch.com/#/app/MAPLab"; |
| 31 | +const ROAM_NODE_ID = "tgWb6JozF"; // a Roam block/page uid |
| 32 | +const ROAM_CLAIM_SCHEMA_ID = "rCLM0schema"; // source_local_id of the Claim schema Concept |
| 33 | +const ROAM_NODE_RID = spaceUriAndLocalIdToRid(ROAM_SPACE_URL, ROAM_NODE_ID); |
| 34 | + |
| 35 | +const roamFullMarkdown = `# Sleep improves memory consolidation |
| 36 | +
|
| 37 | +Multiple studies show that sleep after learning strengthens memory traces. |
| 38 | +
|
| 39 | +- Supported by [[EVD]] - Rasch & Born 2013 |
| 40 | +`; |
| 41 | + |
| 42 | +export const roamOriginNode: CrossAppNodeFixture = { |
| 43 | + node: { |
| 44 | + sourceApp: "Roam", |
| 45 | + sourceSpace: { url: ROAM_SPACE_URL, name: "MAPLab" }, |
| 46 | + sourceLocalId: ROAM_NODE_ID, |
| 47 | + rid: ROAM_NODE_RID, |
| 48 | + nodeType: { sourceLocalId: ROAM_CLAIM_SCHEMA_ID, label: "Claim" }, |
| 49 | + content: { |
| 50 | + direct: { value: "Sleep improves memory consolidation" }, |
| 51 | + full: { format: FULL_CONTENT_FORMAT, value: roamFullMarkdown }, |
| 52 | + }, |
| 53 | + sourceModifiedAt: "2026-06-12T14:00:00.000Z", |
| 54 | + }, |
| 55 | + concept: { |
| 56 | + space_url: ROAM_SPACE_URL, |
| 57 | + name: "Sleep improves memory consolidation", |
| 58 | + source_local_id: ROAM_NODE_ID, |
| 59 | + schema_represented_by_local_id: ROAM_CLAIM_SCHEMA_ID, |
| 60 | + is_schema: false, |
| 61 | + author_local_id: "roam-account-uid", |
| 62 | + created: "2026-06-10T09:00:00.000Z", |
| 63 | + last_modified: "2026-06-12T14:00:00.000Z", |
| 64 | + }, |
| 65 | + contents: [ |
| 66 | + { |
| 67 | + space_url: ROAM_SPACE_URL, |
| 68 | + source_local_id: ROAM_NODE_ID, |
| 69 | + variant: "direct", |
| 70 | + scale: "document", |
| 71 | + text: "Sleep improves memory consolidation", |
| 72 | + author_local_id: "roam-account-uid", |
| 73 | + created: "2026-06-10T09:00:00.000Z", |
| 74 | + last_modified: "2026-06-12T14:00:00.000Z", |
| 75 | + }, |
| 76 | + { |
| 77 | + space_url: ROAM_SPACE_URL, |
| 78 | + source_local_id: ROAM_NODE_ID, |
| 79 | + variant: "full", |
| 80 | + scale: "document", |
| 81 | + text: roamFullMarkdown, |
| 82 | + author_local_id: "roam-account-uid", |
| 83 | + created: "2026-06-10T09:00:00.000Z", |
| 84 | + last_modified: "2026-06-12T14:00:00.000Z", |
| 85 | + }, |
| 86 | + ], |
| 87 | +}; |
| 88 | + |
| 89 | +// --- Obsidian-origin node: an Evidence note shared from an Obsidian vault ---- |
| 90 | + |
| 91 | +const OBSIDIAN_VAULT_ID = "9a8b7c6d5e4f3210"; // app.appId |
| 92 | +const OBSIDIAN_SPACE_URL = `obsidian:${OBSIDIAN_VAULT_ID}`; |
| 93 | +const OBSIDIAN_NODE_ID = "0192f1a0-7b3c-7e2a-9f10-1a2b3c4d5e6f"; // uuidv7 nodeInstanceId |
| 94 | +const OBSIDIAN_EVD_SCHEMA_ID = "evd-7c1f9a2b"; // nodeTypeId |
| 95 | +const OBSIDIAN_FILE_PATH = "Discourse Nodes/EVD - REM sleep and recall.md"; |
| 96 | +const OBSIDIAN_TITLE = "EVD - REM sleep and recall"; // file basename |
| 97 | +const OBSIDIAN_NODE_RID = spaceUriAndLocalIdToRid( |
| 98 | + OBSIDIAN_SPACE_URL, |
| 99 | + OBSIDIAN_NODE_ID, |
| 100 | + "note", |
| 101 | +); |
| 102 | + |
| 103 | +// Obsidian's `full` variant is the entire file as read from the vault, which |
| 104 | +// includes the YAML frontmatter — a known markdown-fidelity wrinkle the |
| 105 | +// destination materialization (ENG-1858 / ENG-1872) must handle. |
| 106 | +const obsidianFullMarkdown = `--- |
| 107 | +nodeTypeId: ${OBSIDIAN_EVD_SCHEMA_ID} |
| 108 | +nodeInstanceId: ${OBSIDIAN_NODE_ID} |
| 109 | +--- |
| 110 | +
|
| 111 | +# REM sleep correlates with recall |
| 112 | +
|
| 113 | +Participants with more REM sleep showed better next-day recall. |
| 114 | +`; |
| 115 | + |
| 116 | +export const obsidianOriginNode: CrossAppNodeFixture = { |
| 117 | + node: { |
| 118 | + sourceApp: "Obsidian", |
| 119 | + sourceSpace: { url: OBSIDIAN_SPACE_URL, name: "Research Vault" }, |
| 120 | + sourceLocalId: OBSIDIAN_NODE_ID, |
| 121 | + rid: OBSIDIAN_NODE_RID, |
| 122 | + nodeType: { sourceLocalId: OBSIDIAN_EVD_SCHEMA_ID, label: "Evidence" }, |
| 123 | + content: { |
| 124 | + direct: { value: OBSIDIAN_TITLE }, |
| 125 | + full: { format: FULL_CONTENT_FORMAT, value: obsidianFullMarkdown }, |
| 126 | + }, |
| 127 | + sourceModifiedAt: "2026-06-14T10:30:00.000Z", |
| 128 | + }, |
| 129 | + concept: { |
| 130 | + space_url: OBSIDIAN_SPACE_URL, |
| 131 | + name: OBSIDIAN_FILE_PATH, // Obsidian uses the file path as the Concept name |
| 132 | + source_local_id: OBSIDIAN_NODE_ID, |
| 133 | + schema_represented_by_local_id: OBSIDIAN_EVD_SCHEMA_ID, |
| 134 | + is_schema: false, |
| 135 | + author_local_id: "obsidian-account-uid", |
| 136 | + created: "2026-06-13T08:00:00.000Z", |
| 137 | + last_modified: "2026-06-14T10:30:00.000Z", |
| 138 | + literal_content: { label: OBSIDIAN_TITLE }, |
| 139 | + }, |
| 140 | + contents: [ |
| 141 | + { |
| 142 | + space_url: OBSIDIAN_SPACE_URL, |
| 143 | + source_local_id: OBSIDIAN_NODE_ID, |
| 144 | + variant: "direct", |
| 145 | + scale: "document", |
| 146 | + text: OBSIDIAN_TITLE, |
| 147 | + author_local_id: "obsidian-account-uid", |
| 148 | + created: "2026-06-13T08:00:00.000Z", |
| 149 | + last_modified: "2026-06-14T10:30:00.000Z", |
| 150 | + metadata: { filePath: OBSIDIAN_FILE_PATH }, |
| 151 | + }, |
| 152 | + { |
| 153 | + space_url: OBSIDIAN_SPACE_URL, |
| 154 | + source_local_id: OBSIDIAN_NODE_ID, |
| 155 | + variant: "full", |
| 156 | + scale: "document", |
| 157 | + text: obsidianFullMarkdown, |
| 158 | + author_local_id: "obsidian-account-uid", |
| 159 | + created: "2026-06-13T08:00:00.000Z", |
| 160 | + last_modified: "2026-06-14T10:30:00.000Z", |
| 161 | + metadata: { filePath: OBSIDIAN_FILE_PATH }, |
| 162 | + }, |
| 163 | + ], |
| 164 | +}; |
0 commit comments