@shivaedev/work-board 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/README.md +27 -16
- package/assets/native.js +36 -0
- package/dist/board.d.ts +1 -1
- package/dist/board.d.ts.map +1 -1
- package/dist/board.js +38 -8
- package/dist/board.js.map +1 -1
- package/dist/browser/client.d.ts +88 -0
- package/dist/browser/client.d.ts.map +1 -0
- package/dist/browser/client.js +53 -0
- package/dist/browser/client.js.map +1 -0
- package/dist/browser/session.d.ts +89 -0
- package/dist/browser/session.d.ts.map +1 -0
- package/dist/browser/session.js +20 -0
- package/dist/browser/session.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/files/changes.d.ts +4 -1
- package/dist/files/changes.d.ts.map +1 -1
- package/dist/files/changes.js +7 -3
- package/dist/files/changes.js.map +1 -1
- package/dist/files/list.d.ts +1 -1
- package/dist/files/list.d.ts.map +1 -1
- package/dist/files/list.js +5 -3
- package/dist/files/list.js.map +1 -1
- package/dist/history/schema.js +1 -1
- package/dist/history/schema.js.map +1 -1
- package/dist/history/script.d.ts.map +1 -1
- package/dist/history/script.js +28 -13
- package/dist/history/script.js.map +1 -1
- package/dist/http/assets.d.ts +2 -0
- package/dist/http/assets.d.ts.map +1 -1
- package/dist/http/assets.js +10 -0
- package/dist/http/assets.js.map +1 -1
- package/dist/http/history.d.ts.map +1 -1
- package/dist/http/history.js +1 -13
- package/dist/http/history.js.map +1 -1
- package/dist/http/sameOrigin.d.ts +3 -0
- package/dist/http/sameOrigin.d.ts.map +1 -0
- package/dist/http/sameOrigin.js +14 -0
- package/dist/http/sameOrigin.js.map +1 -0
- package/dist/page/ageScript.d.ts +2 -0
- package/dist/page/ageScript.d.ts.map +1 -0
- package/dist/page/ageScript.js +23 -0
- package/dist/page/ageScript.js.map +1 -0
- package/dist/page/client.d.ts +1 -1
- package/dist/page/client.d.ts.map +1 -1
- package/dist/page/client.js +73 -74
- package/dist/page/client.js.map +1 -1
- package/dist/page/navigationScript.d.ts.map +1 -1
- package/dist/page/navigationScript.js +7 -5
- package/dist/page/navigationScript.js.map +1 -1
- package/dist/page/searchScript.d.ts.map +1 -1
- package/dist/page/searchScript.js +6 -4
- package/dist/page/searchScript.js.map +1 -1
- package/dist/page/shell.js +1 -1
- package/dist/page/shell.js.map +1 -1
- package/dist/page/stateScript.js +1 -1
- package/dist/page/style.d.ts.map +1 -1
- package/dist/page/style.js +1 -0
- package/dist/page/style.js.map +1 -1
- package/dist/page/swap.d.ts +1 -1
- package/dist/page/swap.d.ts.map +1 -1
- package/dist/page/swap.js +16 -5
- package/dist/page/swap.js.map +1 -1
- package/dist/path/isMarkdown.d.ts +2 -0
- package/dist/path/isMarkdown.d.ts.map +1 -0
- package/dist/path/isMarkdown.js +7 -0
- package/dist/path/isMarkdown.js.map +1 -0
- package/dist/rpc/affected.d.ts +4 -0
- package/dist/rpc/affected.d.ts.map +1 -0
- package/dist/rpc/affected.js +75 -0
- package/dist/rpc/affected.js.map +1 -0
- package/dist/rpc/contract.d.ts +134 -0
- package/dist/rpc/contract.d.ts.map +1 -0
- package/dist/rpc/contract.js +59 -0
- package/dist/rpc/contract.js.map +1 -0
- package/dist/rpc/hints.d.ts +17 -0
- package/dist/rpc/hints.d.ts.map +1 -0
- package/dist/rpc/hints.js +28 -0
- package/dist/rpc/hints.js.map +1 -0
- package/dist/rpc/keys.d.ts +7 -0
- package/dist/rpc/keys.d.ts.map +1 -0
- package/dist/rpc/keys.js +9 -0
- package/dist/rpc/keys.js.map +1 -0
- package/dist/rpc/pageKeys.d.ts +3 -0
- package/dist/rpc/pageKeys.d.ts.map +1 -0
- package/dist/rpc/pageKeys.js +14 -0
- package/dist/rpc/pageKeys.js.map +1 -0
- package/dist/rpc/server.d.ts +12 -0
- package/dist/rpc/server.d.ts.map +1 -0
- package/dist/rpc/server.js +32 -0
- package/dist/rpc/server.js.map +1 -0
- package/package.json +9 -4
- package/src/board.ts +44 -9
- package/src/browser/client.ts +59 -0
- package/src/browser/session.ts +26 -0
- package/src/cli.ts +1 -1
- package/src/files/changes.ts +14 -4
- package/src/files/list.ts +5 -4
- package/src/history/schema.ts +1 -1
- package/src/history/script.ts +28 -13
- package/src/http/assets.ts +11 -0
- package/src/http/history.ts +1 -12
- package/src/http/sameOrigin.ts +14 -0
- package/src/page/ageScript.ts +22 -0
- package/src/page/client.ts +73 -74
- package/src/page/navigationScript.ts +7 -5
- package/src/page/searchScript.ts +6 -4
- package/src/page/shell.ts +1 -1
- package/src/page/stateScript.ts +1 -1
- package/src/page/style.ts +1 -0
- package/src/page/swap.ts +16 -5
- package/src/path/isMarkdown.ts +6 -0
- package/src/rpc/affected.ts +77 -0
- package/src/rpc/contract.ts +62 -0
- package/src/rpc/hints.ts +34 -0
- package/src/rpc/keys.ts +9 -0
- package/src/rpc/pageKeys.ts +14 -0
- package/src/rpc/server.ts +55 -0
package/dist/page/style.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/page/style.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/page/style.ts"],"names":[],"mappings":"AA2DA,eAAO,MAAM,KAAK,QAA+H,CAAC"}
|
package/dist/page/style.js
CHANGED
|
@@ -45,6 +45,7 @@ const board = `
|
|
|
45
45
|
footer { margin-top: 2.5em; padding-top: 1em; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.925em; }
|
|
46
46
|
`;
|
|
47
47
|
const diagrams = `
|
|
48
|
+
[data-live-change] { outline: 2px solid var(--border); outline-offset: 3px; border-radius: 3px; }
|
|
48
49
|
figure.diagram { margin-left: 0; margin-right: 0; }
|
|
49
50
|
figure.diagram[data-state="pending"] { min-height: 12rem; background: var(--surface); border-radius: 6px; }
|
|
50
51
|
figure.diagram .diagram-source { display: none; }
|
package/dist/page/style.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/page/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Bb,CAAC;AAEF,MAAM,KAAK,GAAG;;;;;;;;;;;;CAYb,CAAC;AAEF,MAAM,QAAQ,GAAG
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/page/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Bb,CAAC;AAEF,MAAM,KAAK,GAAG;;;;;;;;;;;;CAYb,CAAC;AAEF,MAAM,QAAQ,GAAG;;;;;;;;CAQhB,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,aAAa,EAAE,GAAG,YAAY,GAAG,cAAc,GAAG,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC"}
|
package/dist/page/swap.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const swap = "\nconst containers = new Set([\"DIV\", \"SECTION\", \"ARTICLE\", \"HEADER\", \"FOOTER\", \"MAIN\", \"NAV\", \"FORM\", \"SELECT\", \"LABEL\", \"ASIDE\"]);\n\nconst structural = (element) => [...element.childNodes].every((node) => node.nodeType === 1 || node.textContent.trim() === \"\");\n\nconst pristine = new WeakMap();\n\nexport const remember = (element) => {\n pristine.set(element, element.outerHTML);\n if (containers.has(element.tagName)) for (const child of element.children) remember(child);\n};\n\nconst normalized = (element) => {\n const copy = element.cloneNode(true);\n for (const node of [copy, ...copy.querySelectorAll(\"*\")]) {\n if (node.tagName === \"DETAILS\") node.removeAttribute(\"open\");\n if (node.matches(\"figure.diagram\")) {\n node.querySelector(\".diagram-svg\")?.remove();\n node.dataset.state = \"pending\";\n delete node.dataset.error;\n }\n if (node.matches(\"[data-modified]\")) node.textContent = \"\";\n }\n return copy.outerHTML;\n};\n\nconst signature = (element) => {\n if (!pristine.has(element)) pristine.set(element, normalized(element));\n return pristine.get(element);\n};\n\nconst sameShell = (old, next) =>\n old.tagName === next.tagName && containers.has(old.tagName) && old
|
|
1
|
+
export declare const swap = "\nconst containers = new Set([\"DIV\", \"SECTION\", \"ARTICLE\", \"HEADER\", \"FOOTER\", \"MAIN\", \"NAV\", \"FORM\", \"SELECT\", \"LABEL\", \"ASIDE\"]);\n\nconst structural = (element) => [...element.childNodes].every((node) => node.nodeType === 1 || node.textContent.trim() === \"\");\n\nconst pristine = new WeakMap();\nconst flash = (element) => {\n if (element.matches(\"[data-modified]\")) return;\n if (!element.matches(\"p, li, pre, blockquote, h1, h2, h3, h4, h5, h6, .item, .notes, .metadata-panel\")) return;\n element.setAttribute(\"data-live-change\", \"\");\n setTimeout(() => element.removeAttribute(\"data-live-change\"), 2500);\n};\n\nexport const remember = (element) => {\n pristine.set(element, element.outerHTML);\n if (containers.has(element.tagName)) for (const child of element.children) remember(child);\n};\n\nconst normalized = (element) => {\n const copy = element.cloneNode(true);\n for (const node of [copy, ...copy.querySelectorAll(\"*\")]) {\n node.removeAttribute(\"data-live-change\");\n if (node.tagName === \"DETAILS\") node.removeAttribute(\"open\");\n if (node.matches(\"figure.diagram\")) {\n node.querySelector(\".diagram-svg\")?.remove();\n node.dataset.state = \"pending\";\n delete node.dataset.error;\n }\n if (node.matches(\"[data-modified]\")) node.textContent = \"\";\n }\n return copy.outerHTML;\n};\n\nconst signature = (element) => {\n if (!pristine.has(element)) pristine.set(element, normalized(element));\n return pristine.get(element);\n};\n\nconst normalizedShell = (element) => { const copy = element.cloneNode(false); copy.removeAttribute(\"data-live-change\"); return copy.outerHTML; };\n\nconst sameShell = (old, next) =>\n old.tagName === next.tagName && containers.has(old.tagName) && normalizedShell(old) === normalizedShell(next);\n\nconst matches = (a, b) => {\n let start = 0;\n while (start < a.length && start < b.length && a[start] === b[start]) start++;\n let tail = 0;\n while (tail < a.length - start && tail < b.length - start && a[a.length - 1 - tail] === b[b.length - 1 - tail]) tail++;\n const n = a.length - start - tail;\n const m = b.length - start - tail;\n const table = Array.from({ length: n + 1 }, () => new Uint32Array(m + 1));\n for (let i = n - 1; i >= 0; i--) {\n for (let j = m - 1; j >= 0; j--) {\n table[i][j] = a[start + i] === b[start + j] ? table[i + 1][j + 1] + 1 : Math.max(table[i + 1][j], table[i][j + 1]);\n }\n }\n const pairs = Array.from({ length: start }, (_, index) => [index, index]);\n for (let i = 0, j = 0; i < n && j < m; ) {\n if (a[start + i] === b[start + j]) pairs.push([start + i++, start + j++]);\n else if (table[i + 1][j] >= table[i][j + 1]) i++;\n else j++;\n }\n for (let index = tail; index > 0; index--) pairs.push([a.length - index, b.length - index]);\n return [...pairs, [a.length, b.length]];\n};\n\nconst patch = (current, incoming, highlight) => {\n const selected = current.tagName === \"SELECT\" ? current.value : null;\n const fallback = incoming.tagName === \"SELECT\" ? incoming.value : null;\n if (!structural(current) || !structural(incoming)) {\n current.replaceChildren(...incoming.childNodes);\n for (const child of current.children) remember(child);\n if (highlight) flash(current);\n return;\n }\n const olds = [...current.children];\n const news = [...incoming.children];\n const signatures = news.map((next) => next.outerHTML);\n const arrive = (index) => {\n remember(news[index]);\n if (highlight) flash(news[index]);\n return news[index];\n };\n let i = 0;\n let j = 0;\n for (const [kept, arrived] of matches(olds.map(signature), signatures)) {\n const anchor = olds[kept] ?? null;\n for (; i < kept && j < arrived; i++, j++) {\n if (sameShell(olds[i], news[j])) {\n patch(olds[i], news[j], highlight);\n pristine.set(olds[i], signatures[j]);\n } else olds[i].replaceWith(arrive(j));\n }\n for (; i < kept; i++) olds[i].remove();\n for (; j < arrived; j++) current.insertBefore(arrive(j), anchor);\n i++;\n j++;\n }\n if (selected !== null) current.value = [...current.options].some((option) => option.value === selected) ? selected : fallback;\n};\n\nconst keysOf = (root) => {\n const seen = new Map();\n return [...root.querySelectorAll(\"details\")].map((details) => {\n const base =\n details.dataset.key ??\n (details.closest(\".item\")?.querySelector(\"h3\")?.textContent ?? \"\") + \"|\" + (details.querySelector(\"summary\")?.textContent ?? \"\");\n const count = seen.get(base) ?? 0;\n seen.set(base, count + 1);\n return [base + \"#\" + count, details];\n });\n};\n\nconst carryDrawings = (drawings, figures) => {\n if (drawings.length !== figures.length) return;\n figures.forEach((figure, index) => {\n const drawing = drawings[index];\n if (figure.dataset.state !== \"pending\" || drawing === null || drawing.isConnected) return;\n figure.prepend(drawing);\n figure.dataset.state = \"redrawing\";\n });\n};\n\nexport const swap = (current, incoming, highlight = false) => {\n const before = keysOf(current);\n const open = new Map(before.map(([key, details]) => [key, details.open]));\n const existing = new Set(before.map(([, details]) => details));\n const drawings = [...current.querySelectorAll(\"figure.diagram\")].map((figure) => figure.querySelector(\".diagram-svg\"));\n patch(current, incoming, highlight);\n carryDrawings(drawings, [...current.querySelectorAll(\"figure.diagram\")]);\n for (const [key, details] of keysOf(current)) {\n const was = open.get(key);\n if (was !== undefined && !existing.has(details)) details.open = was;\n }\n};\n";
|
|
2
2
|
//# sourceMappingURL=swap.d.ts.map
|
package/dist/page/swap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/page/swap.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/page/swap.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,+lLAuIhB,CAAC"}
|
package/dist/page/swap.js
CHANGED
|
@@ -4,6 +4,12 @@ const containers = new Set(["DIV", "SECTION", "ARTICLE", "HEADER", "FOOTER", "MA
|
|
|
4
4
|
const structural = (element) => [...element.childNodes].every((node) => node.nodeType === 1 || node.textContent.trim() === "");
|
|
5
5
|
|
|
6
6
|
const pristine = new WeakMap();
|
|
7
|
+
const flash = (element) => {
|
|
8
|
+
if (element.matches("[data-modified]")) return;
|
|
9
|
+
if (!element.matches("p, li, pre, blockquote, h1, h2, h3, h4, h5, h6, .item, .notes, .metadata-panel")) return;
|
|
10
|
+
element.setAttribute("data-live-change", "");
|
|
11
|
+
setTimeout(() => element.removeAttribute("data-live-change"), 2500);
|
|
12
|
+
};
|
|
7
13
|
|
|
8
14
|
export const remember = (element) => {
|
|
9
15
|
pristine.set(element, element.outerHTML);
|
|
@@ -13,6 +19,7 @@ export const remember = (element) => {
|
|
|
13
19
|
const normalized = (element) => {
|
|
14
20
|
const copy = element.cloneNode(true);
|
|
15
21
|
for (const node of [copy, ...copy.querySelectorAll("*")]) {
|
|
22
|
+
node.removeAttribute("data-live-change");
|
|
16
23
|
if (node.tagName === "DETAILS") node.removeAttribute("open");
|
|
17
24
|
if (node.matches("figure.diagram")) {
|
|
18
25
|
node.querySelector(".diagram-svg")?.remove();
|
|
@@ -29,8 +36,10 @@ const signature = (element) => {
|
|
|
29
36
|
return pristine.get(element);
|
|
30
37
|
};
|
|
31
38
|
|
|
39
|
+
const normalizedShell = (element) => { const copy = element.cloneNode(false); copy.removeAttribute("data-live-change"); return copy.outerHTML; };
|
|
40
|
+
|
|
32
41
|
const sameShell = (old, next) =>
|
|
33
|
-
old.tagName === next.tagName && containers.has(old.tagName) && old
|
|
42
|
+
old.tagName === next.tagName && containers.has(old.tagName) && normalizedShell(old) === normalizedShell(next);
|
|
34
43
|
|
|
35
44
|
const matches = (a, b) => {
|
|
36
45
|
let start = 0;
|
|
@@ -55,12 +64,13 @@ const matches = (a, b) => {
|
|
|
55
64
|
return [...pairs, [a.length, b.length]];
|
|
56
65
|
};
|
|
57
66
|
|
|
58
|
-
const patch = (current, incoming) => {
|
|
67
|
+
const patch = (current, incoming, highlight) => {
|
|
59
68
|
const selected = current.tagName === "SELECT" ? current.value : null;
|
|
60
69
|
const fallback = incoming.tagName === "SELECT" ? incoming.value : null;
|
|
61
70
|
if (!structural(current) || !structural(incoming)) {
|
|
62
71
|
current.replaceChildren(...incoming.childNodes);
|
|
63
72
|
for (const child of current.children) remember(child);
|
|
73
|
+
if (highlight) flash(current);
|
|
64
74
|
return;
|
|
65
75
|
}
|
|
66
76
|
const olds = [...current.children];
|
|
@@ -68,6 +78,7 @@ const patch = (current, incoming) => {
|
|
|
68
78
|
const signatures = news.map((next) => next.outerHTML);
|
|
69
79
|
const arrive = (index) => {
|
|
70
80
|
remember(news[index]);
|
|
81
|
+
if (highlight) flash(news[index]);
|
|
71
82
|
return news[index];
|
|
72
83
|
};
|
|
73
84
|
let i = 0;
|
|
@@ -76,7 +87,7 @@ const patch = (current, incoming) => {
|
|
|
76
87
|
const anchor = olds[kept] ?? null;
|
|
77
88
|
for (; i < kept && j < arrived; i++, j++) {
|
|
78
89
|
if (sameShell(olds[i], news[j])) {
|
|
79
|
-
patch(olds[i], news[j]);
|
|
90
|
+
patch(olds[i], news[j], highlight);
|
|
80
91
|
pristine.set(olds[i], signatures[j]);
|
|
81
92
|
} else olds[i].replaceWith(arrive(j));
|
|
82
93
|
}
|
|
@@ -110,12 +121,12 @@ const carryDrawings = (drawings, figures) => {
|
|
|
110
121
|
});
|
|
111
122
|
};
|
|
112
123
|
|
|
113
|
-
export const swap = (current, incoming) => {
|
|
124
|
+
export const swap = (current, incoming, highlight = false) => {
|
|
114
125
|
const before = keysOf(current);
|
|
115
126
|
const open = new Map(before.map(([key, details]) => [key, details.open]));
|
|
116
127
|
const existing = new Set(before.map(([, details]) => details));
|
|
117
128
|
const drawings = [...current.querySelectorAll("figure.diagram")].map((figure) => figure.querySelector(".diagram-svg"));
|
|
118
|
-
patch(current, incoming);
|
|
129
|
+
patch(current, incoming, highlight);
|
|
119
130
|
carryDrawings(drawings, [...current.querySelectorAll("figure.diagram")]);
|
|
120
131
|
for (const [key, details] of keysOf(current)) {
|
|
121
132
|
const was = open.get(key);
|
package/dist/page/swap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.js","sourceRoot":"","sources":["../../src/page/swap.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG
|
|
1
|
+
{"version":3,"file":"swap.js","sourceRoot":"","sources":["../../src/page/swap.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuInB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isMarkdown.d.ts","sourceRoot":"","sources":["../../src/path/isMarkdown.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isMarkdown.js","sourceRoot":"","sources":["../../src/path/isMarkdown.ts"],"names":[],"mappings":"AAAA,SAAS,OAAO,CAAC,OAAe;IAC/B,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,KAAK,cAAc,CAAC;AAC9D,CAAC;AACD,MAAM,UAAU,UAAU,CAAC,IAAY;IACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Key } from "@shivaedev/effect-contract/keys.ts";
|
|
2
|
+
import type { MetadataModel } from "#metadata/model.ts";
|
|
3
|
+
export declare function affected(previous: MetadataModel, current: MetadataModel, paths: readonly string[]): readonly Key[] | undefined;
|
|
4
|
+
//# sourceMappingURL=affected.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affected.d.ts","sourceRoot":"","sources":["../../src/rpc/affected.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oCAAoC,CAAC;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAwDxD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,EAAE,GAAG,SAAS,CAkB9H"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { backlinksOf } from "#metadata/backlinks.ts";
|
|
2
|
+
import { documents, identities, index, navigation } from "./keys.js";
|
|
3
|
+
function uncertain(previous, current, paths) {
|
|
4
|
+
if (previous.unavailable.length > 0 || current.unavailable.length > 0) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
const before = new Map(previous.documents.map((doc) => [doc.file, doc.parsed]));
|
|
8
|
+
const after = new Map(current.documents.map((doc) => [doc.file, doc.parsed]));
|
|
9
|
+
const known = new Set([...before.keys(), ...after.keys()]);
|
|
10
|
+
if (paths.some((path) => !known.has(path))) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const announced = new Set(paths);
|
|
14
|
+
return [...known].some((file) => {
|
|
15
|
+
const old = before.get(file);
|
|
16
|
+
const next = after.get(file);
|
|
17
|
+
return !announced.has(file) && (old?.body !== next?.body || old?.raw !== next?.raw || old?.bodyLine !== next?.bodyLine);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function connectIdentities(model, connect) {
|
|
21
|
+
for (const duplicates of model.ids.values()) {
|
|
22
|
+
const first = duplicates[0];
|
|
23
|
+
if (first === undefined) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
for (const duplicate of duplicates.slice(1)) {
|
|
27
|
+
connect(first.file, duplicate.file);
|
|
28
|
+
connect(duplicate.file, first.file);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function linkedFiles(models, paths) {
|
|
33
|
+
const edges = new Map();
|
|
34
|
+
function connect(from, to) {
|
|
35
|
+
const targets = edges.get(from) ?? new Set();
|
|
36
|
+
targets.add(to);
|
|
37
|
+
edges.set(from, targets);
|
|
38
|
+
}
|
|
39
|
+
for (const model of models) {
|
|
40
|
+
connectIdentities(model, connect);
|
|
41
|
+
for (const document of model.documents) {
|
|
42
|
+
for (const link of backlinksOf(document.file, model)) {
|
|
43
|
+
connect(document.file, link.file);
|
|
44
|
+
connect(link.file, document.file);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const files = new Set(paths);
|
|
49
|
+
for (const file of files) {
|
|
50
|
+
for (const linked of edges.get(file) ?? []) {
|
|
51
|
+
files.add(linked);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return files;
|
|
55
|
+
}
|
|
56
|
+
export function affected(previous, current, paths) {
|
|
57
|
+
if (uncertain(previous, current, paths)) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
const models = [previous, current];
|
|
61
|
+
const files = linkedFiles(models, paths);
|
|
62
|
+
const keys = [index.list, navigation.list, ...[...files].map((file) => documents.item(file))];
|
|
63
|
+
for (const model of models) {
|
|
64
|
+
if (model.rootFile && files.has(model.rootFile)) {
|
|
65
|
+
keys.push(documents.item(""));
|
|
66
|
+
}
|
|
67
|
+
for (const document of model.documents) {
|
|
68
|
+
if (files.has(document.file) && document.parsed.fields.id) {
|
|
69
|
+
keys.push(identities.item(document.parsed.fields.id));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return keys;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=affected.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affected.js","sourceRoot":"","sources":["../../src/rpc/affected.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAErE,SAAS,SAAS,CAAC,QAAuB,EAAE,OAAsB,EAAE,KAAwB;IAC3F,IAAI,QAAQ,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvE,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAChF,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC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ruct<"ReadFailed", {
|
|
4
|
+
readonly operation: Schema.String;
|
|
5
|
+
readonly status: Schema.Number;
|
|
6
|
+
}>, import("effect/Cause").YieldableError>;
|
|
7
|
+
export declare class ReadFailed extends ReadFailed_base {
|
|
8
|
+
}
|
|
9
|
+
export declare const workContract: import("@shivaedev/effect-contract/contract.ts").Contract<"work-board", readonly [import("@shivaedev/effect-contract/operation.ts").Query<"page", Schema.Struct<{
|
|
10
|
+
url: Schema.String;
|
|
11
|
+
}>, Schema.Struct<{
|
|
12
|
+
readonly html: Schema.String;
|
|
13
|
+
readonly status: Schema.Number;
|
|
14
|
+
}>, {
|
|
15
|
+
readonly ReadFailed: typeof ReadFailed;
|
|
16
|
+
}>, import("@shivaedev/effect-contract/operation.ts").Query<"navigation", Schema.Void, Schema.String, {
|
|
17
|
+
readonly ReadFailed: typeof ReadFailed;
|
|
18
|
+
}>, import("@shivaedev/effect-contract/operation.ts").Query<"search", Schema.Struct<{
|
|
19
|
+
query: Schema.String;
|
|
20
|
+
}>, Schema.Struct<{
|
|
21
|
+
readonly results: Schema.$Array<Schema.Struct<{
|
|
22
|
+
readonly file: Schema.String;
|
|
23
|
+
readonly href: Schema.String;
|
|
24
|
+
readonly kind: Schema.Literals<readonly ["document", "heading", "passage"]>;
|
|
25
|
+
readonly line: Schema.optional<Schema.Number>;
|
|
26
|
+
readonly snippet: Schema.String;
|
|
27
|
+
readonly text: Schema.String;
|
|
28
|
+
readonly title: Schema.String;
|
|
29
|
+
}>>;
|
|
30
|
+
readonly total: Schema.Number;
|
|
31
|
+
readonly unavailable: Schema.$Array<Schema.String>;
|
|
32
|
+
}>, {
|
|
33
|
+
readonly ReadFailed: typeof ReadFailed;
|
|
34
|
+
}>, import("@shivaedev/effect-contract/operation.ts").Query<"history", Schema.Struct<{
|
|
35
|
+
readonly action: Schema.Literals<readonly ["check", "compare", "observe"]>;
|
|
36
|
+
readonly baseline: Schema.NullOr<Schema.String>;
|
|
37
|
+
}>, Schema.Struct<{
|
|
38
|
+
readonly discardBaseline: Schema.Boolean;
|
|
39
|
+
readonly html: Schema.String;
|
|
40
|
+
readonly reason: Schema.String;
|
|
41
|
+
readonly snapshot: Schema.NullOr<Schema.String>;
|
|
42
|
+
}>, {
|
|
43
|
+
readonly ReadFailed: typeof ReadFailed;
|
|
44
|
+
}>, import("@shivaedev/effect-contract/operation.ts").Query<"watcher", Schema.Void, Schema.Struct<{
|
|
45
|
+
readonly watching: Schema.Boolean;
|
|
46
|
+
}>, {
|
|
47
|
+
readonly ReadFailed: typeof ReadFailed;
|
|
48
|
+
}>], readonly [], Rpc.Rpc<"work-board.history", Schema.Struct<{
|
|
49
|
+
readonly action: Schema.Literals<readonly ["check", "compare", "observe"]>;
|
|
50
|
+
readonly baseline: Schema.NullOr<Schema.String>;
|
|
51
|
+
}>, Schema.Struct<{
|
|
52
|
+
readonly discardBaseline: Schema.Boolean;
|
|
53
|
+
readonly html: Schema.String;
|
|
54
|
+
readonly reason: Schema.String;
|
|
55
|
+
readonly snapshot: Schema.NullOr<Schema.String>;
|
|
56
|
+
}>, Schema.Union<readonly (typeof ReadFailed)[]>, never, never> | Rpc.Rpc<"work-board.navigation", Schema.Void, Schema.String, Schema.Union<readonly (typeof ReadFailed)[]>, never, never> | Rpc.Rpc<"work-board.page", Schema.Struct<{
|
|
57
|
+
url: Schema.String;
|
|
58
|
+
}>, Schema.Struct<{
|
|
59
|
+
readonly html: Schema.String;
|
|
60
|
+
readonly status: Schema.Number;
|
|
61
|
+
}>, Schema.Union<readonly (typeof ReadFailed)[]>, never, never> | Rpc.Rpc<"work-board.search", Schema.Struct<{
|
|
62
|
+
query: Schema.String;
|
|
63
|
+
}>, Schema.Struct<{
|
|
64
|
+
readonly results: Schema.$Array<Schema.Struct<{
|
|
65
|
+
readonly file: Schema.String;
|
|
66
|
+
readonly href: Schema.String;
|
|
67
|
+
readonly kind: Schema.Literals<readonly ["document", "heading", "passage"]>;
|
|
68
|
+
readonly line: Schema.optional<Schema.Number>;
|
|
69
|
+
readonly snippet: Schema.String;
|
|
70
|
+
readonly text: Schema.String;
|
|
71
|
+
readonly title: Schema.String;
|
|
72
|
+
}>>;
|
|
73
|
+
readonly total: Schema.Number;
|
|
74
|
+
readonly unavailable: Schema.$Array<Schema.String>;
|
|
75
|
+
}>, Schema.Union<readonly (typeof ReadFailed)[]>, never, never> | Rpc.Rpc<"work-board.watcher", Schema.Void, Schema.Struct<{
|
|
76
|
+
readonly watching: Schema.Boolean;
|
|
77
|
+
}>, Schema.Union<readonly (typeof ReadFailed)[]>, never, never>>;
|
|
78
|
+
export declare const Subscribe: Rpc.Rpc<"work-board.subscribe", Schema.Void, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Union<readonly [Schema.Struct<{
|
|
79
|
+
readonly _tag: Schema.Literal<"Changed">;
|
|
80
|
+
readonly keys: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
81
|
+
readonly _tag: Schema.Literal<"List">;
|
|
82
|
+
readonly collection: Schema.String;
|
|
83
|
+
}>, Schema.Struct<{
|
|
84
|
+
readonly _tag: Schema.Literal<"Item">;
|
|
85
|
+
readonly collection: Schema.String;
|
|
86
|
+
readonly id: Schema.Union<readonly [Schema.String, Schema.Number]>;
|
|
87
|
+
}>]>>;
|
|
88
|
+
}>, Schema.Struct<{
|
|
89
|
+
readonly _tag: Schema.Literal<"Resync">;
|
|
90
|
+
}>]>, typeof ReadFailed>, Schema.Never, never, never>;
|
|
91
|
+
export declare const workRpcs: import("effect/unstable/rpc/RpcGroup").RpcGroup<Rpc.Rpc<"work-board.history", Schema.Struct<{
|
|
92
|
+
readonly action: Schema.Literals<readonly ["check", "compare", "observe"]>;
|
|
93
|
+
readonly baseline: Schema.NullOr<Schema.String>;
|
|
94
|
+
}>, Schema.Struct<{
|
|
95
|
+
readonly discardBaseline: Schema.Boolean;
|
|
96
|
+
readonly html: Schema.String;
|
|
97
|
+
readonly reason: Schema.String;
|
|
98
|
+
readonly snapshot: Schema.NullOr<Schema.String>;
|
|
99
|
+
}>, Schema.Union<readonly (typeof ReadFailed)[]>, never, never> | Rpc.Rpc<"work-board.navigation", Schema.Void, Schema.String, Schema.Union<readonly (typeof ReadFailed)[]>, never, never> | Rpc.Rpc<"work-board.page", Schema.Struct<{
|
|
100
|
+
url: Schema.String;
|
|
101
|
+
}>, Schema.Struct<{
|
|
102
|
+
readonly html: Schema.String;
|
|
103
|
+
readonly status: Schema.Number;
|
|
104
|
+
}>, Schema.Union<readonly (typeof ReadFailed)[]>, never, never> | Rpc.Rpc<"work-board.search", Schema.Struct<{
|
|
105
|
+
query: Schema.String;
|
|
106
|
+
}>, Schema.Struct<{
|
|
107
|
+
readonly results: Schema.$Array<Schema.Struct<{
|
|
108
|
+
readonly file: Schema.String;
|
|
109
|
+
readonly href: Schema.String;
|
|
110
|
+
readonly kind: Schema.Literals<readonly ["document", "heading", "passage"]>;
|
|
111
|
+
readonly line: Schema.optional<Schema.Number>;
|
|
112
|
+
readonly snippet: Schema.String;
|
|
113
|
+
readonly text: Schema.String;
|
|
114
|
+
readonly title: Schema.String;
|
|
115
|
+
}>>;
|
|
116
|
+
readonly total: Schema.Number;
|
|
117
|
+
readonly unavailable: Schema.$Array<Schema.String>;
|
|
118
|
+
}>, Schema.Union<readonly (typeof ReadFailed)[]>, never, never> | Rpc.Rpc<"work-board.watcher", Schema.Void, Schema.Struct<{
|
|
119
|
+
readonly watching: Schema.Boolean;
|
|
120
|
+
}>, Schema.Union<readonly (typeof ReadFailed)[]>, never, never> | Rpc.Rpc<"work-board.subscribe", Schema.Void, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Union<readonly [Schema.Struct<{
|
|
121
|
+
readonly _tag: Schema.Literal<"Changed">;
|
|
122
|
+
readonly keys: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
123
|
+
readonly _tag: Schema.Literal<"List">;
|
|
124
|
+
readonly collection: Schema.String;
|
|
125
|
+
}>, Schema.Struct<{
|
|
126
|
+
readonly _tag: Schema.Literal<"Item">;
|
|
127
|
+
readonly collection: Schema.String;
|
|
128
|
+
readonly id: Schema.Union<readonly [Schema.String, Schema.Number]>;
|
|
129
|
+
}>]>>;
|
|
130
|
+
}>, Schema.Struct<{
|
|
131
|
+
readonly _tag: Schema.Literal<"Resync">;
|
|
132
|
+
}>]>, typeof ReadFailed>, Schema.Never, never, never>>;
|
|
133
|
+
export {};
|
|
134
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/rpc/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;;;;;AAQ1C,qBAAa,UAAW,SAAQ,eAAmG;CAAG;AAkDtI,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gEAAwG,CAAC;AAClI,eAAO,MAAM,SAAS;;;;;;;;;;;;qDAA2F,CAAC;AAClH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDAA8B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { Rpc } from "effect/unstable/rpc";
|
|
3
|
+
import { contract } from "@shivaedev/effect-contract/contract.ts";
|
|
4
|
+
import { LiveHint } from "@shivaedev/effect-contract/live.ts";
|
|
5
|
+
import { query } from "@shivaedev/effect-contract/operation.ts";
|
|
6
|
+
import { HistoryInput, HistoryOutput } from "#history/schema.ts";
|
|
7
|
+
import { index, navigation, watcher, workspace } from "./keys.js";
|
|
8
|
+
import { pageKeys } from "./pageKeys.js";
|
|
9
|
+
export class ReadFailed extends Schema.TaggedError()("ReadFailed", { operation: Schema.String, status: Schema.Number }) {
|
|
10
|
+
}
|
|
11
|
+
const PageUrl = Schema.String.check(Schema.isMaxLength(8192), Schema.makeFilter((value) => {
|
|
12
|
+
if (!value.startsWith("/") || value.startsWith("//")) {
|
|
13
|
+
return "Expected a local reading URL";
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const path = new URL(value, "http://127.0.0.1").pathname;
|
|
17
|
+
return (path === "/"
|
|
18
|
+
|| ["/_board/work", "/_board/overview", "/_board/changes"].includes(path)
|
|
19
|
+
|| /^\/_board\/item\/[^/]+\/$/u.exec(path) !== null
|
|
20
|
+
|| /\.md$/iu.exec(path) !== null
|
|
21
|
+
|| "Expected a local reading URL");
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return "Expected a local reading URL";
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
const Page = Schema.Struct({ html: Schema.String, status: Schema.Number });
|
|
28
|
+
const Entry = Schema.Struct({
|
|
29
|
+
file: Schema.String,
|
|
30
|
+
href: Schema.String,
|
|
31
|
+
kind: Schema.Literals(["document", "heading", "passage"]),
|
|
32
|
+
line: Schema.optional(Schema.Number),
|
|
33
|
+
snippet: Schema.String,
|
|
34
|
+
text: Schema.String,
|
|
35
|
+
title: Schema.String,
|
|
36
|
+
});
|
|
37
|
+
const ReadPage = query("page", { payload: { url: PageUrl }, reads: ({ url }) => pageKeys(url), rejections: { ReadFailed }, success: Page });
|
|
38
|
+
const ReadNavigation = query("navigation", { reads: () => [workspace.list, navigation.list], rejections: { ReadFailed }, success: Schema.String });
|
|
39
|
+
const ReadSearch = query("search", {
|
|
40
|
+
payload: { query: Schema.String.check(Schema.isMaxLength(8192)) },
|
|
41
|
+
reads: () => [workspace.list, index.list],
|
|
42
|
+
rejections: { ReadFailed },
|
|
43
|
+
success: Schema.Struct({ results: Schema.Array(Entry), total: Schema.Number, unavailable: Schema.Array(Schema.String) }),
|
|
44
|
+
});
|
|
45
|
+
const ReadHistory = query("history", {
|
|
46
|
+
payload: HistoryInput,
|
|
47
|
+
reads: () => [workspace.list, index.list],
|
|
48
|
+
rejections: { ReadFailed },
|
|
49
|
+
success: HistoryOutput,
|
|
50
|
+
});
|
|
51
|
+
const ReadWatcher = query("watcher", {
|
|
52
|
+
reads: () => [workspace.list, watcher.list],
|
|
53
|
+
rejections: { ReadFailed },
|
|
54
|
+
success: Schema.Struct({ watching: Schema.Boolean }),
|
|
55
|
+
});
|
|
56
|
+
export const workContract = contract("work-board", { queries: [ReadPage, ReadNavigation, ReadSearch, ReadHistory, ReadWatcher] });
|
|
57
|
+
export const Subscribe = Rpc.make("work-board.subscribe", { error: ReadFailed, stream: true, success: LiveHint });
|
|
58
|
+
export const workRpcs = workContract.add(Subscribe);
|
|
59
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/rpc/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,yCAAyC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,OAAO,UAAW,SAAQ,MAAM,CAAC,WAAW,EAAc,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;CAAG;AACtI,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAClC,MAAM,CA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AAa;CACtB,CAAC,CAAC;AACH,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,EAAE;IACpC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC;IAC3C,UAAU,EAAE,EAAE,UAAU,EAAE;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;CACpD,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;AAClI,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;AAClH,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Effect, Stream } from "effect";
|
|
2
|
+
import type { Changes } from "#files/changes.ts";
|
|
3
|
+
import type { Snapshot } from "#search/snapshot.ts";
|
|
4
|
+
export declare function hints(changes: Changes, index: Effect.Effect<Snapshot, unknown>): Stream.Stream<{
|
|
5
|
+
readonly _tag: "Changed";
|
|
6
|
+
readonly keys: readonly ({
|
|
7
|
+
readonly _tag: "List";
|
|
8
|
+
readonly collection: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly _tag: "Item";
|
|
11
|
+
readonly collection: string;
|
|
12
|
+
readonly id: string | number;
|
|
13
|
+
})[];
|
|
14
|
+
} | {
|
|
15
|
+
readonly _tag: "Resync";
|
|
16
|
+
}, never, never>;
|
|
17
|
+
//# sourceMappingURL=hints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hints.d.ts","sourceRoot":"","sources":["../../src/rpc/hints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,wBAAgB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC;;;;;;;;;;;;iBA2B9E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Effect, PubSub, Stream } from "effect";
|
|
2
|
+
import { affected } from "./affected.js";
|
|
3
|
+
export function hints(changes, index) {
|
|
4
|
+
return Stream.unwrap(Effect.gen(function* () {
|
|
5
|
+
const subscription = yield* PubSub.subscribe(changes.events);
|
|
6
|
+
let sequence = changes.sequence ? yield* changes.sequence : undefined;
|
|
7
|
+
let previous = yield* Effect.option(index);
|
|
8
|
+
function nextHint(change) {
|
|
9
|
+
return Effect.gen(function* () {
|
|
10
|
+
const current = yield* Effect.option(index);
|
|
11
|
+
const contiguous = sequence !== undefined && change.sequence === sequence + 1;
|
|
12
|
+
sequence = change.sequence;
|
|
13
|
+
let hint = { _tag: "Resync" };
|
|
14
|
+
if (contiguous && change._tag === "Changed" && previous._tag === "Some" && current._tag === "Some") {
|
|
15
|
+
const keys = affected(previous.value.model, current.value.model, change.paths);
|
|
16
|
+
if (keys !== undefined) {
|
|
17
|
+
hint = { _tag: "Changed", keys };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
previous = current;
|
|
21
|
+
return hint;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const changesStream = Stream.fromSubscription(subscription).pipe(Stream.mapEffect(nextHint));
|
|
25
|
+
return Stream.concat(Stream.succeed({ _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O,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;oBACpG,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC/E,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;wBACxB,IAAI,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;oBAClC,CAAC;gBACF,CAAC;gBACD,QAAQ,GAAG,OAAO,CAAC;gBACnB,OAAO,IAAI,CAAC;YACb,CAAC,CAAC,CAAC;QACJ,CAAC;QAED,MAAM,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC7F,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;IACnF,CAAC,CAAC,CACF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const workspace: import("@shivaedev/effect-contract/keys.ts").Collection<"work-board/workspace", string>;
|
|
2
|
+
export declare const documents: import("@shivaedev/effect-contract/keys.ts").Collection<"work-board/documents", string>;
|
|
3
|
+
export declare const identities: import("@shivaedev/effect-contract/keys.ts").Collection<"work-board/identities", string>;
|
|
4
|
+
export declare const navigation: import("@shivaedev/effect-contract/keys.ts").Collection<"work-board/navigation", string>;
|
|
5
|
+
export declare const index: import("@shivaedev/effect-contract/keys.ts").Collection<"work-board/index", string>;
|
|
6
|
+
export declare const watcher: import("@shivaedev/effect-contract/keys.ts").Collection<"work-board/watcher", string>;
|
|
7
|
+
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/rpc/keys.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,yFAAoD,CAAC;AAC3E,eAAO,MAAM,SAAS,yFAAoD,CAAC;AAC3E,eAAO,MAAM,UAAU,0FAAqD,CAAC;AAC7E,eAAO,MAAM,UAAU,0FAAqD,CAAC;AAC7E,eAAO,MAAM,KAAK,qFAAgD,CAAC;AACnE,eAAO,MAAM,OAAO,uFAAkD,CAAC"}
|
package/dist/rpc/keys.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { collection } from "@shivaedev/effect-contract/keys.ts";
|
|
3
|
+
export const workspace = collection("work-board/workspace", Schema.String);
|
|
4
|
+
export const documents = collection("work-board/documents", Schema.String);
|
|
5
|
+
export const identities = collection("work-board/identities", Schema.String);
|
|
6
|
+
export const navigation = collection("work-board/navigation", Schema.String);
|
|
7
|
+
export const index = collection("work-board/index", Schema.String);
|
|
8
|
+
export const watcher = collection("work-board/watcher", Schema.String);
|
|
9
|
+
//# sourceMappingURL=keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/rpc/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC,sBAAsB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC,sBAAsB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,kBAAkB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageKeys.d.ts","sourceRoot":"","sources":["../../src/rpc/pageKeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oCAAoC,CAAC;AAG9D,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,EAAE,CAUpD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { documents, identities, index, workspace } from "./keys.js";
|
|
2
|
+
export function pageKeys(url) {
|
|
3
|
+
const path = new URL(url, "http://127.0.0.1").pathname;
|
|
4
|
+
const item = /^\/_board\/item\/(?<id>[^/]+)\/$/u.exec(path)?.groups?.id;
|
|
5
|
+
let key = documents.item(decodeURIComponent(path.slice(1)));
|
|
6
|
+
if (item) {
|
|
7
|
+
key = identities.item(decodeURIComponent(item));
|
|
8
|
+
}
|
|
9
|
+
else if (path.startsWith("/_board/")) {
|
|
10
|
+
key = index.list;
|
|
11
|
+
}
|
|
12
|
+
return [workspace.list, key];
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=pageKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageKeys.js","sourceRoot":"","sources":["../../src/rpc/pageKeys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEpE,MAAM,UAAU,QAAQ,CAAC,GAAW;IACnC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC;IACvD,MAAM,IAAI,GAAG,mCAAmC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IACxE,IAAI,GAAG,GAAQ,SAAS,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,IAAI,IAAI,EAAE,CAAC;QACV,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,CAAC;SAAM,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACxC,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { HttpServerResponse } from "effect/unstable/http";
|
|
3
|
+
import type { Changes } from "#files/changes.ts";
|
|
4
|
+
import type { Snapshot } from "#search/snapshot.ts";
|
|
5
|
+
export interface ServerOptions {
|
|
6
|
+
readonly changes: Changes;
|
|
7
|
+
readonly home: string | undefined;
|
|
8
|
+
readonly index: Effect.Effect<Snapshot, unknown>;
|
|
9
|
+
readonly page: (url: string) => Effect.Effect<HttpServerResponse.HttpServerResponse, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export declare const server: (args_0: ServerOptions) => Effect.Effect<Effect.Effect<HttpServerResponse.HttpServerResponse, never, import("effect/unstable/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, never, import("effect/Scope").Scope>;
|
|
12
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/rpc/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAc,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAuB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAMjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIpD,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjD,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;CAC9F;AAED,eAAO,MAAM,MAAM,+OAkCjB,CAAC"}
|